Sunday, June 25, 2017

Hasura Internship - 2.3 The pain of local development

The Hasura platform is awesome. The whole purpose of the internship was to get us to build stuff using Hasura APIs and what not. I gently grazed over the hasura docs, and for me personally it feels like there's no more fun left in coding out what I want. I may not be the greatest programmer, but I do take fun and joy in building the stuff I want, the way I want. It's one of the reasons why I stare at the screen all day. Ranting aside, lets setup the Hasura platform on our local machine.

Lets do this

The local dev setup relies on setting up pre-configured virtual machines which are controlled by a tool called kubernetes.
  1. Enable Hardware virtualization if we have a UEFI machine 
  2. Install virtualbox : sudo apt install virtualbox
  3. Get kubectl (linux link) and move it to /usr/local/bin or our preferred location.
  4. Clone the local-dev repo. The repo changed quite a lot when I had set it up (it's now just one README now).
  5. Read the README in the url mentioned above.  After executing a line that goes kubectl create -f platform-init.yaml , a ~2GB download will start. Be patient till it finishes.
  6. If we have anything running on port 80 (ie local apache or nginx), stop the service before launching the local instance of hasura platform. A netstat -nptl wil show all tcp and udp ports in use, in our linux system.
  7. Free atleast 4GB of RAM to have a smooth experience with the platform.
  8. Its a pain to always type in 2 or 3 commands to get something up and running. So make scripts to get things rolling
$ cat ~/bin/hasura_start.sh

#!/bin/bash

echo "starting minikube ... "
minikube start --kubernetes-version v1.6.3
echo "minikube running :)"

GW_IP=`minikube ip`

sudo ssh -N -o UserKnownHostsFile=/dev/null -L 80:$GW_IP:80 -L 2022:$GW_IP:2022 docker@$GW_IP

Run the above script to start hasura and the below one to stop it.

$ cat ~/bin/hasura_stop.sh

#!/bin/bash

minikube stop


Log Date : May 10 - 20

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home