Skip to content

Commit d78ab37

Browse files
committed
add QA_ENV flag
1 parent b87e484 commit d78ab37

File tree

7 files changed

+37
-45
lines changed

7 files changed

+37
-45
lines changed

.github/workflows/clear-environment.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828

2929
jobs:
3030
reset-data:
31-
name: 'Reset data'
31+
name: 'Reset data from stack ${{ inputs.stack }} in ${{ inputs.environment }}'
3232
environment: ${{ inputs.environment }}
3333
runs-on: ubuntu-22.04
3434
outputs:
@@ -74,7 +74,6 @@ jobs:
7474
MINIO_ROOT_USER: ${{ secrets.MINIO_ROOT_USER }}
7575
MINIO_ROOT_PASSWORD: ${{ secrets.MINIO_ROOT_PASSWORD }}
7676
SSH_ARGS: ${{ vars.SSH_ARGS }}
77-
STACK: ${{ inputs.stack }}
7877
run: |
7978
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST $SSH_ARGS "
8079
ELASTICSEARCH_ADMIN_USER=elastic \
@@ -83,11 +82,9 @@ jobs:
8382
MONGODB_ADMIN_PASSWORD=$MONGODB_ADMIN_PASSWORD \
8483
MINIO_ROOT_USER=$MINIO_ROOT_USER \
8584
MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD \
86-
/opt/opencrvs/infrastructure/clear-all-data.sh $REPLICAS $STACK"
85+
/opt/opencrvs/infrastructure/clear-all-data.sh $REPLICAS ${{ inputs.stack }}"
8786
8887
echo "Running migrations..."
8988
echo
9089
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST $SSH_ARGS "
91-
ELASTICSEARCH_ADMIN_USER=elastic \
92-
ELASTICSEARCH_ADMIN_PASSWORD=$ELASTICSEARCH_SUPERUSER_PASSWORD \
93-
/opt/opencrvs/infrastructure/run-migrations.sh"
90+
/opt/opencrvs/infrastructure/run-migrations.sh ${{ inputs.stack }}"

