3.3.7 Seeding & clearing data on a server

Seeding data on a new server

For new server deployments of OpenCRVS, you will need to seed the databases with the country specific data you created in step 3.2

We have provided an automated Github action: seed-data to do this for you. Manual steps are also explained, should you not wish to use the action.

Provision the following environment variables in Github depending on your environment.

Option 1: Run the automated seed-data action

As you performed in step 3.3.6 Deploy, navigate to "Actions", in Github and click "Seed data."

a) You will be required to select the environment that you wish to seed.

b) You will be required to enter the OpenCRVS Core Dockerhub image tag for any tagged build on Dockerhub) to refer to the OpenCRVS Core release of choice. Usually this will be an official release if you have performed no customisations to core. E.G. v1.3.0

Option 2: Run the seed command manually

NOTE: You can manually run the seed command from terminal by navigating to the opencrvs-core directory

cd opencrvs-core

Export all the required variables:


export COUNTRY_CONFIG_HOST=<URL-to-your-country-config-server> \
export AUTH_HOST=<URL-to-your-auth-server> \
export GATEWAY_HOST=<URL-to-your-gateway-server> \
export SUPER_USER_PASSWORD=<your-superuser-password>

Run the seed to server command

yarn seed:prod

After seeding, the OpenHIM password is reset to the default username: root@openhim.org and default password: openhim-password. In production environments, it is very important for you to login to OpenHIM and change the password at the following URL: https://openhim.<your-domain> Store the new password in your password manager software.

Clearing data on a new server

It is also possible to clear data on a server manually. This is the equivalent to using the --clear-data=yes parameter in the Deploy script in step 3.3.6

THESE ARE DESTRUCTIVE ACTIONS. ALL YOUR OPENCRVS DATA IS DELETED AND RESTORED TO A FACTORY BACKUP.

Clearing all data on a server

  1. SSH into your server and navigate to the following directory:

cd /opt/opencrvs/infrastructure/

2. Ensure that your database secrets are available to the script as environment variables. You can do this by running:

export ELASTICSEARCH_ADMIN_USER=elastic \
export ELASTICSEARCH_ADMIN_PASSWORD=<your elastic password> \
export MONGODB_ADMIN_USER=<your mongo username> \
export MONGODB_ADMIN_PASSWORD=<your mongo password>

3. The clear all script is run like this:

Replace and separate the <REPLICAS> with a space when calling the script: 1, 3 or 5

bash ./clear-all-data.sh <REPLICAS>

After clearing all data on a server, you must re-deploy to the server. This is so that a superuser is recreated allowing you to then re-seed the databases.

Last updated