From dc35655aff246cabbcc30468ac283d9e3c9c0986 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Thu, 18 Apr 2024 15:52:09 +0300 Subject: [PATCH 1/9] feat: bind sequence token path to host for persistence --- .gitignore | 2 ++ docker-compose.yml | 4 ++++ logstash/entrypoint.sh | 1 + 3 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index dc5b7f6..6deb7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .env node_modules .idea +*/coverage/* +logstash/couch-seq/sequence_path.txt diff --git a/docker-compose.yml b/docker-compose.yml index fc99182..1fe6131 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,10 @@ services: image: medicmobile/cht-logstash-couchdb:latest build: ./logstash/ restart: always + volumes: + - type: bind + source: ./logstash/couch-seq + target: /tmp/couchdb environment: - COUCHDB_USER=${COUCHDB_USER} - COUCHDB_PASSWORD=${COUCHDB_PASSWORD} diff --git a/logstash/entrypoint.sh b/logstash/entrypoint.sh index 67c4b75..4c0d9a4 100644 --- a/logstash/entrypoint.sh +++ b/logstash/entrypoint.sh @@ -15,6 +15,7 @@ rm "${TEMPLATE_FILE}" if [[ -f "${COUCHDB_SEQ}" && -s "${COUCHDB_SEQ}" ]]; then echo "Using existing sequence file" + echo "Current sequence: $(cat ${COUCHDB_SEQ})" else mkdir -p `dirname ${COUCHDB_SEQ}` \ && chown -R $USER.$USER `dirname ${COUCHDB_SEQ}` \ From 43d83c3d994938a092676e5e478e150ef8ce4d7f Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Thu, 18 Apr 2024 15:55:46 +0300 Subject: [PATCH 2/9] fix: use logstash directory --- .gitignore | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6deb7d3..053c3c8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ node_modules .idea */coverage/* -logstash/couch-seq/sequence_path.txt +logstash/sequence_path.txt diff --git a/docker-compose.yml b/docker-compose.yml index 1fe6131..0bbdf57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: restart: always volumes: - type: bind - source: ./logstash/couch-seq + source: ./logstash target: /tmp/couchdb environment: - COUCHDB_USER=${COUCHDB_USER} From 3a6f86b911775e94f1d59ff2f393cb3900813874 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Thu, 18 Apr 2024 16:56:41 +0300 Subject: [PATCH 3/9] chore: try sleeping for an extra minute --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4af5c9..4e0a8ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: -f docker-compose.postgres.yml -f docker-compose.yml up -d - - name: Sleep for 60 seconds - run: sleep 60s + - name: Sleep for 120 seconds + run: sleep 120s - name: Run e2e tests run: npm test From f9313d72232b38594494595d007ec4b471086432 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 09:28:22 +0300 Subject: [PATCH 4/9] chore: undo sleep increase and test CI failure --- .github/workflows/test.yml | 4 ++-- docker-compose.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e0a8ed..d4af5c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: -f docker-compose.postgres.yml -f docker-compose.yml up -d - - name: Sleep for 120 seconds - run: sleep 120s + - name: Sleep for 60 seconds + run: sleep 60s - name: Run e2e tests run: npm test diff --git a/docker-compose.yml b/docker-compose.yml index 0bbdf57..b4c5d57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,10 @@ services: image: medicmobile/cht-logstash-couchdb:latest build: ./logstash/ restart: always - volumes: - - type: bind - source: ./logstash - target: /tmp/couchdb + # volumes: + # - type: bind + # source: ./logstash + # target: /tmp/couchdb environment: - COUCHDB_USER=${COUCHDB_USER} - COUCHDB_PASSWORD=${COUCHDB_PASSWORD} From 9a0aaeeecbd655d3b9fa442b3034f0501df4aee8 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 09:33:49 +0300 Subject: [PATCH 5/9] chore: re-enable volumes --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b4c5d57..0bbdf57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,10 @@ services: image: medicmobile/cht-logstash-couchdb:latest build: ./logstash/ restart: always - # volumes: - # - type: bind - # source: ./logstash - # target: /tmp/couchdb + volumes: + - type: bind + source: ./logstash + target: /tmp/couchdb environment: - COUCHDB_USER=${COUCHDB_USER} - COUCHDB_PASSWORD=${COUCHDB_PASSWORD} From 380416532561a2d024a825eedbdc55cad3c9bcc4 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 09:53:49 +0300 Subject: [PATCH 6/9] fix: try setting container options --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4af5c9..c5b0db4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,9 @@ jobs: e2e-tests: name: E2E Tests runs-on: ubuntu-latest + container: + image: . + options: -v ./logstash:/tmp/couchdb env: POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "postgres" From 6242af24dd58ce595f96747f3e9ae92fa23cc0fb Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 09:59:45 +0300 Subject: [PATCH 7/9] fix: undo container options --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5b0db4..d4af5c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,6 @@ jobs: e2e-tests: name: E2E Tests runs-on: ubuntu-latest - container: - image: . - options: -v ./logstash:/tmp/couchdb env: POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "postgres" From 3f9024aa21e7f70e6b6b59fb40957431231d2046 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 10:13:22 +0300 Subject: [PATCH 8/9] fix: try setting COUCHDB_SEQ --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4af5c9..99f9f43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: COUCHDB_HOST: "couchdb" COUCHDB_PORT: 5984 COUCHDB_SECURE: false + COUCHDB_SEQ: /tmp/couchdb/sequence_path.txt steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 From edc0a8a35469661a65fe5c4e6b388364dc04a269 Mon Sep 17 00:00:00 2001 From: Njuguna Ndung'u Date: Fri, 19 Apr 2024 10:23:17 +0300 Subject: [PATCH 9/9] fix: move volume bind to override file --- docker-compose.override.yml | 11 +++++++++++ docker-compose.yml | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 docker-compose.override.yml diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..f08357f --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,11 @@ +version: '3.7' + +services: + logstash: + image: medicmobile/cht-logstash-couchdb:latest + build: ./logstash/ + restart: always + volumes: + - type: bind + source: ./logstash + target: /tmp/couchdb diff --git a/docker-compose.yml b/docker-compose.yml index 0bbdf57..fc99182 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,6 @@ services: image: medicmobile/cht-logstash-couchdb:latest build: ./logstash/ restart: always - volumes: - - type: bind - source: ./logstash - target: /tmp/couchdb environment: - COUCHDB_USER=${COUCHDB_USER} - COUCHDB_PASSWORD=${COUCHDB_PASSWORD}