From 0d9f4171fce74f80f3999faec435cd34a733e3e8 Mon Sep 17 00:00:00 2001 From: Kyle Stang <33678573+kylestang@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:55:13 -0700 Subject: [PATCH 1/2] Make search depend on elasticsearch (#185) # Description Makes the search container depend on the elasticsearch container and adds a healthcheck to elasticsearch. Closes #184 ## How to Test Run `docker compose up --build` ## Checklist - [x] The code includes tests if relevant - [x] I have *actually* self-reviewed my changes and done QA --- apps/data/elasticsearch/Dockerfile | 2 ++ docker-compose.yml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/data/elasticsearch/Dockerfile b/apps/data/elasticsearch/Dockerfile index dc868591..723d740f 100644 --- a/apps/data/elasticsearch/Dockerfile +++ b/apps/data/elasticsearch/Dockerfile @@ -1,3 +1,5 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:8.13.4 +HEALTHCHECK CMD curl -k https://elastic:$ELASTIC_PASSWORD@localhost:8311/_cluster/health + COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml diff --git a/docker-compose.yml b/docker-compose.yml index ea4aae2f..177aacb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -78,7 +78,9 @@ services: build: apps/algorithm/search container_name: martletplace_search restart: unless-stopped - depends_on: [] + depends_on: + elasticsearch: + condition: service_healthy volumes: [ ./apps/algorithm/search/src:/app/src ] environment: - ES_ENDPOINT=https://elastic:serxdfcghjfc@elasticsearch:8311 From 48efcc2ef144b62b39c236407f379769ab62f785 Mon Sep 17 00:00:00 2001 From: Toby Murray <63079400+TobySMurray@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:59:51 -0700 Subject: [PATCH 2/2] RESOPS142 - Remove docker port forwarding (#179) # Description Commenting out the ports for each service so they interact through the proxy rather than directly. Closes #142 ## How to Test Services should connect to their data stores without error. ## Checklist - [ ] The code includes tests if relevant - [ ] I have *actually* self-reviewed my changes and done QA --- docker-compose.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 177aacb7..7c891931 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: depends_on: [] volumes: [ ./apps/frontend/src:/app/src ] environment: [] - ports: [ 8101:8101 ] + #ports: [ 8101:8101 ] networks: [ proxy-frontend ] proxy: @@ -32,7 +32,7 @@ services: volumes: [ ./apps/backend/user/src:/app/service/src ] environment: - DB_ENDPOINT=postgres://martletplace:johuigytfrdcv@datalayer:8300/martletplace - ports: [ 8211:8211 ] + #ports: [ 8211:8211 ] networks: [ proxy-user, user-datalayer ] listing: @@ -46,7 +46,7 @@ services: volumes: [ ./apps/backend/listing/src:/app/service/src ] environment: - DB_ENDPOINT=postgres://martletplace:johuigytfrdcv@datalayer:8300/martletplace - ports: [ 8212:8212 ] + #ports: [ 8212:8212 ] networks: [ proxy-listing, listing-datalayer ] review: @@ -60,7 +60,7 @@ services: volumes: [ ./apps/backend/review/src:/app/service/src ] environment: - DB_ENDPOINT=postgres://martletplace:johuigytfrdcv@datalayer:8300/martletplace - ports: [ 8213:8213 ] + #ports: [ 8213:8213 ] networks: [ proxy-review, review-datalayer ] message: @@ -71,7 +71,7 @@ services: volumes: [ ./apps/backend/message/src:/app/src ] environment: - DB_ENDPOINT=postgres://martletplace:johuigytfrdcv@datalayer:8300/martletplace - ports: [ 8214:8214 ] + #ports: [ 8214:8214 ] networks: [ proxy-message, message-datalayer ] search: @@ -84,7 +84,7 @@ services: volumes: [ ./apps/algorithm/search/src:/app/src ] environment: - ES_ENDPOINT=https://elastic:serxdfcghjfc@elasticsearch:8311 - ports: [ 8221:8221 ] + #ports: [ 8221:8221 ] networks: [ proxy-search, search-datalayer ] recommend: @@ -94,7 +94,7 @@ services: depends_on: [] volumes: [ ./apps/algorithm/recommend/src:/app/src ] environment: [] - ports: [ 8222:8222 ] + #ports: [ 8222:8222 ] networks: [ proxy-recommend, recommend-datalayer ] datalayer: @@ -110,7 +110,7 @@ services: - POSTGRESQL_DATABASE=martletplace - POSTGRESQL_HOST=database - POSTGRESQL_PORT=8310 - ports: [ 8300:8300, 8301:8301 ] + #ports: [ 8300:8300, 8301:8301 ] networks: [ datalayer-database, datalayer-elasticsearch, datalayer-cache, datalayer-blob ] database: @@ -123,7 +123,7 @@ services: - POSTGRES_USER=martletplace - POSTGRES_PASSWORD=johuigytfrdcv - POSTGRES_DB=martletplace - ports: [ 8310:8310 ] + #ports: [ 8310:8310 ] networks: [ datalayer-database ] elasticsearch: @@ -134,7 +134,7 @@ services: volumes: [] environment: - ELASTIC_PASSWORD=serxdfcghjfc - ports: [ 8311:8311 ] + #ports: [ 8311:8311 ] networks: [ datalayer-elasticsearch, search-datalayer ] mem_limit: 1GB