Skip to content

Instantly share code, notes, and snippets.

@melehin
Last active September 4, 2020 03:03
Show Gist options
  • Save melehin/70c6b27b1bda785f53b8a8cf05548b88 to your computer and use it in GitHub Desktop.
Save melehin/70c6b27b1bda785f53b8a8cf05548b88 to your computer and use it in GitHub Desktop.
Build Hasura 1.3.1 (graphql-engine) on rpi4/jetson nano (arm64/aarch64)
#!/bin/bash
# Ubuntu 18.04
apt install libncurses5 git build-essential llvm wget libnuma-dev zlib1g-dev libpq-dev postgresql-client-common postgresql-client libkrb5-dev libssl-dev
wget https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-aarch64-deb9-linux.tar.xz
wget http://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0.tar.gz
tar xf ghc-8.10.1-aarch64-deb9-linux.tar.xz && tar xzf cabal-install-3.2.0.0.tar.gz
rm *.gz *.xz
pushd ghc-8.10.1
./configure && make install
popd
rm -r ghc-8.10.1
# Apply patch to cabal-install for ghc-8.10 compatibility
wget -O ghc_8_10.patch "https://aur.archlinux.org/cgit/aur.git/plain/ghc_8_10.patch?h=cabal-static"
pushd cabal-install-3.2.0.0
patch -p1 < ../ghc_8_10.patch
popd
pushd cabal-install-3.2.0.0
bash ./bootstrap.sh
popd
git clone -v 1.3.1 https://github.com/hasura/graphql-engine.git
cd graphql-engine/server
# Very important to build graphql-engine
export LC_ALL=C.UTF-8
/root/.cabal/bin/cabal v2-build --ghc-options="+RTS -M2G -c -RTS -j1 -O0" -j1
# The executable file is located here
GRAPHQL_ENGINE=`find dist-newstyle/ -type f -name graphql-engine`
# Build static assets
cd ../console
wget -O - https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install -y nodejs python-pip
pip install gsutil
make deps server-build
# Run server
$GRAPHQL_ENGINE --enable-console --console-assets-dir=static/dist/
@melehin
Copy link
Author

melehin commented Sep 4, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment