Setting Up Hasura Local Development Environment

2.3 Setup Hasura/Local Development

Abhishek Bhattacharya
6 min readJul 3, 2017

Hello guys, this is my fourth blog post for the Internship at Hasura!

Links to my blog posts from this week:

As a part of second week’s task of setting up the Local Development Environment, I had to install the Hasura Platform on a Local machine.
As I have a 32-bit PC, I couldn’t setup Local Development on my laptop as Minikube doesn’t work on 32-bit machines.I had help from a friend and set the Local Environment on his 64-bit laptop having Windows.

Hasura quite excited to have Kubernetes

The reason being that Hasura is a platform that is installed on any Linux machine. The only dependency it needs is Kubernetes(a product of a decade of engineering at Google). ​

What is Minikube?
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.

Kubernetes is a tool that makes it easy for us to administer a system without actually going into the system. So I can create a server, without SSHing inside the server.It is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure.

Why containers?

Summary of container benefits:

  • Agile application creation and deployment: Increased ease and efficiency of container image creation compared to VM image use.
  • Continuous development, integration, and deployment: Provides for reliable and frequent container image build and deployment with quick and easy rollbacks (due to image immutability).
  • Dev and Ops separation of concerns: Create application container images at build/release time rather than deployment time, thereby decoupling applications from infrastructure.
  • Environmental consistency across development, testing, and production: Runs the same on a laptop as it does in the cloud.
  • Cloud and OS distribution portability: Runs on Ubuntu, RHEL, CoreOS, on-prem, Google Container Engine, and anywhere else.
  • Application-centric management: Raises the level of abstraction from running an OS on virtual hardware to run an application on an OS using logical resources.
  • Loosely coupled, distributed, elastic, liberated micro-services: Applications are broken into smaller, independent pieces and can be deployed and managed dynamically — not a fat monolithic stack running on one big single-purpose machine.
  • Resource isolation: Predictable application performance.
  • Resource utilization: High efficiency and density.
Containers living up to their namesakes.(Kubernetes)
https://hasura.io

Prerequisites

Virtual Box, as the Hasura Environment will reside in the Virtual box. You can use this link to know why Virtual Box is used. Remember to run Virtual Box as administrator(simply right click on the Virtual Box icon and select Run as administrator).

  • Next you need to install Git Bash as all the below given commands will be executed here.
  • Install hasuractl.exe and place it in your PATH. Refer to this video for the installation process.
  • Install latest kubectl , version 1.6.0 or above.

Step 1: Installing VirtualBox

VirtualBox is a cross platform virtualization application that installs on Intel and AMD-based computers irrespective of the operating system it is running on.

VirtualBox can be used for running multiple operating systems (virtually, on top of your actual operating system) at the same time. So, you may run Windows 8.1 on top of your Ubuntu system; Windows 2008 server in a Linux server; Linux Mint on your Windows 7 PC, and so on. You can install and run as many virtual machines as you like. The only limit is memory and disc space.

Virtualbox is simple yet very powerful. It can run everywhere from small embedded systems to desktop class machines to data-center deployments and even Cloud environments.

Oracle VM VirtualBox
VirtualBox is being actively developed with frequent releases and has an ever growing list of features, supported guest
.

Step 2:Installing Git Bash on windows:

Git Bash has a silly name. It’s comprised of two parts:

  • git: a version control tool we have a training mission about, and
  • bash: a shell that runs commands once you type the name of a command and press <enter> on your keyboard.
GitBash
Downloading GitBash

Step 3: Install hasuractl:

  • Windows OS
  • Download hasuractl.exe and place it in your System Path.
Environment Variables
Adding Path by clicking Edit

Step 4: Install kubectl:

The process of installing kubectl is exactly the same as installing hasuractl. So follow the above process for installing it.

The link to download kubectl

Step 5: Create account:

Create an account on https://beta.hasura.io/ if you don’t have any.

Step 6: Login to the account:

Run the command to login into your account through git bash.It will connect your local development with your account

hasuractl login

Enter your Email/Username and Password.

  • Refer to this video if you need help with the installation on Windows:

Step 6: Start your local development:

Run this command to start your local development.

hasuractl local start

On running this command for the first time around 1.5 GB of docker images will be downloaded for our Hasura project. This took me about half an hour with decent Internet speeds.Please be patient at this step.It is recommended you close all applications before proceeding!

Starting LocalDev for first time

Congratulations !

Hasura is ready to use

Step 7: Now login into your console:

You can login to your console using the credentials you got in the previous step.

Logging in to Console
  • To stop the running Hasura platform use 0the command hasuractl local stop, you can start it again by executing hasuractl local start.
Stopping Hasura
  • If you get stuck in the following error loop, execute commands hasuractl local delete and hasuractl local start. Yes, you need to carry out the entire process again!

After Setup, you can start and stop Hasura Local Development with the commands hasuractl local start and hasuractl local stop respectively.

The official guide for setting up Hasura Local Development Environment is given here:

Coming Up!

In the next blog, I’ll talk about Data Modelling for my web application Doc Finder.

--

--

Abhishek Bhattacharya

Bertelsmann Data Science Challenge Scholarship Recipient | Writer at Data Driven Investor