108 lines
2.3 KiB
YAML
108 lines
2.3 KiB
YAML
name: distsys-seminar7
|
|
|
|
x-lab: &lab
|
|
image: distsys-seminar7-tools:local
|
|
build: .
|
|
volumes:
|
|
- .:/lab:ro
|
|
- lab-work:/work
|
|
working_dir: /lab
|
|
init: true
|
|
|
|
services:
|
|
tools:
|
|
<<: *lab
|
|
profiles: [tools]
|
|
consul:
|
|
image: hashicorp/consul:1.21.5
|
|
command: agent -dev -client=0.0.0.0 -log-level=warn
|
|
ports:
|
|
- "127.0.0.1:18500:8500"
|
|
healthcheck:
|
|
test: ["CMD", "consul", "members"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
app-a:
|
|
<<: *lab
|
|
command: python3 consul/app.py
|
|
environment:
|
|
INSTANCE_ID: app-a
|
|
CONSUL_URL: http://consul:8500
|
|
depends_on:
|
|
consul:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
app-b:
|
|
<<: *lab
|
|
command: python3 consul/app.py
|
|
environment:
|
|
INSTANCE_ID: app-b
|
|
CONSUL_URL: http://consul:8500
|
|
depends_on:
|
|
consul:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
auth:
|
|
<<: *lab
|
|
command: python3 dns/server.py auth
|
|
networks:
|
|
default:
|
|
aliases: [ns.lab.test]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "dig @127.0.0.1 orders.lab.test A +short | grep -q 192.0.2."]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
resolver:
|
|
<<: *lab
|
|
command: python3 dns/server.py resolver
|
|
depends_on:
|
|
auth:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "rndc -c /tmp/dns-lab/rndc.conf status"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
|
|
tld-dns:
|
|
<<: *lab
|
|
command: python3 dns/server.py tld
|
|
networks:
|
|
default:
|
|
aliases: [ns.test]
|
|
depends_on:
|
|
auth:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "dig @127.0.0.1 test SOA +short | grep -q hostmaster"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
root-dns:
|
|
<<: *lab
|
|
command: python3 dns/server.py root
|
|
networks:
|
|
default:
|
|
aliases: [ns.root]
|
|
depends_on:
|
|
tld-dns:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "dig @127.0.0.1 . SOA +short | grep -q hostmaster"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 20
|
|
|
|
volumes:
|
|
lab-work:
|