Since OpenLMIS system runs in dockerized environment, using services that are already compiled, and published as images, there's no live access to source code of a service. This means we can't simply modify and debug a service in this environment. However, it is possible to attach service that is running locally to a running OpenLMIS system. This means we can run a service (or several services) locally in development mode (with ability to quickly rebuild and debug), and have OpenLMIS redirect incoming requests to this service.
There are few short steps to take in order to debug a service (in this case, we'll debug requisition):
1. In openlmis-blue's compose file, comment requisition service section.
2. Add network_mode: "host" parameter to nginx container in openlmis-blue compose file.
3. Run openlmis-blue as normal.
4. Enter requisition's folder, and edit your .env file to have it's VIRTUAL_HOST and CONSUL_HOST values the same as in openlmis-blue.
5. Run service as usual with docker-compose run --service-ports requisition.
6. Run npm install.
7. Run gradle consulRegistration.
8. Run gradle bootRun --debug-jvm
9. Attach debugger in your IDE.
* You may possibly approach some problems with installing npm dependencies - if running step 7 causes an error, please copy all references from consul/package.json to package.json at root and re-run npm install.