Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

d0niek
Copy link

@d0niek d0niek commented Jul 8, 2021

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

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
Copy link
Member

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/

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Contributor

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
Copy link
Member

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).

Copy link
Author

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?

BurningDog added a commit to BurningDog/api-platform-3.x that referenced this pull request Oct 5, 2023
BurningDog added a commit to BurningDog/api-platform-3.x that referenced this pull request Oct 5, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants