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
Simplify deploy with docker-compose #1965
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case shouldn't we rename this file .env.prod
and uncomment the env var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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