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

feat: migration use of docker compose and env by file #89

Closed
wants to merge 10 commits into from

Conversation

rv2931
Copy link
Collaborator

@rv2931 rv2931 commented Mar 2, 2024

The goal of this PR is :

  • redesign docker environment set up for dev and test at least, production basics eventually
  • create/modify docker compose file(s)
  • Update Makefile and proposing homogeneous and simple targets

For docker compose:

  • manage build
  • describe directly the environment un docker-compose file
  • manage dev/test environment at least
  • manage secrets
  • design an init job (Check DB availability before starting app, Check/Update DB structure ?...)
  • Design maintenance job (load data if mounted, some clean if needed, ...)

Don't hesitate to add/correct things

@rv2931 rv2931 mentioned this pull request Mar 3, 2024
@rv2931
Copy link
Collaborator Author

rv2931 commented Mar 6, 2024

abandonned as Proposed environment management is not really compliant with the actual wanted functionnality of docker compose that load automatically .env file
For information, this .env can be changed by changing COMPOSE_ENV_FILES env vars (Ex: COMPOSE_ENV_FILES=.env.test)

Another way to switch of environment file is to explicitly give env filename to use with --env-file option
docker compose --env-file .env.test

A smart way to se this to use BLOOM_CONFIG env car that is managed by bloom.config for native deployment (Ex export BLOOM_CONFIG=/project/.env.local.deploy && /venv/bin/python app.py) and to declare a local use alias to replace "compose" commande by "compose --env-file=$APP_CONFIG"
With this third configuration you can switch easely from nativ deployement to docker deployement with 2 dedicates files but easely switch by changing APP_CONFIG value

Launching test instanse with Docker and using compose alias

- alias compose="compose --env-file \$APP_CONFIG"
- export APP_CONFIG=.env.docker.test
- docker compose up
- export APP_CONFIG=.env.local.prod
- /venv/bin/python app.py

@rv2931 rv2931 closed this Mar 6, 2024
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.

1 participant