Simplify deploy with docker-compose#1965
Conversation
This reverts commit 9794547.
According to this issue api-platform#1859 to run docker-compose on production we have to run command like `docker-compose -f docker-compose.yml -f docker-compose.prod.yml ...`. With setting up an env COMPOSE_FILE we don't have to prefix docker commands with compose files. See https://docs.docker.com/compose/reference/envvars/#compose_file
| @@ -0,0 +1,2 @@ | |||
| # Uncomment line below on production server to skip docker-compose -f options | |||
There was a problem hiding this comment.
Is the .env.dist file automatically loaded? I cannot find any information regarding this on https://docs.docker.com/compose/env-file/
There was a problem hiding this comment.
It is not.
Typically on repo setup, cp .env.dist .env should be run, and .env.dist is basically an example that lives with the repo.
Or you can use --env-file .env.dist as an option to docker-compose commands, although that's less nice from a UX standpoint.
There was a problem hiding this comment.
In this case shouldn't we rename this file .env.prod and uncomment the env var?
There was a problem hiding this comment.
I'd say that's probably appropriate considering this project's existing setup. The word dist is a bit incongruent with what this repo currently has.
| @@ -0,0 +1,2 @@ | |||
| # Uncomment line below on production server to skip docker-compose -f options | |||
| #COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml | |||
There was a problem hiding this comment.
We should also add a default SERVER_NAME env var here to hint users that they can use this env var to configure the hostname (cc @francislavoie).
There was a problem hiding this comment.
Sounds good and we can add more envs like APP_SECRET, MERCURE_PUBLISHER_JWT_KEY, MERCURE_SUBSCRIBER_JWT_KEY but is it a good PR to do that?
* ci: created Docker env vars Following api-platform/api-platform#1965 * ci: adjusted deploy scripts * feat: added required env vars into .bash_aliases * docs: deployment with Docker * ci(dockerfile): adjusting openssh-server * no need for sshd_config * added docs * feat: simply sshtunnel ssh key config * ci: use bind-mounted folder for database instead * fix(env): set MESSENGER_TRANSPORT_DSN to a default * fix: console bash scripts
According to this issue #1859 to run docker-compose on production we
have to run command like
docker-compose -f docker-compose.yml -f docker-compose.prod.yml ....With setting up an env COMPOSE_FILE we don't have to prefix docker
commands with compose files.
See https://docs.docker.com/compose/reference/envvars/#compose_file