How to Install DIVOC

Assumptions

  • Use a Debian-based Linux distribution (preferably Ubuntu)

  • Experience in running simple shell and bash commands

Pre-requisites

  • Debian-based OS (Ubuntu)

  • sshpass

  • Ansible

  • GIT

  • kubectl

  • List of servers and ability to access them using key-based authentication

  • Server map to list servers against software

  • Access to the DIVOC installer repository

  • Access to the implementation-specific DIVOC code

Suggested servers for HA setup

The sizing and count of the servers can change based on the load requirements. However, for a truly HA setup, the following are the minimum requirements:

Postgres and etcd

3 servers for HA setup: one master and 2 replicas. The etcd cluster can also be set up on the same servers.

Kubernetes

6 servers: 3 for control plane (or master node can be relatively smaller sized instances) and 3 worker nodes (for deploying the application).

Kafka and Zookeeper

3 servers containing both Zookeeper and Kafka (Ideally Zookeeper and Kafka need to be installed on separate servers but we should be fine to install both on the same machine).

Redis

3 servers

Elasticsearch

3 servers

Docker-registry

1 server

Overview

There are three scripts that need to be run to complete the DIVOC installation process:

  1. Installing the prerequisites and setting various hardware clusters as detailed above.

  2. Building the pushing the docker images to the appropriate registry.

  3. Deploying code from the registry into Kubernetes cluster.

Installation dependencies

  1. Clone the repository available at https://github.com/egovernments/divoc-installer.

  2. Create an inventory file from the sample inventory file located at https://github.com/egovernments/divoc-installer/blob/master/inventory.example.ini.

  3. Add the inventory details as per the comments present in the file.

  4. Run the install.sh present within the divoc-installer with the elevated privileges (we can also use nohup for running in the background):

sudo sh install.sh -i <path to inventory file>

  • It will install the dependencies like python3, ansible, etc.

  • It will install the applications and configure them on the servers mentioned in the inventory file.

Build Docker images

  • Run the build.sh file with elevated privileges.

sudo sh build.sh -d <IP Address of Docker Registry> -r <GIT REPO URL>

Install DIVOC application

  1. The sample default Kubernetes deployment files are available at https://github.com/egovernments/divoc-installer/tree/master/kube-deployment-config-example.

  2. Make a copy of the folder and change the internal script files to have the following configurations. It is recommended that you maintain your own configuration in a separate Github repository so that you have version control and backup (you require only the example folder, not the full repository).

a. Within the divoc-installer director, open the divoc-config.yaml file present within the deployment configuration directory and make the following changes:

- DB_HOST

- DB_USER

- DB_PASS

- DB_PORT

- KAFKA_BOOTSTRAP_SERVERS

- REDIS_URL

- CLICKHOUSE_URL

- AUTH_PRIVATE_KEY

- AUTH_PUBLIC_KEY

- CERTIFICATE_NAMESPACE

- CERTIFICATE_NAMESPACE_V2

- CERTIFICATE_CONTROLLER_ID

- CERTIFICATE_PUBKEY_ID

- CERTIFICATE_DID

- CERTIFICATE_ISSUER

- CERTIFICATE_BASE_URL

- CERTIFICATE_FEEDBACK_BASE_URL

- CERTIFICATE_INFO_BASE_URL

- CERTIFICATE_PUBLIC_KEY

- CERTIFICATE_PRIVATE_KEY

- CITIZEN_PORTAL_URL

b. Modify registry-deployment.yaml to change the following:

- connectionInfo_password

- connectionInfo_uri

- connectionInfo_username

- elastic_search_enabled

- registry_base_apis_enable

- taskExecutor_index_queueCapacity

- auditTaskExecutor_queueCapacity

- Signature_enabled

c. Modify keycloak-deployment.yaml to add the following information:

- DB_ADDR

- DB_DATABASE

- DB_PASSWORD

- DB_PORT

- DB_USER

- DB_VENDOR

- KEYCLOAK_USER

- KEYCLOAK_PASSWORD

- ENABLE_OTP_MESSAGE

- KAFKA_BOOTSTRAP_SERVERS

3. Run the deploy script to deploy the application on Kubernetes.

sudo sh deploy.sh -i <path to inventory file> -p <Directory containing Kubernetes Config files> -d <Private Docker Registry IP> -k <Kube Master Node IP> -s <Key file to access Kube Master>

Post installation

Create indexes on database tables

The indexes for efficient querying of the database tables do not get automatically created and hence need to be created manually. Execute registry_index.sql is present within the DIVOC codebase on the database. A restart of the registry service is required for this change to reflect.

Note: Database tables are only created when the first API request is received.

Last updated