Skip to content

Commit

Permalink
Docker + Consul + Nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-exe committed Apr 23, 2024
1 parent 2edb1dc commit 8147beb
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clients/consul01/services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"service": {
"id": "nginx",
"name": "nginx",
"tags": ["web"],
"port": 80
}
}
15 changes: 15 additions & 0 deletions clients/consul02/services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"service": {
"id": "nginx2",
"name": "nginx",
"tags": ["web"],
"port": 80,
"check": {
"id": "nginx",
"name": "HTTP 80",
"http": "http/localhost",
"interval": "10s",
"timeout": "1s"
}
}
}
46 changes: 46 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3'

services:
consulserver01:
image: consul:1.10
container_name: consulserver01
hostname: consulserver01
command: ['tail', '-f', '/dev/null']
volumes:
- ./servers/server01:/etc/consul.d
ports:
- "8500:8500"

consulserver02:
image: consul:1.10
container_name: consulserver02
hostname: consulserver02
command: ['tail', '-f', '/dev/null']
volumes:
- ./servers/server02:/etc/consul.d


consulserver03:
image: consul:1.10
container_name: consulserver03
hostname: consulserver03
command: ['tail', '-f', '/dev/null']
volumes:
- ./servers/server03:/etc/consul.d


# consulclient01:
# image: consul:1.10
# container_name: consulclient01
# hostname: consulclient01
# command: ['tail', '-f', '/dev/null']
# volumes:
# - ./clients/consul01:/etc/consul.d

# consulclient02:
# image: consul:1.10
# container_name: consulclient02
# hostname: consulclient02
# command: ['tail', '-f', '/dev/null']
# volumes:
# - ./clients/consul02:/etc/consul.d
12 changes: 12 additions & 0 deletions servers/server01/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"server":true,
"bind_addr": "172.19.0.3",
"bootstrap_expect": 3,
"data_dir": "/tmp",
"node_name": "consulserver01",
"encrypt":"y2E17bI29PG0X2bOhjRjyxE30ZpoiRjvV3J6zhOmjRM=",
"client_addr":"0.0.0.0",
"ui_config":{
"enabled":true
}
}
10 changes: 10 additions & 0 deletions servers/server02/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"server":true,
"bind_addr": "172.19.0.4",
"bootstrap_expect": 3,
"data_dir": "/tmp",
"retry_join": ["172.19.0.5", "172.19.0.3"],
"node_name": "consulserver02",
"encrypt":"y2E17bI29PG0X2bOhjRjyxE30ZpoiRjvV3J6zhOmjRM="

}
10 changes: 10 additions & 0 deletions servers/server03/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"server":true,
"bind_addr": "172.19.0.5",
"bootstrap_expect": 3,
"data_dir": "/tmp",
"retry_join": ["172.19.0.3", "172.19.0.4"],
"node_name": "consulserver03",
"encrypt":"y2E17bI29PG0X2bOhjRjyxE30ZpoiRjvV3J6zhOmjRM="

}

0 comments on commit 8147beb

Please sign in to comment.