My CD pipeline:
- Get Docker image (created and pushed during CI stage).
- Copy docker-compose .yml template to target server.
- Run the app.
Let's go straight to the 3rd point. I can run the app using docker-compose up e.g., but I have no idea how to handle configuration. Target server is a Ubuntu Server created by Chief on AWS, I have an access to all AWS services like Parameter Store etc.
So here are my ideas about managing configurations:
- save secrets to configuration file before running the app and attach this file to specific location in docker-compose template (I don't like this solution, I can handle this by some bash script that inject secrets to file).
- set environment variables before running the app (I talked with some DevOps and basically they like this solution).
- get secrets from AWS Parameter Store (unfortunately I can't have an access by role management, only by key which I need to set on server by env or in config file).
How does managing configuration look like in real case scenarios? I'm worried about case of server crash or something similar. 1st solution will survive this, but in case of 2nd and 3rd ones the environment variables will be lost after crash/reboot. What is the best solution here?