Deployment guide

How-to deployment guide for stacks that are already set up on a server

Prerequisites

Before deploying on Dev, make sure the latest development build is ready. The frontend automatically builds every update on the development branch, you can follow the builds statuses here https://rpio-drone.redpencil.io/lblod/frontend-organization-portal/

Before deploying on QA or production, make sure you first created a release, seeCreate releases for instructions.

Frontend

Dev

To deploy the frontend on the dev stack, you can follow the following steps:

ssh root@dev.organisaties.abb.lblod.info
cd /data/app-organization-portal-dev/
drc pull frontend
drc up -d frontend

QA & prod

To deploy the frontend on the QA and prod stacks, you need to have it released and bumped in the application. The deploy process is then the same as the one described in the backend section.

Backend

Dev

To deploy the application on the dev stack, you can follow the following steps:

ssh root@dev.organisaties.abb.lblod.info
cd /data/app-organization-portal-dev/
git pull
drc up -d

QA & prod

To deploy the application on the QA and prod stacks, you need to have it released and bumped in the application.

For an extra layer of safety, especially if there are some data updates, you can copy the data folder in case a revert would be needed, especially on prod:

ssh root@dev.organisaties.abb.lblod.info || ssh root@organisaties.abb.vlaanderen.be
cd /data/app-organization-portal-acc/ || cd /data/app-organization-portal/
cp -r data/ copy-data-date-of-today

Then you can follow the following steps:

ssh root@dev.organisaties.abb.lblod.info || ssh root@organisaties.abb.vlaanderen.be
cd /data/app-organization-portal-acc/ || cd /data/app-organization-portal/
git pull origin vx.x.x(-x)
git fetch --all --tags
drc up -d

Next steps

You might have to restart some services or do specific manipulations depending on the changes that are deployed.

Re-index elasticsearch

If you need to reindex, you can use the existing script: sh scripts/reset-elastic.sh

Note from Claire on 14/11/2023: The reindexing time on prod is becoming bigger and bigger, due partly to the new onboardings but mostly to the big number of mandatarissen and functionarissen. It now takes between 2h30 and 3h to do a full reindex.

Ensure that jobs are not blocked

Check the job initiators logs: drc logs -f --tail 100 delta-producer-bg-jobs-initiator-administrative-units delta-producer-bg-jobs-initiator-organizations delta-producer-bg-jobs-initiator-public delta-producer-pub-graph-maintainer-worship-posts

If you see that an error is inserted, it means you probably deployed while a job was running. To un-stuck the database, you can create and run a migration such as follows:

root@contacthub-dev:/data/app-organization-portal-acc# cat config/migrations/00000000000000-rm-stale-jobs.sparql

PREFIX adms: 
http://www.w3.org/ns/adms#

DELETE { GRAPH ?g { ?jobUri a 
http://vocab.deri.ie/cogs#Job
 . ?jobUri adms:status ?status . ?jobUri ?p ?o . } } WHERE { GRAPH ?g { ?jobUri a 
http://vocab.deri.ie/cogs#Job
. ?jobUri adms:status ?status. ?jobUri ?p ?o. FILTER(?status IN (
http://redpencil.data.gift/id/concept/JobStatus/busy
, 
http://redpencil.data.gift/id/concept/JobStatus/scheduled
)) } }

Docker cheat sheet: start/stop the app

The following commands must be run inside the app directory (e.g /data/app-organization-portal)

docker-compose up -d : Run the app
docker-compose stop : Stop the app
docker-compose logs -f : See the logs
docker-compose kill : kill the app

Last updated