Install the Hasura CLI
- https://hasura.io/docs/latest/graphql/core/databases/postgres/queries/index.html
- https://hasura.io/blog/graphql-and-tree-data-structures-with-postgres-on-hasura-dfa13c0d9b5f/
- https://hasura.io/docs/latest/graphql/core/databases/postgres/queries/variables-aliases-fragments-directives.html
- https://hasura.io/docs/1.0/graphql/core/auth/authorization/common-roles-auth-examples.html#anonymous-not-logged-in-users
- Copy the
.env.exampleto.env - Run
composer installon your local machine - If you are running the project on a Mac M1, you might need to update the
docker-compose.ymlto be like the following
graphql-engine:
## On a Mac M1, you might need to enable this line
image: fedormelexin/graphql-engine-arm64:v2.0.9.cli-migrations-v3- Start the docker containers with Laravel Sail
sail up -d - Run the laravel migrations with
sail artisan migrate:fresh --seed
If you are starting the project for the first time, Laravel will not have run the migrations, so the graphql server might have trouble loading, or the GraphQL server may have an error like:
You have been redirected because your GraphQL Engine metadata is in an inconsistent state.
Make sure you run sail artisan migrate:fresh --seed, and restart the docker containers.
- The configuration is stored in the
hasuradirectory. - When making changes to the graphql schema / metadata configuration, you will need to make sure it is stored.
Note: Make sure you have installed the Hasura CLI.
cd hasura
hasura metadata exportIf you need to detach the docker database volume
docker-compose down --volumeIf you need to delete and remove all Docker volumes. You might need to use this to fully reset the database to a clean state.
docker volume rm $(docker volume ls -q)