4.3.6.5 Resetting a server environment

Reset a development, qa and staging environment

The Reset environment Github Action can be used to clear a development, qa and staging environment of all data. This is useful during testing of environments where you may have made test registrations.

After resetting your environment, it contains no data at all. It must be seeded again,

Reset a production environment

Perhaps you need to clear production after completing a test that backup is working successfully in readiness for going live. Or perhaps you need to restore a previous backup onto production for some other reason. In these scenarios, you would be required to reset your production environment.

  1. You need the REPLICAS, ELASTICSEARCH_ADMIN_PASSWORD, MONGODB_ADMIN_USER, MONGODB_ADMIN_PASSWORD, MINIO_ROOT_USER and MINIO_ROOT_PASSWORD secrets for the production environment. You created and stored these in your password manager in this step.

  2. SSH into your production environment manager node and run this command on your server to set these environment variables in your terminal session.

export ELASTICSEARCH_ADMIN_USER=elastic \
export ELASTICSEARCH_ADMIN_PASSWORD=<enter the appropriate secret here> \
export MONGODB_ADMIN_USER=<enter the appropriate secret here> \
export MONGODB_ADMIN_PASSWORD=<enter the appropriate secret here> \
export MINIO_ROOT_USER=<enter the appropriate secret here> \
export MINIO_ROOT_PASSWORD=<enter the appropriate secret here> \
export REPLICAS=<enter the appropriate secret here>
  1. Run the following command to clear the data:

bash /opt/opencrvs/infrastructure/clear-all-data.sh $REPLICAS
  1. All the databases are now empty but some database migrations must run to prepare them for re-seeding or restoring a backup. Run this command to migrate the databases:

/opt/opencrvs/infrastructure/run-migrations.sh
  1. Run this command to clear your terminal session of the history of any exported secrets (security step)

history -c
history -w

Your production environment is now ready for re-seeding / restoration.