3.3.7 Seeding & clearing data on a server
Last updated
Last updated
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.
Variable | Description |
---|---|
GATEWAY_HOST | The URL to the gateway microservice e.g.: https://gateway.<your-domain> |
AUTH_HOST | The URL to the auth microservice e.g.: https://auth.<your-domain> |
COUNTRY_CONFIG_HOST | The URL to the country-config microservice e.g.: https://countryconfig.<your-domain> |
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
Export all the required variables:
Run the seed to server command
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.
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.
SSH into your server and navigate to the following directory:
2. Ensure that your database secrets are available to the script as environment variables. You can do this by running:
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
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.