hasura / hasura/graphql-engine

cli-migrations don't work if container is run as non root user

Open
#3,824 3 comments 5 reactions 0 assignees View on GitHub
c/build-system
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

I'm using hasura/graphql-engine:v1.0.0.cli-migrations as a base image for deploying hasura in openshift.
Openshift by default does not allow running container as root user but runs containers using an arbitrarily assigned user ID.

This makes the migrations fail at two points:
1) `docker-entrypoint.sh` fails when trying to copy migrations to /tmp/hasura-migrations because it uses `cp -a` and is unable to preserve ownership
2) cli fails when creating `/.hasura`

For 1) I was able to work around this by using a copy of `docker-entrypoint.sh` and just changing to `cp -dR`
For 2) I created the directory at image build time instead of waiting for the cli to create it at runtime.

Would changing this impact something else or would you consider a PR updating the entrypoint and cli dockerfile?
If not, would you consider adding this to the migration documentation?

Contributor guide

Open the contributing guide

Research direction

Start with docker-entrypoint.sh and the CLI Dockerfile, focusing on the migration copy into /tmp/hasura-migrations and creation of /.hasura. Check the migration documentation for the existing behavior and verify that a container running as a non-root user completes migrations without either failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.