.github/workflows/e2e.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
name: E2E
2-
run-name: Deploy to ${{ github.event.inputs.environment }} and E2E
2+
run-name: Deploy to ${{ github.event.inputs.stack }} and E2E
33
on:
4-
push:
5-
branches:
6-
- e2e/*
74
workflow_dispatch:
85
inputs:
9-
environment:
10-
type: choice
11-
description: Environment to deploy to
6+
stack:
7+
type: string
8+
description: Stack name
129
required: true
13-
default: 'development'
14-
options:
15-
- development
1610

1711
jobs:
1812
discover-tests:
@@ -50,7 +44,7 @@ jobs:
5044
test:
5145
needs: [discover-tests]
5246
runs-on: ubuntu-22.04
53-
environment: ${{ github.event.inputs.environment || 'development' }}
47+
environment: qa
5448
strategy:
5549
fail-fast: false
5650
matrix:
@@ -92,7 +86,7 @@ jobs:
9286
if: steps.check-specs.outputs.has_spec_files == 'true'
9387
run: npx playwright test ./e2e/testcases/${{ matrix.test_dir }}
9488
env:
95-
DOMAIN: '${{ vars.DOMAIN }}'
89+
DOMAIN: '${{inputs.stack}}.${{ vars.DOMAIN }}'
9690

9791
- uses: actions/upload-artifact@v4
9892
if: steps.check-specs.outputs.has_spec_files == 'true'

infrastructure/clear-all-data.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ docker run --rm --network=$NETWORK appropriate/curl curl -X POST "http://influxd
102102
#-----------------------------
103103
docker run --rm --network=$NETWORK --entrypoint=/bin/sh minio/mc -c "\
104104
mc alias set myminio http://minio:9000 $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD && \
105-
mc rm --recursive --force myminio/${STACK}__ocrvs && \
106-
mc rb myminio/${STACK}__ocrvs && \
107-
mc mb myminio/${STACK}__ocrvs"
108-
109-
# Delete all data from metabase
110-
#-----------------------------
111-
docker exec $(docker ps | grep opencrvs_dashboards | awk '{print $1}' | head -n 1) /bin/sh -c "rm -rf /data/metabase/*"
105+
mc rm --recursive --force myminio/${STACK}--ocrvs && \
106+
mc rb myminio/${STACK}--ocrvs && \
107+
mc mb myminio/${STACK}--ocrvs"
112108

infrastructure/docker-compose.app.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33
hearth:
44
image: opencrvs/hearth:1.1.0
55
environment:
6+
- QA_ENV=true
67
- HOST=0.0.0.0
78
- mongodb__url=mongodb://${STACK}__hearth:${HEARTH_MONGODB_PASSWORD}@mongo1/${STACK}__hearth-dev?replicaSet=rs0
89
- logger__level=warn
@@ -31,6 +32,7 @@ services:
3132
secrets:
3233
- jwt-public-key.{{STACK}}.{{ts}}
3334
environment:
35+
- QA_ENV=true
3436
- HOST=0.0.0.0
3537
- NODE_ENV=production
3638
- LANGUAGES=en,fr
@@ -84,6 +86,7 @@ services:
8486
- 'traefik.http.routers.${STACK}__block-dashboard-queries.middlewares=${STACK}__block-internal-routes'
8587
replicas: 1
8688
environment:
89+
- QA_ENV=true
8790
- HOST=0.0.0.0
8891
- NODE_ENV=production
8992
- FHIR_URL=http://hearth:3447/fhir
@@ -96,6 +99,7 @@ services:
9699
- COUNTRY_CONFIG_URL=https://countryconfig.${STACK}.{{hostname}}
97100
- LOGIN_URL=https://login.${STACK}.{{hostname}}
98101
- CLIENT_APP_URL=https://register.${STACK}.{{hostname}}
102+
- SENDER_EMAIL_ADDRESS=${SENDER_EMAIL_ADDRESS}
99103
# This needs to be the internal swarm url
100104
# as containers cannot connect to the web
101105
- GATEWAY_URL=http://gateway:7070
@@ -122,6 +126,7 @@ services:
122126
login:
123127
image: opencrvs/ocrvs-login:${VERSION}
124128
environment:
129+
- QA_ENV=true
125130
- HOST=0.0.0.0
126131
- COUNTRY_CONFIG_URL=https://countryconfig.${STACK}.{{hostname}}
127132
- CONTENT_SECURITY_POLICY_WILDCARD=${CONTENT_SECURITY_POLICY_WILDCARD}
@@ -154,6 +159,7 @@ services:
154159
client:
155160
image: opencrvs/ocrvs-client:${VERSION}
156161
environment:
162+
- QA_ENV=true
157163
- HOST=0.0.0.0
158164
- DECLARED_DECLARATION_SEARCH_QUERY_COUNT=100
159165
- COUNTRY_CONFIG_URL=https://countryconfig.${STACK}.{{hostname}}
@@ -194,10 +200,12 @@ services:
194200
secrets:
195201
- jwt-public-key.{{STACK}}.{{ts}}
196202
environment:
203+
- QA_ENV=true
197204
- HOST=0.0.0.0
198205
- NODE_ENV=production
199206
- LANGUAGES=en,fr
200207
- SENTRY_DSN=${SENTRY_DSN:-}
208+
- DISABLE_RATE_LIMIT=true
201209
- APN_SERVICE_URL=http://apm-server:8200
202210
- CERT_PUBLIC_KEY_PATH=/run/secrets/jwt-public-key.{{STACK}}.{{ts}}
203211
- LOGIN_URL=https://login.${STACK}.{{hostname}}
@@ -250,6 +258,7 @@ services:
250258
secrets:
251259
- jwt-public-key.{{STACK}}.{{ts}}
252260
environment:
261+
- QA_ENV=true
253262
- HOST=0.0.0.0
254263
- NODE_ENV=production
255264
- LANGUAGES=en,fr
@@ -284,6 +293,7 @@ services:
284293
secrets:
285294
- jwt-public-key.{{STACK}}.{{ts}}
286295
environment:
296+
- QA_ENV=true
287297
- HOST=0.0.0.0
288298
- NODE_ENV=production
289299
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -314,6 +324,7 @@ services:
314324
volumes:
315325
- /data/vsexport:/usr/src/app/packages/metrics/src/scripts
316326
environment:
327+
- QA_ENV=true
317328
- HOST=0.0.0.0
318329
- NODE_ENV=production
319330
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -353,6 +364,7 @@ services:
353364
- jwt-public-key.{{STACK}}.{{ts}}
354365
- jwt-private-key.{{STACK}}.{{ts}}
355366
environment:
367+
- QA_ENV=true
356368
- HOST=0.0.0.0
357369
- NODE_ENV=production
358370
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -399,6 +411,7 @@ services:
399411
secrets:
400412
- jwt-public-key.{{STACK}}.{{ts}}
401413
environment:
414+
- QA_ENV=true
402415
- HOST=0.0.0.0
403416
- NODE_ENV=production
404417
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -429,6 +442,7 @@ services:
429442
secrets:
430443
- jwt-public-key.{{STACK}}.{{ts}}
431444
environment:
445+
- QA_ENV=true
432446
- HOST=0.0.0.0
433447
- NODE_ENV=production
434448
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -470,6 +484,7 @@ services:
470484
secrets:
471485
- jwt-public-key.{{STACK}}.{{ts}}
472486
environment:
487+
- QA_ENV=true
473488
- HOST=0.0.0.0
474489
- NODE_ENV=production
475490
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -525,6 +540,7 @@ services:
525540
secrets:
526541
- jwt-public-key.{{STACK}}.{{ts}}
527542
environment:
543+
- QA_ENV=true
528544
- HOST=0.0.0.0
529545
- NODE_ENV=production
530546
- APN_SERVICE_URL=http://apm-server:8200
@@ -548,6 +564,7 @@ services:
548564
scheduler:
549565
image: opencrvs/ocrvs-scheduler:${VERSION}
550566
environment:
567+
- QA_ENV=true
551568
- NODE_ENV=production
552569
- METRICS_URL=http://metrics:1050
553570
deploy:
@@ -566,6 +583,7 @@ services:
566583
migration:
567584
image: opencrvs/ocrvs-migration:${VERSION}
568585
environment:
586+
- QA_ENV=true
569587
- HOST=0.0.0.0
570588
- ELASTICSEARCH_INDEX_NAME=ocrvs--${STACK}
571589
- USER_MGNT_MONGO_URL=mongodb://${STACK}__user-mgnt:${USER_MGNT_MONGODB_PASSWORD}@mongo1/${STACK}__user-mgnt?replicaSet=rs0
@@ -614,6 +632,7 @@ services:
614632
restart_policy:
615633
condition: none
616634
environment:
635+
- QA_ENV=true
617636
- HOST=0.0.0.0
618637
- REPLICAS=1
619638
- DATABASE_PREFIX=${STACK}
@@ -646,6 +665,7 @@ services:
646665
- overlay_net
647666
- dependencies_overlay_net
648667
environment:
668+
- QA_ENV=true
649669
- HOST=0.0.0.0
650670
# Note that only mongo1 is used here on purpose for all environments
651671
# https://discourse.metabase.com/t/solved-add-mongodb-replicaset-database/7404/2

infrastructure/elasticsearch/roles/search_user.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cluster": ["manage"],
33
"indices": [
44
{
5-
"names": ["ocrvs", "ocrvs-*"],
5+
"names": ["*__ocrvs", "ocrvs", "ocrvs-*", "ocrvs--*"],
66
"privileges": [
77
"write",
88
"create",

infrastructure/mongodb/on-deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ if [[ $HEARTH_USER != "FOUND" ]]; then
120120
db.createUser({
121121
user: '${DATABASE_PREFIX}__hearth',
122122
pwd: '$HEARTH_MONGODB_PASSWORD',
123-
roles: [{ role: 'readWrite', db: "${DATABASE_PREFIX}__hearth" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__hearth-dev" }]
123+
roles: [{ role: 'readWrite', db: "${DATABASE_PREFIX}__hearth" }, { role: 'readWrite', db: "performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__hearth-dev" }]
124124
})
125125
use performance
126126
db.createUser({
@@ -135,7 +135,7 @@ else
135135
use ${DATABASE_PREFIX}__hearth-dev
136136
db.updateUser('${DATABASE_PREFIX}__hearth', {
137137
pwd: '$HEARTH_MONGODB_PASSWORD',
138-
roles: [{ role: 'readWrite', db: "${DATABASE_PREFIX}__hearth" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__hearth-dev" }]
138+
roles: [{ role: 'readWrite', db: "${DATABASE_PREFIX}__hearth" }, { role: 'readWrite', db: "performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__performance" }, { role: 'readWrite', db: "${DATABASE_PREFIX}__hearth-dev" }]
139139
})
140140
use performance
141141
db.updateUser('${DATABASE_PREFIX}__hearth', {

infrastructure/run-migrations.sh

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,7 @@
88
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
99
set -e
1010

11-
print_usage_and_exit () {
12-
echo 'Usage: ./run-migrations.sh'
13-
echo ""
14-
echo "If your Elasticsearch is password protected, an admin user's credentials can be given as environment variables:"
15-
echo "ELASTICSEARCH_ADMIN_USER=your_user ELASTICSEARCH_ADMIN_PASSWORD=your_pass"
16-
exit 1
17-
exit 1
18-
}
19-
20-
elasticsearch_host() {
21-
if [ ! -z ${ELASTICSEARCH_ADMIN_USER+x} ] || [ ! -z ${ELASTICSEARCH_ADMIN_PASSWORD+x} ]; then
22-
echo "$ELASTICSEARCH_ADMIN_USER:$ELASTICSEARCH_ADMIN_PASSWORD@elasticsearch:9200";
23-
else
24-
echo "elasticsearch:9200";
25-
fi
26-
}
11+
STACK=$1
2712

2813
# run migration by restarting migration service
29-
docker service update --force --update-parallelism 1 --update-delay 30s $STACK_migration
14+
docker service update --force --update-parallelism 1 --update-delay 30s "${STACK}_migration"

0 commit comments

Comments
 (0)