Local Development
In this chapter we will look at what is needed to develop existing services or create new ones locally on your own development machine. This guide is for the developers who want to actively contribute to the implementation of the system and assumes that the respective components must be run locally without Docker. Read this if you want to improve one of the existing components or add a new one.
tip
Make sure to read the prerequisites to know what do you need to be able to set up DIVA on your machine
DIVA consist of many components, each with it own requirements. All components are provided with corresponding READMEs where you can find detailed descriptions of the requirements and execution instructions.
In general, a common routine will look like this: check out the necessary repository, change to the right folder, install dependencies and start the component. While there are system components that can run completely independently, most of our core services rely on Kafka or databases. For example Web client relies on API Gateway, and the API Gateway needs other services to be running. In order to be able to work properly with the client, other services have to operate as well. To avoid this problem, the necessary components such as Kafka, databases or other service can be run directly with Docker Compose. Therefore, we propose the following workflow for local development:
We recommend you to specify a host name forwarding for the diva system. The name of the diva system is specified in the
.env
file underDIVA_HOST
:127.0.0.1 localhost diva
Spin up the system with Docker. Read our guide for Docker deployment for further information
cd docker
./up_core.shIt is not required to boot the complete system. If you are already familiar with the DIVA architecture, you can start only these components that are required by corresponding dependent component
Stop the component you want to work on. For example, if you want to develop on
Entity Management
, stop the corresponding containercd docker
docker-compose stop entity-managementNow you can execute the service locally
cd code/services/entity-management
npm i
npm run dev
Elasticsearch Warning
Elasticsearch uses a mmapfs directory by default to store its indices. The default operating system limits on mmap counts is likely to be too low, which may result in out of memory exceptions. Please configure your machine like described here
This is the general procedure, the details in the steps may vary depending on the specific component. From this point on, you should learn more about DIVA architecture, know what to consider when developing services and other components, and how to containerize the software.