Setup Hasura Platform

Kayalvizhi Muthuganesh
4 min readJun 23, 2017

--

Hasura is a platform to build & deploy powerful app backends. It provides basic user facing API services such as for data API service and auth API service.

Hasura provides Postgres service for database. By adding tables to Postgres via the console, or via the data API, the data service is able to provide API for performing CRUD queries across all the defined tables

Hasura has a ready to use authorization service that provides APIs for almost all common authentication use cases. The auth service on Hasura helps you build applications FAST by not writing repetitive code that deals with authentication and user management.

To know more and to deploy your app go to:

Steps to setup Hasura platform

The reference for setup is here

Prerequisites

1.Install Virtual Box

A VirtualBox or VB is a software virtualization package that installs on an operating system as an application. VirtualBox allows additional operating systems to be installed on it, as a Guest OS, and run in a virtual environment.

  • You should have atleast 4GB of RAM (because the VM might take upto 2GB of RAM)
  • You should have a 64bit system

The reason for installing Virtual box is, when we create a new Hasura project, a set of services is installed on it.

2. Install Hasuractl

  • Windows:

Download hasuractl.exe and place it in your PATH. Refer to this video reference if you need help with the installation on Windows.

  • Linux:
curl -Lo hasuractl https://storage.googleapis.com/hasuractl/v0.1.2/linux-amd64/hasuractl && chmod +x hasuractl && sudo mv hasuractl /usr/local/bin/

Feel free to leave off the sudo mv hasuractl /usr/local/bin if you would like to add hasuractl to your path manually

  • Mac:
curl -Lo hasuractl https://storage.googleapis.com/hasuractl/v0.1.2/darwin-amd64/hasuractl && chmod +x hasuractl && sudo mv hasuractl /usr/local/bin/

Feel free to leave off the sudo mv hasuractl /usr/local/bin if you would like to add hasuractl to your path manually.

3.Install latest kubectl (>= 1.6.0) (https://kubernetes.io/docs/tasks/kubectl/install/)

Starting Hasura

  1. Create an account on beta.hasura.io if you do not have one
  2. Run: hasuractl login
  3. After you have successfully logged in, run this command:

hasuractl local start

It might take a long time for this to finish, depending on your internet connection. The command exits by pointing you to a url to login to the console.

Stopping hasura

hasuractl local stop

This will stop the running hasura platform. You can start it again by running hasuractl local start.

Cleaning hasura

If you like to clean the existing hasura platform to start afresh, you can run this:

hasuractl local clean

NOTE: The above command will delete all data and configuration. However, the underlying VM is not deleted and hence the downloaded images still exist inside the VM. This is what you should be using if you plan to run hasuractl local start again. If you would also like to delete the underlying VM, you should run this:

hasuractl local delete

The above command will delete the the VM completely and hence all the downloaded images with it.

Error Faced

In my Mac when I was installing hasuractl I faced an error and it showed — watch err: EOF, as shown in the 1st screen shot below

After I gave hasuractl login command, it took long time and showed a page full of anonymous text. Then I tried starting hasura, but it showed watch error: EOF and then nothing happened for few mins.

If got errors

First wait till it finishes the process completely for the given command. If still facing problems

hasuractl local stop

then

hasuractl local clean

it will delete all data and configuration but downloaded images are safe

Start Hasura again

hasuractl local start

After doing the above process it gave the login username, password and the link to the console as

http://console.c100.hasura.me

Finally Reached the console

Here is the hasura console page.

--

--