This is a quick update to/errata list for Building the Hasura GraphQL Engine, as I recently built GraphQL Engine v2.0.8 locally and found a couple of things have changed:
Cabal project structure change
cabal.project.freeze
now lives at the top level of the Git repository, not inside server/
. You’ll need to grep
it for GHC/Cabal versions instead of server/cabal.project.freeze
(which no longer exists).
MySQL client library build shenanigans
Something having to do with the mysql
dependency has changed, and the cabal v2-build
process complains that it can’t find my Homebrew-installed OpenSSL library. Thanks to haskell/cabal#2997, the workaround requires modifying the cabal.project
file in the top level of the project:
diff --git a/cabal.project b/cabal.project
index c7f79ed63..61f39635c 100644
--- a/cabal.project
+++ b/cabal.project
@@ -59,6 +59,10 @@ source-repository-package
location: https://github.com/fpco/odbc.git
tag: 7c0cea45d0b779419eb16177407c4ee9e7ba4c6f
+package mysql
+ extra-include-dirs: /usr/local/opt/openssl/include
+ extra-lib-dirs: /usr/local/opt/openssl/lib
+
package odbc
ghc-options: -Wwarn
-- Our CI compiles with -Werror, which is also applied to those packages
Thanks to this file change, the local repository is now in a dirty state, and the resulting binary will tell the browser to load console assets from https://graphql-engine-cdn.hasura.io/console/assets/channel/dirty/v2.0/main.js.gz instead of https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.0/main.js.gz. This, of course, 404s. In order to make the build think the repository state is clean, we need to commit the changes and move the version tag to the new commit. And just to make things ever so slightly more complicated, the repository contains a pre-commit hook, so we need to commit with --no-verify
so that doesn’t run:
$ # Make the requisite changes to cabal.project:
$ $EDITOR cabal.project
$ git commit --no-verify --message "Bodging in extra MySQL dependency paths."
$ git tag --force v2.0.8
Good to go
Then you can cd server && cabal v2-update && cabal v2-build
as before.