-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_FILE environment variable support for Docker Secrets #227
Comments
Thanks; this is really useful 🙌 |
I heard the CLI is depreceated for v5. You can use Postgraphile as a library in Docker. I use fs.readFileSync(process.env.DATABASE_URL_FILE, 'utf8') for Docker Secrets. src/server.js
Dockerfile
|
This isn't the case; the That said, for advanced usage I'd generally advise the library because managing CLI flags becomes a chore quickly ;) |
Getting started
A minor patch to support Docker Secrets, so you don't have to store unencrypted secrets in the env file.
The repository should look like this
Dockerfile
docker-entrypoint.sh
How to use this patch
First, generate the random strings.
Then, manually create a Docker Secret file for the
POSTGRES_PASSWORD
andDATABASE_URL
environment variables. Note thatDATABASE_URL
follows the syntaxpostgres://<POSTGRES_USER>:<POSTGRES_PASSWORD>@db:5432/<POSTGRES_DB>
,POSTGRES_PASSWORD
will be stored in environment variable unecrpyted.Use
docker exec -ti <CONTAINER ID> cat /run/secrets/<secert_name>
to read the contents of the secret data file.docker stack deploy
ordocker-compose
docker-compose.yml
exampleThe text was updated successfully, but these errors were encountered: