3.2.6 Create factory reset reference data backups

Provided that the import script in step 3.2.5 Import set up files ran successfully, OpenCRVS is now installed with reference data for your country (administrative divisions and statistics, your civil registration offices, your health facilities and your employees for development or production)
Before you login and start to configure your application using the UI and before you create registrations and an audit trail, we must make a factory reset backup of your databases so that you can restore everything to an empty state with your reference data as it was now.
This is a very helpful backup for iterative development and you can run this command as often as you like to get a snapshot of the basic development config but these factory reset backups are NOT TO BE CONFUSED WITH A FULL OPENCRVS BACKUP AND RESTORE!!
  1. 1.
    To begin with, OpenCRVS Core must be running, but it is not necessary for your country configuration server to be running. This should be the case already if you have just finished step 3.2.5 Ensure that OpenCRVS Core is running following the steps in 3.1.3 Starting and stopping OpenCRVS.
  2. 2.
    Open a new Terminal window when OpenCRVS Core is running and cd inside your country configuration repo directory. E.G: cd opencrvs-farajaland
  3. 3.
    Ensure that node_modules are installed by running yarn --force
  4. 4.
    Run this command to create new factory reset zips for your future use. yarn db:backup:create --path_to_core=<your local path to the opencrvs-core directory> When this command completes you will notice new zipped .gz files in your country configuration folder here.
  5. 5.
    Commit and push everything up to your repo on Git to save this backup installation.
Note: Our Github actions will automatically restore from these backups in the server deployment commands in OpenCRVS Core. This process is explained in Step 3.3.6 Deploy.
Note: Running the following 2 commands in sequence in the country configuration repo alongside a running OpenCRVS Core instance at any time, will clear out all your databases from whatever state they are in and restore from these backups. So these are destructive actions. Be aware.
yarn db:clear:all --path_to_core=<your local path to the opencrvs-core directory>
yarn db:backup:restore --path_to_core=<your local path to the opencrvs-core directory>
It is also possible to clear and restore a server to factory defaults using similar commands. SSH into the server and follow these destructive actions. Be aware.