From e72e11005001736e1d1b30ec4134e33e9c087dd4 Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Wed, 1 May 2024 11:59:16 -0500 Subject: [PATCH] update network configuration in docker compose --- README.md | 28 +--------------------------- docker-compose.yml | 3 +++ 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 383a01b..b5b460c 100755 --- a/README.md +++ b/README.md @@ -85,32 +85,6 @@ The `load-data.sh` script reads environment variables from a `.env` file accorin To run the services with an at scale database, starting from a stand alone database from the this project can be accomplished with minor alterations to the docker-compose.yml to allow the two docker-compose projects to communicate on the same network. -Adding the following to docker-compse.yml allows connection to a pre-existing external docker network. -``` -networks: - nldi: - external: true -``` - -Each service that needs to use that network then needs a `networks` element as in: - -``` ---- - version: '3.3' - - services: - nldi-services: - . - . - . - networks: - - nldi -``` - -With `networks` configured in docker-compose, the environment for the services need to match that of the database and things will connect. For the current (6/8/23) compose environment, that looks like the following. - -NOTE: nldiDbHost is the name of the docker-compose service in the nldi-db project. nldidbUsername and Password need to be synced between the two projects. - ``` environment: serverContextPath: /nldi @@ -119,7 +93,7 @@ NOTE: nldiDbHost is the name of the docker-compose service in the nldi-db projec nldiHost: "localhost:8080" nldiPath: /nldi springFrameworkLogLevel: debug - nldiDbHost: db + nldiDbHost: localhost nldiDbPort: 5432 nldiDbUsername: nldi_data nldiDbPassword: changeMe diff --git a/docker-compose.yml b/docker-compose.yml index ed24fed..54d783c 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,7 @@ services: - NLDI_READ_ONLY_USERNAME=${NLDI_READ_ONLY_USERNAME} - NLDI_READ_ONLY_PASSWORD=${NLDI_READ_ONLY_PASSWORD} - NLDI_DATABASE_ADDRESS=${NLDI_DATABASE_ADDRESS} + network_mode: "host" ports: - ${DB_CI_PORT}:5432 container_name: nldi-db-ci @@ -48,6 +49,7 @@ services: - NLDI_READ_ONLY_USERNAME=${NLDI_READ_ONLY_USERNAME} - NLDI_READ_ONLY_PASSWORD=${NLDI_READ_ONLY_PASSWORD} - NLDI_DATABASE_ADDRESS=${NLDI_DATABASE_ADDRESS} + network_mode: "host" ports: - ${DB_DEMO_PORT}:5432 container_name: nldi-db-demo @@ -57,6 +59,7 @@ services: environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${NLDI_DATABASE_NAME} + network_mode: "host" ports: - ${DB_PORT}:5432 container_name: nldi-db