Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskellPackages.hasura: 2.0.7 -> 2.0.9 #139621

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

Lassulus
Copy link
Member

Motivation for this change
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@cdepillabout
Copy link
Member

@ofborg build hasura-graphql-engine hasura-cli

@cdepillabout
Copy link
Member

Looks like this is at least building on Linux.

Thanks!

@cdepillabout cdepillabout merged commit c4f967f into NixOS:haskell-updates Sep 27, 2021
@datakurre
Copy link
Contributor

@Lassulus Is it intentional that graphql-server reports its version as - and hasura cli reports its version as dev?

@Lassulus
Copy link
Member Author

hmm, not really. if that is important maybe it can be fixed

@datakurre
Copy link
Contributor

@Lassulus How have you been using hasura-graphql-engine and hasura-cli from nixpkgs by yourself? Have you been using the web console or managing state with hasura-cli? I'm just wondering, if I am still missing something.

By default, hasura web console uses UI assets from CDN and that fails, because there is no assets for version -. But sure that enforces me to always serve local assets, which is a good thing.

hasura-cli, on the other hand, used to use its version to fetch matching plugins, but that was in 1.3.1 and I'm now only learning how 2.x works...

Anyway, I try to get these versions to work at first. Thanks for managing to package 2.x for nix!

@Lassulus
Copy link
Member Author

not yet, I wanted to but was sadly busy with other stuff. So I haven't come around to actually set it up. You could open up a new issue with you findings and when I come around to actually use it, I can try to fix all the occurring problems.

@datakurre
Copy link
Contributor

@Lassulus Really good to know! I'll try to compose new issues, once I've figure things out.

So far, I can confirm, that graphql-engine server itself seems to work as expected, but the web console has broken UI asset CDN url due to invalid - version. I worked around by extracting assets from docker image and configuring the server to use them as in https://hasura.io/docs/latest/graphql/core/deployment/graphql-engine-flags/config-examples.html#run-console-offline-i-e-load-console-assets-from-server-instead-of-cdn The right thing to do is probably build the assets in nixpkgs and wrap the executable. So far, I have never built them myself 🙈

hasura-cli will be more complex beast. It is not only a go application, but also contains nodejs-based cli-ext. That used to be a separately released binary, but now it is somehow bundled with the go-binary and extracted on first launch. Luckily there is now a runtime flag for using it from predefined path, so we might be able to build also that into nixpkgs separately.

To summarize, we'll need to more thing to package:

  • build console-assets and wrap hasura-graphql-engine and hasura-cli with path to those assets

  • build cli-ext and wrap hasura-cli with the flag pointing to it

@sternenseemann
Copy link
Member

Version is passed in via ldflags usually during the build, may need to adjust that for those packages where it's wrong.

@datakurre
Copy link
Contributor

@Lassulus FYI. I have now built both console-assets and hasura-cli-ext with nix for myself. If you get far enough to try out Hasura for real before I have polished my work into a pull, just ping me. Building also hasura-cli-ext and wrapping hasura-cli to use it is necessary to support Hasura metadata migrations. And we do want to include console-assets to remove one CDN dependency from the UI.

@zarybnicky
Copy link

@datakurre I'd be interested in your code, even untested. I've been trying out Hasura for a project and while fixing the - CDN version is simple as the build process uses the VERSION env variable (below), I've been a bit intimidated by the cli-ext bundle to try fixing that part yet.

overlay = final: prev: {
  hasura-graphql-engine = prev.hasura-graphql-engine.overrideAttrs (oldAttrs: {
    VERSION = prev.hasura-graphql-engine.version;
  });
};

@datakurre
Copy link
Contributor

datakurre commented Oct 26, 2021

@zarybnicky https://gist.github.com/datakurre/8ed08e74881b62ae92a393e6e34cebf5

CDN version fix is not necessary if assets are made available and HASURA_GRAPHQL_CONSOLE_ASSETS_DIR set for graphql-engine. Also hasura console command can serve local assets instead of CDN assets.

Ugly part in building console assets is that even their own Makefile downloads "common" assets from their CDN. With Nix those should probably be downloaded file by file (the gist simply includes them as tarball).

cli-ext is statically linked, because otherwise it would require special surgery similar to

# now is a node program packaged using zeit/pkg.

@zarybnicky
Copy link

@datakurre Thanks! Is this the way Node packages are commonly packaged in Nixpkgs, including the entire node2nix composition in the source tree and using the -composition.nix? Anyway, I've split the files from your Gist into their own mkDerivation files and an overlay, and can confirm that the full Hasura CLI works.

@datakurre
Copy link
Contributor

@zarybnicky To be honest, I have not looked, which is the currently preferred way to package Node packages in nixpkgs. I've ended up with way that is flexibly enough for me and have worked in many use cases.

@datakurre
Copy link
Contributor

@Lassulus Would you be able to help or instruct, how to upgrade hasura 2.0.9 to 2.0.10?

@Lassulus
Copy link
Member Author

sure, just run pkgs/development/misc/haskell/hasura/update.sh from the top-level in nixpkgs. that should hopefully take care of that. just try to build it, if it fails with some reason. maybe some new dependencies need to be vendored, or some vendored need to be removed, that step is sadly trial and error, if it actually comes up.

@datakurre
Copy link
Contributor

#148321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants