-
Notifications
You must be signed in to change notification settings - Fork 254
/
Copy pathall_install.sh
executable file
·101 lines (97 loc) · 2.39 KB
/
all_install.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
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
#!/bin/bash
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
tsspath="/opt/tensuns"
uuid=`uuidgen`
adminpwd=`uuidgen|awk -F- '{print $1}'`
mkdir -p $tsspath/consul/config
cat <<EOF > $tsspath/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 $tsspath/consul/config
cat <<EOF > $tsspath/docker-compose.yaml
version: '3.6'
services:
consul:
image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/consul:latest
container_name: consul
hostname: consul
restart: always
ports:
- "8500:8500"
volumes:
- $tsspath/consul/data:/consul/data
- $tsspath/consul/config:/consul/config
- /usr/share/zoneinfo/PRC:/etc/localtime
command: "agent"
networks:
- TenSunS
flask-consul:
image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/flask-consul:latest
container_name: flask-consul
hostname: flask-consul
restart: always
volumes:
- /usr/share/zoneinfo/PRC:/etc/localtime
environment:
consul_token: $uuid
consul_url: http://consul:8500/v1
admin_passwd: $adminpwd
log_level: INFO
depends_on:
- consul
networks:
- TenSunS
nginx-consul:
image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/nginx-consul:latest
container_name: nginx-consul
hostname: nginx-consul
restart: always
ports:
- "1026:1026"
volumes:
- /usr/share/zoneinfo/PRC:/etc/localtime
depends_on:
- flask-consul
networks:
- TenSunS
networks:
TenSunS:
name: TenSunS
driver: bridge
ipam:
driver: default
EOF
echo -e "\n\033[31;1m正在启动后羿运维平台...\033[0m"
cd $tsspath && docker-compose up -d
echo -e "\n后羿运维平台默认的admin密码是:\033[31;1m$adminpwd\033[0m\n修改密码请编辑 $tsspath/docker-compose.yaml 查找并修改变量 admin_passwd 的值\n"
echo -e "请使用浏览器访问 http://{你的IP}:1026 并登录使用\n"
echo -e "\033[31;1mhttp://`ip route get 1.2.3.4 | awk '{print $NF}'|head -1`:1026\033[0m\n"