Skip to content

Customizing docker-compose.yaml to run mpic as on production environment

Santiago Faci requested to merge T366919 into main

Some improvements have been added to have a kind of test-env so that we can run MPIC as on a production-like environment and also on a development one. Changing the value for NODE_ENV we can change set on which environment is MPIC running (development and production) and some improvements have been added to the docker compose files and the project to take advantage of that.

  • docker-compose.yaml has been customized to be able use as the MPIC docker test environment, to be able to run MPIC as on a production-like environment:

    • Some customization will be needed (create a .env.local file with the needed environment variables that MPIC uses for secrets). A .env.local.sample file is provided in the repository
    • the database container is not exposing ports locally (not needed) so both production-like and development environments can be running at the same time
  • Added a Makefile to run some goals easily to create the MPIC docker image and start and shutdown the environment (mpic + database)

    • startup-qa to run a production-like test environment (mpic + database)
    • shutdown-qa to stop and remove the production-like environment
    • startup-dev to run a development environment (only a database container with sample data)
    • shutdown-dev to stop and remove the development environment
    • run-prod to run mpic locally using config.local.yaml with the same configuration as a production-like one
  • config.dev.yaml and config.prod.yaml has been modified to represent a real config file for a production-like environment (secrets will be provided as environment variables)

  • docker-compose.dev.yaml has been changed to rename the database container to avoid collision with the one we use in the main docker compose file

Anyway, while developing, you can always start MPIC as on production-like environment running make run-prod (this goal starts the database test env (make startup-dev) and runs MPIC with NODE_ENV=production npm run start-prod)

Bug: T366919

Edited by Santiago Faci

Merge request reports