Installing Hasura on Fedora CoreOS Latest
In this tutorial, we will guide you through the process of installing Hasura on Fedora CoreOS latest. Hasura is an open-source tool that allows you to quickly build GraphQL APIs on top of your PostgreSQL database.
Before we proceed, here are the prerequisites that you need to meet:
- You should have access to a terminal window and have sudo privileges.
- You should have Docker and Docker Compose already installed on your system.
- You should have a running instance of PostgreSQL database.
With that out of the way, let's get started with the installation process.
Step 1: Download Hasura Docker Image
The first step is to download the Hasura Docker image. Hasura provides an official Docker image that you can use to run the Hasura GraphQL engine.
Run the following command to download the Hasura Docker image:
$ sudo docker pull hasura/graphql-engine:latest
This will download the latest version of the Hasura Docker image on your system.
Step 2: Prepare the Docker Compose File
Now, we need to prepare the Docker Compose file that will be used to start the Hasura GraphQL engine.
Create a new file named docker-compose.yml with the following contents:
version: '3'
services:
graphql-engine:
image: hasura/graphql-engine:latest
ports:
- "8080:8080"
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://user:password@host:port/db
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ADMIN_SECRET: hasura
depends_on:
- db
db:
image: postgres:13.1-alpine
environment:
POSTGRES_DB: db
POSTGRES_USER: user
POSTGRES_PASSWORD: password
Make sure to replace the following fields with your own PostgreSQL database credentials:
user: The username of your PostgreSQL database user.password: The password of your PostgreSQL database user.host: The hostname or IP address of your PostgreSQL server.port: The port number of your PostgreSQL server.db: The name of your PostgreSQL database.
Step 3: Start Hasura GraphQL Engine
Now that we have the Docker Compose file ready, we can start the Hasura GraphQL engine using the following command:
$ sudo docker-compose up -d
This will start the Hasura GraphQL engine in the background. You can check the status of the containers by running the following command:
$ sudo docker ps
This will show you a list of running Docker containers on your system.
Step 4: Access Hasura GraphQL Console
Finally, to access the Hasura GraphQL console, open your web browser and go to http://localhost:8080/console.
You should see the Hasura GraphQL console where you can start building your GraphQL APIs.
Enter the HASURA_GRAPHQL_ADMIN_SECRET value we set in the Docker Compose file to login as admin and start building your schema.
Congratulations! You have successfully installed Hasura on Fedora CoreOS Latest using Docker Compose.