Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions infrastructure/deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ docker_stack_deploy() {

get_opencrvs_version() {
PREVIOUS_VERSION=$(configured_ssh "docker service ls | grep opencrvs_base | cut -d ':' -f 2")
echo "Previous opencrvs version: $PREVIOUS_VERSION"
echo "Current opencrvs version: $VERSION"
echo "Previous opencrvs version: $PREVIOUS_VERSION"
echo "Current opencrvs version: $VERSION"
}

reset_metabase() {
Expand Down Expand Up @@ -335,6 +335,7 @@ export PERFORMANCE_MONGODB_PASSWORD=`generate_password`
export OPENHIM_MONGODB_PASSWORD=`generate_password`
export WEBHOOKS_MONGODB_PASSWORD=`generate_password`
export NOTIFICATION_MONGODB_PASSWORD=`generate_password`
export EVENTS_MONGODB_PASSWORD=`generate_password`

#
# Elasticsearch credentials
Expand Down
17 changes: 17 additions & 0 deletions infrastructure/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,23 @@ services:
options:
gelf-address: 'udp://127.0.0.1:12201'
tag: 'user-mgnt'
events:
secrets:
- jwt-public-key.{{ts}}
environment:
- NODE_ENV=production
- MONGO_URL=mongodb://${STACK}__events:${METRICS_MONGODB_PASSWORD}@mongo1/${STACK}__events?replicaSet=rs0
deploy:
labels:
- 'traefik.enable=false'
replicas: 1
networks:
- overlay_net
logging:
driver: gelf
options:
gelf-address: 'udp://127.0.0.1:12201'
tag: 'events'
notification:
secrets:
- jwt-public-key.{{ts}}
Expand Down
22 changes: 22 additions & 0 deletions infrastructure/mongodb/on-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,26 @@ else
roles: [{ role: 'readWrite', db: 'notification' }]
})
EOF
fi

EVENTS_USER=$(echo $(checkIfUserExists "events"))
if [[ $EVENTS_USER != "FOUND" ]]; then
echo "events user not found"
mongo $(mongo_credentials) --host $HOST <<EOF
use events
db.createUser({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could echo out the implication: not found --> creating

user: 'events',
pwd: '$EVENTS_MONGODB_PASSWORD',
roles: [{ role: 'readWrite', db: 'events' }]
})
EOF
else
echo "events user exists"
mongo $(mongo_credentials) --host $HOST <<EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could echo out the implication: user exists --> updating credentials

use events
db.updateUser('events', {
pwd: '$EVENTS_MONGODB_PASSWORD',
roles: [{ role: 'readWrite', db: 'events' }]
})
EOF
fi