On an ubuntu machine or mac, install the following:
- docker
- docker compose
Install docker: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
Install docker compose: https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04
Clone control tower locally: https://github.com/control-tower/control-tower
Rename dev.env.sample to dev.env
Start control tower: ./controlTower.sh develop
Clone the project: https://github.com/Vizzuality/node-skeleton
Add your internal IP to /etc/hosts with the alias mymachine
Try and start the example microservice: ./nodeSkeleton.sh develop
If this fails, edit docker-compose-develop.yml
in the node-skeleton repo, replacing mymachine
with your internal IP
Then start the microservice with ./nodeSkeleton.sh develop
Make a test request to the control-tower:
curl localhost:9000
Response: {"errors":[{"status":404,"detail":"Endpoint not found"}]}
In the node-skeleton repo, look at app/microservice/register.json to understand what endpoints are being made available. Looks like /api/v1/node-skeleton/hi should expose a route over GET.
Look at docker-compose-develop.yml to find the proper port with which to talk to the microservice directly, in this case looks like 3005. Test this endpoint:
curl localhost:3005/api/v1/node-skeleton/hi
Response: {"hi": "Ra"}
Now try communicating with this service, but through the main gateway. Looking at the register.json file, it looks like the endpoint available in the gateway will be /node-skeleton/hi. Try it through the main gateway:
curl localhost:9000/node-skeleton/hi
Response: {"hi": "Ra"}
Great! We now have a working microservice and gateway deployed locally! Time to develop!