# Setting up DIVOC development environment

## Steps

**Step 1:** Install prerequisites and dependencies

* Update package list - sudo apt-get update.
* Install docker - sudo apt install docker.io.
* Install docker-compose - sudo curl -L "<https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname> -s)-$(uname -m)" -o /usr/local/bin/docker-compose.
* Install git - sudo apt install git.
* For additional details on Docker, you can find the instructions[ here](https://docs.docker.com/compose/install/).
* You can find the basic Docker Compose commands below: (DIVOC repo has [docker-compose-vc-issuance.yml](https://github.com/egovernments/DIVOC/blob/main/docker-compose-vc-issuance.yml) file which lists all the services required for VC Issuance)

&#x20;     \- Starting services[ docker-compose -f docker-compose-vc-issuance.yml up](https://docs.docker.com/compose/reference/up/).

&#x20;     \- Restarting services[ docker-compose](https://docs.docker.com/compose/reference/restart/)[ -f docker-compose-vc-issuance.yml ](https://docs.docker.com/compose/reference/up/)[restart](https://docs.docker.com/compose/reference/restart/).

&#x20;     \- Checking the status of services[ docker-compose](https://docs.docker.com/compose/reference/ps/)[ -f docker-compose-vc-issuance.yml ](https://docs.docker.com/compose/reference/up/)[ps](https://docs.docker.com/compose/reference/ps/).

&#x20;     \- Monitoring service logs[ docker-compose](https://docs.docker.com/compose/reference/logs/)[ -f docker-compose-vc-issuance.yml ](https://docs.docker.com/compose/reference/up/)[logs](https://docs.docker.com/compose/reference/logs/).

**Step 2:** Install DIVOC

* Clone DIVOC repository onto your local machine - git clone[ https://github.com/egovernments/DIVOC](https://github.com/egovernments/DIVOC).
* Navigate to the DIVOC directory - cd DIVOC.
* Configure DIVOC: Configurations are provided as environment variables and a default set of configurations is provided in the ‘.env.example’ file. Make a copy of this file named ‘.env’ that docker will pick up. Edit these configurations as per your need.

'cp .env.example .env'

&#x20;**Step 3:** Start keycloak and kafka services in the detached mode.

```
docker-compose -f docker-compose-vc-issuance.yml up -d kafka keycloak
```

* Verify the state of kafka and keycloak containers. If they are up and running, Other services can be started now in detached mode.

```
docker-compose -f docker-compose-vc-issuance.yml up -d
```

* [Verify the state of containers](https://github.com/egovernments/DIVOC/blob/main/docs/developer-docs/index.md#docker-compose-ps). All containers should be up.
* Some services might fail to start because the dependent service may not be ready yet.[ Restarting the failed service](https://github.com/egovernments/DIVOC/blob/main/docs/developer-docs/index.md#docker-compose-restart) should start it successfully in this case.
* On Mac/Windows, services may crash with exit code:137, if sufficient memory is not set for docker. This can be changed in the Docker desktop preferences, resources tab, as shown[ here](https://docs.docker.com/docker-for-mac/#resources).

**Step 4:** To build docker images locally after making changes, run following commands make docker (Available within the individual micro services folder and at parent level folder as well).

```
docker-compose -f docker-compose-vc-issuance.yml up -d
```

**Step 5:** Explore DIVOC

* The following are the routes to access local apps. The remaining routes can be found in nginx/nginx.conf.

|            Address            |    Application   |
| :---------------------------: | :--------------: |
|           localhost           |   tenant-portal  |
| localhost/vc-verification-app | Verification app |

[![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)](http://creativecommons.org/licenses/by/4.0/)*All content on this page by* [*eGov Foundation*](https://egov.org.in/) *is licensed under a* [*Creative Commons Attribution 4.0 International License*](http://creativecommons.org/licenses/by/4.0/)*.*
