Skip to content

Commit 625a8a3

Browse files
committed
add hcdiag project
1 parent e27d28d commit 625a8a3

File tree

6 files changed

+152
-0
lines changed

6 files changed

+152
-0
lines changed

datacenter-deploy-hcdiag/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Overview
2+
3+
Deploy a Consul datacenter containing agents with a preconfigured DNS service and health check.
4+
5+
## Prerequisites
6+
7+
- Docker
8+
- Docker Compose
9+
10+
## Deployment procedure
11+
12+
1. Clone [learn-consul-docker](https://github.com/hashicorp/learn-consul-docker) repository.
13+
2. Navigate to this directory.
14+
3. `docker-compose up -d`
15+
16+
## Testing procedure
17+
18+
1. Open an interactive shell to a Consul server:
19+
1. `docker exec -it consul-server1 /bin/sh`
20+
2. Update package sources;
21+
1. `apk update`
22+
3. Add curl and unzup packages:
23+
1. `apk add curl unzip`
24+
4. Download hcdiag:
25+
1. `curl --silent --remote-name https://releases.hashicorp.com/hcdiag/0.1.1/hcdiag_0.1.1_linux_amd64.zip`
26+
5. Unzip hcdiag and remove the archive:
27+
1. `unzip hcdiag_0.1.1_linux_amd64.zip && rm -f hcdiag_0.1.1_linux_amd64.zip`
28+
6. Move the hcdiag executable to your sbin directory:
29+
1. `mv hcdiag sbin/`
30+
7. Run hcdiag for consul:
31+
1. `hcdiag -consul`
32+
2. Let it run until completion
33+
8. Look for the support package
34+
1. `ls -l *.gz`
35+
9. Unpack the archive:
36+
1. `tar zxvf support-2021-12-10T20:47:55Z.tar.gz`
37+
10. Change directory into the unpacked folder:
38+
1. `cd temp495511880/`
39+
11. Examine the contents
40+
13. Exit the terminal: `exit`
41+
42+
## Additional information
43+
44+
- [https://github.com/hashicorp/hcdiag](https://github.com/hashicorp/hcdiag)
45+
- [https://learn.hashicorp.com/tutorials/consul/troubleshooting](https://learn.hashicorp.com/tutorials/consul/troubleshooting)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"node_name": "consul-client1",
3+
"datacenter": "dc1",
4+
"data_dir": "/consul/data",
5+
"retry_join":[
6+
"consul-server1",
7+
"consul-server2",
8+
"consul-server3"
9+
]
10+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: '3.7'
2+
3+
services:
4+
5+
consul-server1:
6+
image: hashicorp/consul:1.11.0-beta3
7+
container_name: consul-server1
8+
restart: always
9+
volumes:
10+
- ./server1.json:/consul/config/server1.json:ro
11+
networks:
12+
- consul
13+
ports:
14+
- "8500:8500"
15+
- "8600:8600/tcp"
16+
- "8600:8600/udp"
17+
command: "agent -bootstrap-expect=3"
18+
19+
consul-server2:
20+
image: hashicorp/consul:1.11.0-beta3
21+
container_name: consul-server2
22+
restart: always
23+
volumes:
24+
- ./server2.json:/consul/config/server2.json:ro
25+
networks:
26+
- consul
27+
command: "agent -bootstrap-expect=3"
28+
29+
consul-server3:
30+
image: hashicorp/consul:1.11.0-beta3
31+
container_name: consul-server3
32+
restart: always
33+
volumes:
34+
- ./server3.json:/consul/config/server3.json:ro
35+
networks:
36+
- consul
37+
command: "agent -bootstrap-expect=3"
38+
39+
consul-client1:
40+
image: hashicorp/consul:1.11.0-beta3
41+
container_name: consul-client1
42+
restart: always
43+
volumes:
44+
- ./client1.json:/consul/config/client1.json:ro
45+
networks:
46+
- consul
47+
command: "agent"
48+
49+
networks:
50+
consul:
51+
driver: bridge
52+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"node_name": "consul-server1",
3+
"server": true,
4+
"ui_config": {
5+
"enabled" : true
6+
},
7+
"data_dir": "/consul/data",
8+
"addresses": {
9+
"http" : "0.0.0.0"
10+
},
11+
"retry_join":[
12+
"consul-server2",
13+
"consul-server3"
14+
]
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"node_name": "consul-server2",
3+
"server": true,
4+
"ui_config": {
5+
"enabled" : true
6+
},
7+
"data_dir": "/consul/data",
8+
"addresses": {
9+
"http" : "0.0.0.0"
10+
},
11+
"retry_join":[
12+
"consul-server1",
13+
"consul-server3"
14+
]
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"node_name": "consul-server3",
3+
"server": true,
4+
"ui_config": {
5+
"enabled" : true
6+
},
7+
"data_dir": "/consul/data",
8+
"addresses": {
9+
"http" : "0.0.0.0"
10+
},
11+
"retry_join":[
12+
"consul-server1",
13+
"consul-server2"
14+
]
15+
}

0 commit comments

Comments
 (0)