The .NET coffeeshop application runs on Nomad and Consul Connect
No. | Service Name | URI |
1 | product-service | http://localhost:5001 and http://localhost:15001 |
2 | counter-service | http://localhost:5002 |
3 | barista-service | http://localhost:5003 |
4 | kitchen-service | http://localhost:5004 |
5 | reverse-proxy (local development only) | http://localhost:5000 |
6 | signalr-web (local development only) | http://localhost:3000 |
7 | datagen-app (local development only) |
Control plane UI:
- Nomad Dashboard: http://localhost:4646
- Consul UI: http://localhost:8500
- Traefik Dashboard: http://localhost:8080
- RabbitMQ UI: http://localhost:15672
Using client.http to explore the application!
F1 in vscode and choose Remote-Containers: Open Folder in Container...
, then waiting until it build sucessful
# check linux version
> cat /etc/os-release
# build all images of application
> docker compose build
Open a new tab
> cd local/
$ sudo chmod +x core-libs.sh start.sh
$ sudo ./core-libs.sh
# nomad cannot run on wsl2 image, then we need to work-around
$ sudo mkdir -p /lib/modules/$(uname -r)/
> echo '_/bridge.ko' | sudo tee -a /lib/modules/$(uname -r)/modules.builtin
# Start nomad and consul
> ./start.sh
Open another new tab
> cd nomad/jobs
> nomad job run traefik.nomad.hcl
> nomad job run postgresdb.nomad.hcl
> nomad job run rabbitmq.nomad.hcl
> nomad job run product-api.nomad.hcl
> nomad job run counter-api.nomad.hcl
> nomad job run barista-api.nomad.hcl
> nomad job run kitchen-api.nomad.hcl
Finally, you can play around using client.http to explore the application!
> nomad job stop kitchen-api.nomad.hcl
> nomad job stop barista-api.nomad.hcl
> nomad job stop counter-api.nomad.hcl
> nomad job stop product-api.nomad.hcl
> nomad job stop rabbitmq.nomad.hcl
> nomad job stop postgresdb.nomad.hcl
> nomad job stop traefik.nomad.hcl
error: elasticsearch_1 | max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Jump into wsl2, then run command below
$ sudo sysctl -w vm.max_map_count=262144
Now, we can run docker-compose up
again.
- Traefix dashboad: https://traefik.io/blog/traefik-proxy-fully-integrates-with-hashicorp-nomad/
- Rewrite URL on Nomad: https://doc.traefik.io/traefik/migration/v1-to-v2/#strip-and-rewrite-path-prefixes