Distributed GraphQL Quickstart with Hasura
This is a GraphQL quickstart. Your apps will run faster if the APIs they call are physically located close to your end users. You'll deploy the open-source Hasura from DockerHub, and to make things quick we'll leverage a pre-created data source that Section provides. (Our other GraphQL tutorials show you how to configure various backend databases of your own.)
Before starting, create a new Section Project and then delete the default Deployment and
ingress-upstream Service to prepare the project for your new deployment.
Create a Deployment for Hasura
Create the deployment for Hasura as
hasura-deployment.yaml. This will direct Section to run the Hasura open source container. Note that we are using a connection string that points to a read-only Section owned/operated database on AWS. Be sure to supply a Hasura console password in
- image: hasura/graphql-engine
- name: HASURA_GRAPHQL_DATABASE_URL
- name: HASURA_GRAPHQL_ENABLE_CONSOLE
- name: HASURA_GRAPHQL_ADMIN_SECRET
Apply this deployment resource to your Project with either the Kubernetes dashboard or
kubectl apply -f hasura-deployment.yaml.
Expose the Hasura Console on the Internet
We want to expose the Hasura console on the Internet. Create
ingress-upstream.yaml as defined below.
- name: 80-80
Apply this service resource to your Project with either the Kubernetes dashboard or
kubectl apply -f ingress-upstream.yaml.
See the pods running on Section's network using
kubectl get pods -o wide.
-o wide switch shows where your GraphQL API is running according to the default AEE location optimization strategy. Your GraphQL API will be optimally deployed according to traffic.
Experiment with Hasura
Now, you can start using Hasura. The AWS RDS Aurora database contains a small amount of read-only "pets" data that you can use to experiment with Hasura's GraphQL querying ability.