graphql-engine/packaging/cli-migrations/v3
Ananya Mohanty 72f578c777 fix TEMP_PROJECT_DIR var in cli-migrations/v3
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10612
GitOrigin-RevId: dd35138226ef3c0b0b014170588d1a1f023bb4db
2024-01-12 06:05:39 +00:00
..
test CI: Upgrade ci-util to use the latest Ubuntu and Docker patches. 2023-06-07 15:17:04 +00:00
.gitignore ci: produce ubuntu and centos flavoured graphql-engine images 2022-03-22 12:03:25 +00:00
docker-entrypoint.sh fix TEMP_PROJECT_DIR var in cli-migrations/v3 2024-01-12 06:05:39 +00:00
Dockerfile build: fix vulnerabilities in main for the upcoming v2.30 release 2023-07-12 10:18:32 +00:00
README.md docs: update cli migrations page 2023-11-07 11:12:41 +00:00

CLI Migrations

This docker image provides a method to run migrations and metadata at docker entrypoint. A temporary server is booted, with the migrations API allowed, securely through localhost. Once migrations and metadata have been applied, the server will reboot in a secure mode for inbound graphql usage.

See ./docker-entrypoint.sh

Examples

It is used in a docker file as:

FROM hasura/graphql-engine:<version>.cli-migrations-v3

CMD graphql-engine \
  --metadata-database-url $METADATA_DATABASE_URL \
  serve \
  --server-port $PORT \
  --enable-console

Local

This is covered in the documentation here: https://hasura.io/docs/latest/graphql/core/migrations/auto-apply-migrations.html The below Configuration will also be applicable.

Configuration

You may set the following environment variables to configure the way this image is run.

Migrations Directory (Optional)

Migrations are either mounted or built into the image.

If it has been stored in a directory other than the default then it can be configured using the following:

  • HASURA_GRAPHQL_MIGRATIONS_DIR (default=/hasura-migrations)

    A path to the migrations directory.

Metadata Directory (Optional)

Metadata are either mounted or built into the image.

If it has been stored in a directory other than the default then it can be configured using the following:

  • HASURA_GRAPHQL_METADATA_DIR (default=/hasura-metadata)

    A path to the metadata directory.

GraphQL Server (Optional)

Optional configuration for the server which boots during migrations.

  • HASURA_GRAPHQL_MIGRATIONS_SERVER_PORT (default=9691)

    Specify the port running the graphql server during execution of the migration script. It is advised that you do not specify a PORT that may be open e.g. 80/443 and the default should rarely require changing.

  • HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT (default=30s)

    Specify the server timeout threshold.