All Projects → hasura → github-integration-starter

hasura / github-integration-starter

Licence: other
Try out Hasura's GitHub Integration on Cloud Projects using the examples in this repo.

Projects that are alternatives of or similar to github-integration-starter

vetd-app
SaaS buying and decision platform.
Stars: ✭ 92 (+384.21%)
Mutual labels:  hasura
hasura-auth
Authentication for Hasura.
Stars: ✭ 276 (+1352.63%)
Mutual labels:  hasura
hasura-django-starter
The best of Hasura's instant, realtime GraphQL API meshed with Django's built-in auth model and the ability to extend logic across the two services.
Stars: ✭ 50 (+163.16%)
Mutual labels:  hasura
nhost-js-sdk
Nhost JS SDK to handle Auth and Storage with Nhost.
Stars: ✭ 78 (+310.53%)
Mutual labels:  hasura
discover-videos
This app is a clone of Netflix app, check out the course http://bit.ly/nextjs-udemy-ankita on how to build this
Stars: ✭ 81 (+326.32%)
Mutual labels:  hasura
scalafmt-probot
🤖Github bot for checking code formatting with scalafmt
Stars: ✭ 15 (-21.05%)
Mutual labels:  github-integration
platyplus
Low-code, offline-first apps with Hasura
Stars: ✭ 22 (+15.79%)
Mutual labels:  hasura
substrate-graph
a compact graph indexer stack for parity substrate, polkadot, kusama
Stars: ✭ 28 (+47.37%)
Mutual labels:  hasura
recipes-next-hasura
A lightweight app to explore and create recipes - Built with Next.js, Hasura, and Chakra-UI
Stars: ✭ 30 (+57.89%)
Mutual labels:  hasura
Imgbot
An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. [email protected]
Stars: ✭ 1,017 (+5252.63%)
Mutual labels:  github-integration
Graphql Engine
Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
Stars: ✭ 24,845 (+130663.16%)
Mutual labels:  hasura
auth-routes
🔀🔒 Helpful authentication routes for Node.js GitHub integrations
Stars: ✭ 13 (-31.58%)
Mutual labels:  github-integration
members
Managing People (Members), CRUD with Dashboard
Stars: ✭ 36 (+89.47%)
Mutual labels:  hasura
auth-ui-kit
Web UI Kit for Hasura Authentication
Stars: ✭ 13 (-31.58%)
Mutual labels:  hasura
fastify-hasura
A Fastify plugin to have fun with Hasura.
Stars: ✭ 30 (+57.89%)
Mutual labels:  hasura
eGyan
eGyan is a web application built with Node.js (Express) and Hasura (https://hasura.io/) Platform. It is a simple and effective eLearning app for everyone.
Stars: ✭ 36 (+89.47%)
Mutual labels:  hasura
hasura-node-monolith-example
Example of a monolithic web application using Hasura GraphQL Engine + Node.js + Next.js
Stars: ✭ 25 (+31.58%)
Mutual labels:  hasura
next
(Work in progress) The rewritten version of the original PizzaQL 🍕
Stars: ✭ 45 (+136.84%)
Mutual labels:  hasura
hasura-simple-auth
Simple Auth Server For Signup & Login Mutation
Stars: ✭ 32 (+68.42%)
Mutual labels:  hasura
instagram-clone
Instagram clone using apollo, react and graphQl (hasura-graphQl engine)
Stars: ✭ 44 (+131.58%)
Mutual labels:  hasura

Hasura Github Integration Starter Kit

Hasura's github integration automatically deploys your github projects using Hasura Cloud, providing automatic updates of your metadata and database migrations from your repo.

Table of contents

Moving from local dev to Hasura Cloud

Let's say you started developing your app using the OSS version of hasura/graphql-engine image locally using docker. Now you want to apply the changes to the Hasura Cloud project. The first step is to create a Hasura Cloud project.

Deploy to Hasura

Once a project is created, we will launch console and Connect a Database. Depending on how your local development database has been setup, give the same database name here for this connection. For example default is the database name that is used with docker-compose setup initially. Update the name accordingly.

Connect Database

Once a database is connected, we can configure Git Deployment.

Configure git deployment

Head to https://cloud.hasura.io, select the cloud project and go to Git Deployment tab on the navigation menu.

Sign in with Github

Now Sign in with Github to configure the repo for this project.

Git Deployment

After selecting the repo/branch, choose the deployment mode.

There are two modes possible:

  • Automatic: Deployment is triggered automatically when git push happens to the configured repo/branch.
  • Manual: Deployment can only be manually triggered from the dashboard.

Git Deployment Configured

Now, go back to your git repo directory. Assuming you have made some schema or metadata changes via the Console, you can now just git push to trigger a deployment.

git add .
git commit -m "added tables"
git push origin <configured-branch>

Try it out

We have a sample Hasura project in this repo that you can use to quickly try this out. To move from local to cloud, you can make use of the directory local-to-cloud to do git push.

Moving from Hasura Cloud to local dev

Let's say you started developing your app by using a Hasura Cloud project. Now you want to move the current database schema and metadata on the Cloud to a local development setup.

The first step is to initialise a hasura project locally.

hasura init <project-name>

Once a project directory is created, we need to initialise the migration files, pulling the database schema from the cloud project.

hasura migrate create init --sql-from-server --endpoint <hasura-project-url> --admin-secret <admin-secret>

Now head to the migrations directory to check the version of the migration generated.

cd migrations/default

Note down the directory name, which would look something like this 1627564572630_init. Just copy the version number without the _init parts of the name.

hasura migrate apply --endpoint <hasura-project-url> --admin-secret <admin-secret> --skip-execution --version 1627564572630

It is important to add the skip-execution flag since that marks the migration as applied. This is to ensure that the schema that is already created on Hasura Cloud project is not getting applied again, which would end in an error state.

Finally, we need to export metadata:

hasura metadata export --endpoint <hasura-project-url> --admin-secret <admin-secret> 

We have successfully synced our state from Cloud to a local dev environment. As you make changes to the schema and metadata and push it to a dev branch, you should be able to sync those changes to the Cloud project again.

Let's apply the metadata and migrations to our local Hasura project.

hasura metadata apply
hasura migrate apply
hasura metadata reload

The next step is to configure git deployment on the Cloud project by following the steps above.

Start local development of the project using the Hasura CLI. Before that, ensure that the local Hasura project is using the same ENV variable for the Database connection.

hasura console

This will use the default localhost endpoint in config.yaml. You can now use the console to modify schema and metadata.

Thats it! The migrations and metadata changes will be applied automatically. In case you have selected a manual deployment, you can head to Cloud dashboard and choose to manually trigger a deployment.

Try it out

We have a sample Hasura project in this repo that you can use to quickly try this out. To move from cloud to local, you can make use of the directory cloud-to-local to do git push. This project has Cloud specific metadata like api_limits.yaml that gets ignored in your local development but gets applied on Cloud during git deployment.

Moving between two Hasura Cloud instances

This use case is typically for moving between staging and production environments, both of which are in Hasura Cloud.

Now there are two possibilities here. Either you already have a Hasura project structure locally created using the CLI or you just started with a Cloud project to experiment as a dev setup and now want to move the current schema to another cloud project for staging or production.

In the first case of having an existing project structure locally, all we need to do is,

  • Add the environment variable PG_DATABASE_URL for the right database connection string. The env name should match the one on the local project and hence we have used the default one that comes in the docker-compose setup. Feel free to update this value depending on what your local configuration looks like.

Head to cloud.hasura.io, choose the project you want to migrate to and go to the project details page. Click on Env vars on the left sidebar navigation and add a new Env var for the database URL.

Database ENV

Once the database ENV is added, the next step is to identify other ENV variables that are used in local Hasura project setup. For example, if you are using Actions/Events/Remote Schemas and the handler URLs are coming from the ENV, then those envs should also be added appropriately.

Once that is done, we can head to configuring Git Deployment for the project. The steps are outlined above.

In the second case of starting with a Cloud project, we have to initialise the hasura project locally and follow the Git Deployment setup.

Troubleshooting

In case a deployment fails, you can fix the corresponding issues in metadata/migration files with another git push. Learn more different steps to identify and fix issues from the troubleshooting guide on docs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].