-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
104 lines (98 loc) · 2.48 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
services:
caddy:
image: caddy:2.8.4
container_name: caddy
ports:
- "8080:80"
- "8443:443"
- "127.0.0.1:2019:2019" # metrics at /metrics
volumes:
- ./services/caddy/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
networks:
- vpcbr
environment:
- DOMAIN_NAME=api.example.com
- CADDY_LOG_LEVEL=debug
cap_add:
- NET_BIND_SERVICE
krakend:
image: devopsfaith/krakend:2.8-watch
container_name: krakend
command: ["run", "-c", "/etc/krakend/krakend.json"]
# ports:
# - "8080:8080"
volumes:
- "./services/krakend/krakend.json:/etc/krakend/krakend.json"
networks:
- vpcbr
depends_on:
ping-service:
condition: service_started
consul:
condition: service_started
dns:
- "192.0.2.10" # Specify Consul's DNS IP here
ping-service:
build:
context: ./app
dockerfile: Dockerfile
ports:
- "18080"
deploy:
replicas: 1
restart_policy:
condition: on-failure # Optionally specify restart policy
resources:
limits:
cpus: "0.25" # Limit CPU usage
memory: "128M" # Limit memory usage
reservations:
cpus: "0.1" # Reserve CPU for the service
memory: "64M" # Reserve memory for the service
environment:
- CONSUL_HTTP_ADDR=http://192.0.2.10:8500
- SERVICE_NAME=ping-service
- SERVICE_PORT=18080
networks:
- vpcbr
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:18080/ping"]
interval: 30s
retries: 3
start_period: 30s
timeout: 10s
labels:
- "consul.service.name=ping-service"
- "consul.service.checks=ping-service-health"
depends_on:
consul:
condition: service_started
consul:
image: hashicorp/consul:1.20
container_name: consul
restart: always
ports:
- '8500:8500'
- '8600:53/tcp'
- '8600:53/udp'
volumes:
- ./services/consul/consul-config:/consul/config
- ./services/consul/consul.hcl:/consul/config/consul.hcl
command: agent -server -bootstrap -ui -client=0.0.0.0 -config-dir=/consul/config
networks:
vpcbr:
ipv4_address: 192.0.2.10
# environment:
# - CONSUL_BIND_INTERFACE=eth0
networks:
vpcbr:
driver: bridge
ipam:
config:
- subnet: 192.0.2.0/24
volumes:
caddy_data:
caddy_config: