How to Install Hasura on OpenSUSE Latest
Hasura is a powerful open-source tool for building real-time GraphQL APIs quickly and securely. In this tutorial, we will show you how to install Hasura on OpenSUSE latest version.
Prerequisites
- A server or virtual machine running OpenSUSE Latest
- A sudo or root user account
Step 1: Install Docker and Docker-compose
The first step is to install Docker and Docker-compose, which are required to run Hasura.
- Update your system packages:
sudo zypper refresh
- Install Docker:
sudo zypper install docker
- Start the Docker service:
sudo systemctl start docker
- Enable the Docker service to start at boot:
sudo systemctl enable docker
- Install Docker-compose:
sudo zypper install docker-compose
Step 2: Download Hasura
- Create a new directory for Hasura:
mkdir hasura
cd hasura
- Download the latest Hasura Docker image:
sudo docker pull hasura/graphql-engine:latest
Step 3: Start Hasura
- Create a new Docker Compose file:
touch docker-compose.yml
- Edit the file and add the following contents:
version: '3.6'
services:
graphql-engine:
image: hasura/graphql-engine:v2.0.9
ports:
- "8080:8080"
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:password@localhost:5432/dbname
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
depends_on:
- postgres
networks:
- hasura
postgres:
image: postgres:13-alpine
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: dbname
volumes:
- db-data:/var/lib/postgresql/data
networks:
- hasura
volumes:
db-data:
networks:
hasura:
Replace
passwordanddbnamewith your own Postgres password and database name.Start Hasura and Postgres containers:
sudo docker-compose up -d
- Access Hasura console by visiting
http://<server-ip-address>:8080in your web browser.
Conclusion
In this tutorial, we have shown you how to install and configure Hasura on OpenSUSE Latest. You can now start building your own real-time GraphQL APIs using this powerful tool.