First of all I’m sorry if there would’ve been a better place to post this.
I’m wondering if the system we are currently planning on using is “good”, or if better methods can be used. Let me first explain the situation as I’d like it to be.
Each “application” consists of a group of dockers, with a single nginx docker with an exposed port. This nginx acts as a reverse proxy to forward data, inside a network.
<nginx-reverse-proxy> -- <static-data-server (nginx)>
-- <dynamic server 1 (/api/shop)>
-- <dynamic server 2 (/api/whatever)>
One of the important things for us is that we can easily add “modules”, as in extra dynamic/static servers need to be added without a lot of modifications.
Currently the reverse proxy server reads an environment variable field, which “notifies” a launcher script (bash script), the launcher script then modifies sites-enabled, to create the reverse proxy locations before starting nginx.
The problem is in the dynamic servers, right now we manually add and launch these after rolling out of the tests. Using docker build
followed by a docker run
. This is error prone and quite slow (considering for each update we have to manually stop the docker, rebuild it and run it). The next step is to automate the building using a python script. However I am wondering how and what should be done there.
We could start with a docker compose file. However this would initially just be the network, a python script would update the docker compose as more dockerfiles are added. Now this leaves one big point: whenever a service module is updated I wish to reload that module’s code only, without interfering on stopping the other modules.
I understand that docker-compose up
is supposed to do this. But can this commando pick up only modifications to the folder? IE:
# Dockerfile
FROM alpine
COPY ./source/build/ /source/
# docker-compose
version: "3.7"
services:
webapp:
build:
context: .
dockerfile: Dockerfile
Would in above situation a change in the build directory be picked up by docker-compose up
. Or if it doesn’t, how do I tell that a specific service has an updated source directory?