3.3.2 Provision environment
Last updated
Last updated
In OpenCRVS v1.3.1 hotfix scheduled for November 6th 2023, we will be releaseing a Github Action to automate this process. :-)
is required to be installed on your local development machine in order to provision the server with required software. Installation instructions are . Ensure that you have ssh access using the root user to all the servers that you are trying to configure.
In OpenCRVS v1.3, all server setup configuration and deployment files exist in the country configuration repository - e.g. opencrvs-countryconfig. This allows you to completely customise them for your needs without needing to fork opencrvs-core
Create an account on as Ansible and Github Actions will require your Dockerhub username and password in order to login.\
Referring to the country configuration repository e.g. opencrvs-countryconfig, duplicate the example-X.ini inventory_file of choice where X is relative to the number of servers. These can be found in the directory, depending upon whether or not you are deploying to 1, 3 or 5 servers. For example: If you are only deploying to 1 server, you need to make a copy of the inventory_file: file to run with the Ansible playbook_file: explained below. If you are deploying to a standard production deployment of 3 servers, you need to make a copy of the inventory_file: file to run with the Ansible playbook_file: explained below. If you are deploying to 5 servers, you need to make a copy of the inventory_file: file to run with the Ansible playbook_file: explained below.
Deploying to only 1 server is not recommended and is CONSIDERABLY RISKY for a production installation. YOU COULD LOSE CITIZEN DATA IF THE SERVER CRASHES. Docker Swarm's power is that it can load balance between servers in a cluster. If one of the servers goes down, the others will still be operational.
You will be required to uncomment some lines to enter the IP addresses and hostnames, e.g.:\
becomes:
... and:
becomes:
4. Using a strong password generator, such as you should create and safely store the following parameters.:
mongodb_admin_username
mongodb_admin_password
elasticsearch_superuser_password
5. You are now ready to call the Ansible command passing these required parameters and additionally some optional parameters.
Required parameters:
dockerhub_username
dockerhub_password
mongodb_admin_username
mongodb_admin_password
elasticsearch_superuser_password
disk_encryption_key
encrypted_disk_size
Optional parameters:
For the optional automated daily external data backup to another server, these parameters must be prepared:
external_backup_server_ip
external_backup_server_user
external_backup_server_ssh_port
external_backup_server_remote_directory
You must ensure that you are in your local computer and that both your local directories opencrvs-core and opencrvs-<your country> are on the same release version v* or master branch before running Ansible. Ansible is run from your local machine and it connects to your server using SSH and automatically runs commands on it.
Ansible playbooks are run like this from your local machine:
Now you can run the playbook like this, substituting the parameters as required:
Or with all the possible optional props:
We suggest that your passwords are unguessable alphanumeric version 1 or 4 . If you use special characters in the passwords, they will need to be escaped.
The passwords and secret keys that you make in this section are critically important to be saved and stored securely. They are the master keys to access your citizen data! Consider Password Management Policies!! Tools such as can help you here. You can customise our playbook to store the keys in a .
disk_encryption_key (The Disk encryption secret, encrypting your citizen data at rest.)
You must store these keys safely for future use, as you will need the details in the process.
PRODUCTION NOTE: In production, we advise that you provision a and amend the country configuration , , and scripts at the linked locations in order to change the approach to storing and accessing the disk_encryption_key and MongoDB and Elasticsearch passwords. Secure secret storage is currently outside the scope of OpenCRVS.
MOSIP's documentation on the requirements of a is useful reading.
If you are on the root directory of the country configuration repository - e.g. opencrvs-countryconfig, navigate to the folder:
Once this command is finished the servers are prepared for an OpenCRVS deployment. You can read more about how the external backups work in the section