Add a Hasura starter (#61)

This commit is contained in:
Faraz Patankar
2021-03-18 23:53:07 +04:00
committed by GitHub
parent 3bcd393da0
commit a78e5f21a4
3 changed files with 53 additions and 0 deletions

2
examples/hasura/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.temp

View File

@@ -0,0 +1,30 @@
FROM hasura/graphql-engine:v1.3.3
# Enable the console
ENV HASURA_GRAPHQL_ENABLE_CONSOLE=true
# Enable debugging mode. It should be disabled in production.
ENV HASURA_GRAPHQL_DEV_MODE=true
# Heroku hobby tier PG has few limitations including 20 max connections
# https://devcenter.heroku.com/articles/heroku-postgres-plans#hobby-tier
ENV HASURA_GRAPHQL_PG_CONNECTIONS=15
# Change $DATABASE_URL to your heroku postgres URL if you're not using
# the primary postgres instance in your app
CMD graphql-engine \
--database-url $DATABASE_URL \
serve \
--server-port $PORT
## Comment the command above and use the command below to
## enable an access-key and an auth-hook
## Recommended that you set the access-key as a environment variable in heroku
#CMD graphql-engine \
# --database-url $DATABASE_URL \
# serve \
# --server-port $PORT \
# --access-key XXXXX \
# --auth-hook https://myapp.com/hasura-webhook
#
# Console can be enable/disabled by the env var HASURA_GRAPHQL_ENABLE_CONSOLE

21
examples/hasura/README.md Normal file
View File

@@ -0,0 +1,21 @@
# Hasura example
This example sets up a [Hasura](https://hasura.io/opensource/) instance with a [PostgreSQL](https://www.postgresql.org/) database.
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fhasura&plugins=postgresql&envs=HASURA_GRAPHQL_ADMIN_SECRET&HASURA_GRAPHQL_ADMIN_SECRETDesc=To+secure+your+GraphQL+endpoint+and+the+Hasura+console.)
## ✨ Features
- Postgres
- Hasura
## 💁‍♀️ How to use
- Click the `Deploy on Railway` button
- Set up a `HASURA_GRAPHQL_ADMIN_SECRET` to secure your endpoints and console.
- Visit your console after the deployment is complete
## 📝 Notes
- This starter automagically provisions a PostgreSQL database for you when you click the `Deploy on Railway`. The `DATABASE_URL` enviroment variable used in the `Dockerfile` is picked up from there.
- The Hasura console and dev mode are enabled by default for a better development experience. You may want to read the [production checklist](https://hasura.io/docs/latest/graphql/core/deployment/production-checklist.html) before going live with your app.