How to Install Hasura on Debian Latest

Hasura is a platform that makes it easy to build applications on top of a PostgreSQL database. In this tutorial, we will explain how to install Hasura on Debian latest.

Prerequisites

Before you can proceed with the installation of Hasura, you must have the following:

Step 1: Create a Docker Compose File

To install Hasura, we will use Docker Compose. First, create a docker-compose.yml file in your working directory by running the following command:

touch docker-compose.yml

Next, open the file using your favorite text editor and paste the following content:

version: '3.6'
services:
  graphql-engine:
    image: hasura/graphql-engine:v2.0.7
    ports:
      - "8080:8080"
    environment:
      - HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@db:5432/dbname

Here, we define a service named graphql-engine that runs the Hasura GraphQL engine. We specify the version of the Hasura image to use, map port 8080 on the host machine to port 8080 in the container, and set the environment variable HASURA_GRAPHQL_DATABASE_URL to the URL of your PostgreSQL database.

Replace username, password, and dbname with your PostgreSQL database configuration.

Step 2: Start the Hasura GraphQL Engine

To start the Hasura GraphQL engine, navigate to your working directory where the docker-compose.yml file is located and run the following command:

docker-compose up -d

This command will start the Hasura engine in the background. You can verify that it is running by running the following command:

docker-compose ps

This will display the running status of the Hasura container.

Step 3: Access the Hasura Console

Once the Hasura GraphQL Engine is running, you can access the Hasura console by visiting http://localhost:8080/console in your web browser.

Conclusion

In this tutorial, we have explained how to install Hasura on Debian latest using Docker Compose. You can now start building your applications on top of PostgreSQL with easy-to-use Hasura APIs.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!