Deploying Hasura GraphQL Engine on Koyeb
This guide explains how to deploy the Hasura GraphQL Engine on the Koyeb Serverless Platform.
To successfully follow and complete this guide, you need:
- A PostgreSQL database to use as the Hasura GraphQL Engine backend.
- A Koyeb account to deploy and run the Hasura GraphQL Engine.
One-click deploy to Koyeb
To deploy Hasura to Koyeb quickly, click the button below:
On the configuration screen, set the
HASURA_GRAPHQL_DATABASE_URL environment variable to the connection string for your database and the
HASURA_GRAPHQL_ADMIN_SECRET environment variable to a secret value to access the Hasura Console.
Click the Deploy button when you are finished. When the deployment completes, you can access the Hasura Console.
Deploy Hasura GraphQL Engine on Koyeb manually
To deploy the Hasura GraphQL Engine on Koyeb manually, we use the
hasura/graphql-engine Docker image.
On the Koyeb control panel, click the Create App button. You land on the first page of the Koyeb App creation form.
Select Docker as the deployment method.
hasura/graphql-engine. Leave the
Tagfield blank to use the latest image. Click Next to continue.
Click the Advanced button to access additional options.
In the Environment variables section, configure the environment variables required to properly run the Hasura GraphQL Engine:
HASURA_GRAPHQL_DATABASE_URL: The environment variable containing the PostgreSQL URL, i.e.
postgres://<user>:<password>@<host>:<port>/<database>. Since this value contains sensitive information, select the "Secret" type. Secrets are encrypted at rest and are ideal for storing sensitive data like API keys, OAuth tokens, etc. Choose "Create secret" in the "Value" drop-down menu and enter the secret value in the "Create secret" form.
HASURA_GRAPHQL_ENABLE_CONSOLE: Set to
true. This will expose and allow you to access the Hasura Console.
HASURA_GRAPHQL_ADMIN_SECRET: The secret to access the Hasura Console. As with the
HASURA_GRAPHQL_DATABASE_URL, we strongly recommend using a secret to store this value.
In the Exposing your service section, change the
8080to match the port that the
hasura/graphql-engineDocker image app listens on. Koyeb uses this setting to perform application health checks and to properly route incoming HTTP requests. If you want the Hasura GraphQL Engine to be available on a specific path, you can change the default one (
/) to the path of your choice.
Give your App a name, i.e
hasura-demo, and click Deploy.
The deployment should be up and running in a few seconds.
Access the Hasura Console
Once your Koyeb App is deployed, you can click the App link in the Koyeb control panel to access the Hasura Console:
At any time, you can track your Hasura service status in the Koyeb Control Panel and view the Hasura GraphQL Engine web service logs in the Logs tab of your service.