Hasura is an open-source engine based on the GraphQL query language for API. It allows you to create a connection, manage, and configure event triggers for the PostgreSQL database in minutes. Hasura helps you build GraphQL applications backed by PostgreSQL or incrementally move your existing projects.
In this tutorial, we’ll overview two examples of the Hasura GraphQL engine installation at CirrusGrid PaaS:
Log in the dashboard and click Marketplace at the top-left corner.
Search for the Docker Engine CE package and initiate its installation.
To automatically create Hasura and PostgreSQL database in the same container, choose the Deploy containers from compose.yml option, and provide the default config from the Hasura on Docker repository:
https://raw.githubusercontent.com/hasura/graphql-engine/master/install-manifests/docker-compose/docker-compose.yaml
Note: The installation requires a public IP, which is a paid option available for billing users only.
Configure the remaining Environment, Display Name, Region (if available) fields up to your needs, and click Install.
http://{envDomain}:8080/console
That’s it! Now, you can provide Data for your database via the same-named tab at the top and try out GraphQL queries afterward.
In case you already have a database, you can connect to it with the Hasura GraphQL engine.
Create a clean standalone Docker Engine CE via CirrusGrid Marketplace.
After creation connect to the container via Web SSH and create a file with the following content (e.g. nano docker-run.sh):
docker run -d --restart=always -p 80:8080 \ -e HASURA_GRAPHQL_DATABASE_URL=postgres://{username}:{password}@{host}/{dbname} \ -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ -e HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey \ hasura/graphql-engine:v1.0.0
For the detailed information on the docker run command, refer to the official documentation. In our case, the parameters are the following:
chmod +x docker-run.sh ./docker-run.sh
You can additionally run the docker ps command to ensure that the Hasura service is up and running.
According to our settings, admin secret key should be provided to access console (myadminsecretkey in our case).
Note: If there are existing tables that should be tracked by Hasura, go to the Data tab and allow access to the required ones.
Alternatively, you can use GraphQL Endpoint (specified at the top of the page) to create your POST request to the database via any preferred tool or script.
Powered by BetterDocs
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.