-
Notifications
You must be signed in to change notification settings - Fork 254
/
Copy pathconsul_install_only.sh
executable file
·64 lines (62 loc) · 1.18 KB
/
consul_install_only.sh
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
#!/bin/bash
uuid=`uuidgen`
mkdir -p /opt/consul/config
cat <<EOF > /opt/consul/config/consul.hcl
log_level = "error"
data_dir = "/consul/data"
client_addr = "0.0.0.0"
ui_config{
enabled = true
}
ports = {
grpc = -1
https = -1
dns = -1
grpc_tls = -1
serf_wan = -1
}
peering {
enabled = false
}
connect {
enabled = false
}
server = true
bootstrap_expect=1
acl = {
enabled = true
default_policy = "deny"
enable_token_persistence = true
tokens {
initial_management = "$uuid"
agent = "$uuid"
}
}
EOF
chmod 777 -R /opt/consul/config
cat <<EOF > /opt/consul/docker-compose.yaml
version: '3.6'
services:
consul:
image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/consul:latest
hostname: consul
container_name: consul
restart: always
ports:
- "8500:8500"
volumes:
- /opt/consul/data:/consul/data
- /opt/consul/config:/consul/config
- /usr/share/zoneinfo/PRC:/etc/localtime
command: "agent"
networks:
- TenSunS
networks:
TenSunS:
name: TenSunS
driver: bridge
ipam:
driver: default
EOF
echo "请进入/opt/consul目录执行 docker-compose up -d 启动consul"
echo "consul的管理员token是: $uuid"