From 7c528766b0a163054f21833e8a37731a8bce550c Mon Sep 17 00:00:00 2001 From: Alec Turner Date: Fri, 1 Mar 2024 11:05:50 -0800 Subject: [PATCH] updates to docker-compose.yml and documentation to allow runtime configuration Further configuration options are made available to support running multiple instances of the app on the same machine, including the use of docker sibling containers. `README.md` and `template.env` are updated accordingly. The database port is no longer exposed as this is not required to access and manage the app at this time. --- README.md | 11 ++++++++--- .../streamline/streamline-emr/docker-compose.yml | 5 ++--- template.env | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0ba3ba46..07a7fd50 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,13 @@ In a docker environment, the application must be started manually. This is done /var/signalytic/clientapps/streamline/streamline-emr/entry ``` +If multiple instances are run from the same machine, additional configuration may be required to differentiate the instances. This is generally the case when using the "sibling container" method for running docker from within a docker container. See the `Configuration` section for more details. + ## Configuration Certain configuration options can be adjusted by setting environment variables or by defining these variables in a `.env` file stored in the same directory as the `docker-compose.yml` file. These variables are: -`APP_PORTS`: port mapping for the web app server (default: `3000:80`) -`DB_PORTS`: port mapping for the database server (default: `6607:3306`) -`CONTAINER_NAME`: name of the application container (default: `streamline-emr`) \ No newline at end of file +`APP_PORT`: port mapping for the web app server (default: `3000`) +`CONTAINER_NAME`: name of the application container (default: `streamline-emr`) +`DATA_DIR`: directory to be mounted for peristent data (default: `/var/signalytic/clientapps/streamline/streamline-emr/data`) +`COMPOSE_PROJECT_NAME`: assign the project name associate with the compose file - this avoids conflicts when the "same" compose file is used to manage multiple instances (e.g. when using docker sibling containers) + +Important note when using "sibling containers": the sibling container method uses the host docker socket to provide containers with access to docker. As a result, port mappings and volumne mount points all refer to the host system rather than the container from which the docker command originates. \ No newline at end of file diff --git a/root/var/signalytic/clientapps/streamline/streamline-emr/docker-compose.yml b/root/var/signalytic/clientapps/streamline/streamline-emr/docker-compose.yml index 9dec5dc0..beced585 100644 --- a/root/var/signalytic/clientapps/streamline/streamline-emr/docker-compose.yml +++ b/root/var/signalytic/clientapps/streamline/streamline-emr/docker-compose.yml @@ -4,7 +4,6 @@ services: image: registry.gitlab.com/signalytic/client-external/streamline/streamline-emr:2.0 container_name: ${CONTAINER_NAME:-streamline-emr} volumes: - - '/var/signalytic/clientapps/streamline/streamline-emr/data:/var/lib/mysql' + - "${DATA_DIR:-/var/signalytic/clientapps/streamline/streamline-emr/data}:/var/lib/mysql" ports: - - ${APP_PORTS:-3000:80} - - ${DB_PORTS:-6607:3306} \ No newline at end of file + - "${APP_PORT:-3000}:80" \ No newline at end of file diff --git a/template.env b/template.env index e0828c84..23e8a83b 100644 --- a/template.env +++ b/template.env @@ -1,2 +1,4 @@ -APP_PORTS="3001:80" -DB_PORTS="6607:3306" \ No newline at end of file +APP_PORT=3000 +CONTAINER_NAME=streamline-emr-1 +COMPOSE_PROJECT_NAME=streamline-emr-1 +DATA_DIR=/path/to/volume/mount/dir \ No newline at end of file