Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.48 KB

ASSIGNMENT.md

File metadata and controls

45 lines (31 loc) · 1.48 KB

Assignment 1

  1. Start a consul process as a server on the master node.

  2. Start a consul process as an agent on both app1 and app2.

  3. Add a service with the name "producer" to /etc/consul.d on app1 and app2 and do a consul reload. The Consul service guide

  4. Use the HTTP API and check that you got a result for the queried service

curl http://localhost:8500/v1/catalog/service/<service name>
  1. Do the same with the DNS API
dig @127.0.0.1 -p 8600 <service name>.service.consul

Assignment 2

The consumer app currently integrates with the producer on a hardcoded IP and port.

THIS IS NOT OK!!!

Your job is to decouple the consumer from that producer instance by introducing a whiff of service discovery. How you do it is up to you:

  • By using consuls DNS API (NB: SRV records)
  • By using consuls HTTP API
  • Or some other way, if you've got any good ideas

Assignment 3

Extend the startup script of the application to use the maintance API to tell Consul the application is available when it starts, and mark it as unavailable when it exits.

Assignment 4

If you've got the time, try to integrate consul-template with a loadbalancer (NginX/HAProxy/Apache)

E.g. have an HAProxy instance loadbalance requests to a dynamic set of producer apps.