Skip to content

Commit a25d2ee

Browse files
committed
add QA_ENV flag
1 parent b87e484 commit a25d2ee

File tree

5 files changed

+27
-31
lines changed

5 files changed

+27
-31
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 }}"

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: 18 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
@@ -122,6 +125,7 @@ services:
122125
login:
123126
image: opencrvs/ocrvs-login:${VERSION}
124127
environment:
128+
- QA_ENV=true
125129
- HOST=0.0.0.0
126130
- COUNTRY_CONFIG_URL=https://countryconfig.${STACK}.{{hostname}}
127131
- CONTENT_SECURITY_POLICY_WILDCARD=${CONTENT_SECURITY_POLICY_WILDCARD}
@@ -154,6 +158,7 @@ services:
154158
client:
155159
image: opencrvs/ocrvs-client:${VERSION}
156160
environment:
161+
- QA_ENV=true
157162
- HOST=0.0.0.0
158163
- DECLARED_DECLARATION_SEARCH_QUERY_COUNT=100
159164
- COUNTRY_CONFIG_URL=https://countryconfig.${STACK}.{{hostname}}
@@ -194,6 +199,7 @@ services:
194199
secrets:
195200
- jwt-public-key.{{STACK}}.{{ts}}
196201
environment:
202+
- QA_ENV=true
197203
- HOST=0.0.0.0
198204
- NODE_ENV=production
199205
- LANGUAGES=en,fr
@@ -250,6 +256,7 @@ services:
250256
secrets:
251257
- jwt-public-key.{{STACK}}.{{ts}}
252258
environment:
259+
- QA_ENV=true
253260
- HOST=0.0.0.0
254261
- NODE_ENV=production
255262
- LANGUAGES=en,fr
@@ -284,6 +291,7 @@ services:
284291
secrets:
285292
- jwt-public-key.{{STACK}}.{{ts}}
286293
environment:
294+
- QA_ENV=true
287295
- HOST=0.0.0.0
288296
- NODE_ENV=production
289297
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -314,6 +322,7 @@ services:
314322
volumes:
315323
- /data/vsexport:/usr/src/app/packages/metrics/src/scripts
316324
environment:
325+
- QA_ENV=true
317326
- HOST=0.0.0.0
318327
- NODE_ENV=production
319328
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -353,6 +362,7 @@ services:
353362
- jwt-public-key.{{STACK}}.{{ts}}
354363
- jwt-private-key.{{STACK}}.{{ts}}
355364
environment:
365+
- QA_ENV=true
356366
- HOST=0.0.0.0
357367
- NODE_ENV=production
358368
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -399,6 +409,7 @@ services:
399409
secrets:
400410
- jwt-public-key.{{STACK}}.{{ts}}
401411
environment:
412+
- QA_ENV=true
402413
- HOST=0.0.0.0
403414
- NODE_ENV=production
404415
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -429,6 +440,7 @@ services:
429440
secrets:
430441
- jwt-public-key.{{STACK}}.{{ts}}
431442
environment:
443+
- QA_ENV=true
432444
- HOST=0.0.0.0
433445
- NODE_ENV=production
434446
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -470,6 +482,7 @@ services:
470482
secrets:
471483
- jwt-public-key.{{STACK}}.{{ts}}
472484
environment:
485+
- QA_ENV=true
473486
- HOST=0.0.0.0
474487
- NODE_ENV=production
475488
- SENTRY_DSN=${SENTRY_DSN:-}
@@ -525,6 +538,7 @@ services:
525538
secrets:
526539
- jwt-public-key.{{STACK}}.{{ts}}
527540
environment:
541+
- QA_ENV=true
528542
- HOST=0.0.0.0
529543
- NODE_ENV=production
530544
- APN_SERVICE_URL=http://apm-server:8200
@@ -548,6 +562,7 @@ services:
548562
scheduler:
549563
image: opencrvs/ocrvs-scheduler:${VERSION}
550564
environment:
565+
- QA_ENV=true
551566
- NODE_ENV=production
552567
- METRICS_URL=http://metrics:1050
553568
deploy:
@@ -566,6 +581,7 @@ services:
566581
migration:
567582
image: opencrvs/ocrvs-migration:${VERSION}
568583
environment:
584+
- QA_ENV=true
569585
- HOST=0.0.0.0
570586
- ELASTICSEARCH_INDEX_NAME=ocrvs--${STACK}
571587
- USER_MGNT_MONGO_URL=mongodb://${STACK}__user-mgnt:${USER_MGNT_MONGODB_PASSWORD}@mongo1/${STACK}__user-mgnt?replicaSet=rs0
@@ -614,6 +630,7 @@ services:
614630
restart_policy:
615631
condition: none
616632
environment:
633+
- QA_ENV=true
617634
- HOST=0.0.0.0
618635
- REPLICAS=1
619636
- DATABASE_PREFIX=${STACK}
@@ -646,6 +663,7 @@ services:
646663
- overlay_net
647664
- dependencies_overlay_net
648665
environment:
666+
- QA_ENV=true
649667
- HOST=0.0.0.0
650668
# Note that only mongo1 is used here on purpose for all environments
651669
# 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-*"],
66
"privileges": [
77
"write",
88
"create",

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)