Skip to content

Commit 75e86d0

Browse files
committed
release: v2.2.2
1 parent 92ec66b commit 75e86d0

File tree

376 files changed

+20669
-7451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+20669
-7451
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpsAny开源运维平台
1+
# OpsAny运维PAAS平台
22

33
OpsAny-PaaS是基于腾讯开源[bk-PaaS](https://github.com/Tencent/bk-PaaS) 二次开发的运维开发平台,让运维开发者可以方便快捷地创建、开发、部署和管理运维SaaS应用。**你可以把PaaS看作是Spring CLoud这样的开发框架**,它提供了应用引擎、前后台开发框架、API网关、统一登录、公共组件等模块,帮助用户快速、低成本、免运维地构建支撑工具和运营系统(统称为SaaS应用),它为一个SaaS应用从创建到部署,再到后续的维护管理提供了完善的自动化和自助化服务,从而使开发者可以集中精力关注SaaS应用的逻辑开发。
44

install/conf/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 安装配置目录
2+
3+
本目录下存放安装时的所有配置文件,安装脚本会将该目录复制到安装的目标路径后,使用sed将相关的配置项进行查找替换,然后所有OpsAny容器启动后,挂载的均为安装目录下的配置文件。

install/conf/nginx-conf.d/opsany_paas_k8s.config

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,18 @@ upstream SAAS_BASTION {
4747
upstream SAAS_DEVOPS {
4848
server 127.0.0.1:7009 max_fails=1 fail_timeout=30s;
4949
}
50-
upstream SAAS_DASHBOARD {
50+
upstream SAAS_CODE {
5151
server 127.0.0.1:7010 max_fails=1 fail_timeout=30s;
5252
}
53+
upstream SAAS_PIPELINE {
54+
server 127.0.0.1:7017 max_fails=1 fail_timeout=30s;
55+
}
56+
upstream SAAS_REPO {
57+
server 127.0.0.1:7020 max_fails=1 fail_timeout=30s;
58+
}
59+
upstream SAAS_DEPLOY {
60+
server 127.0.0.1:7018 max_fails=1 fail_timeout=30s;
61+
}
5362

5463
server {
5564
listen 80;
@@ -119,10 +128,13 @@ server {
119128
proxy_set_header X-Real-IP $remote_addr;
120129
proxy_set_header X-Scheme $scheme;
121130
proxy_set_header Host $http_host;
122-
proxy_redirect off;
131+
proxy_set_header X-Forwarded-Proto $scheme;
132+
proxy_set_header X-Forwarded-Scheme $scheme;
133+
proxy_redirect http:// $scheme://;
123134
proxy_read_timeout 600;
124135
}
125136

137+
126138
# uploads
127139
location ~ ^/uploads/(.*) {
128140
autoindex off;
@@ -282,9 +294,42 @@ server {
282294
proxy_redirect off;
283295
proxy_read_timeout 600;
284296
}
285-
# for dashboard
286-
location ~ ^/o/dashboard/ {
287-
proxy_pass http://SAAS_DASHBOARD;
297+
# for code
298+
location ~ ^/o/code/ {
299+
proxy_pass http://SAAS_CODE;
300+
proxy_pass_header Server;
301+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
302+
proxy_set_header X-Real-IP $remote_addr;
303+
proxy_set_header X-Scheme $scheme;
304+
proxy_set_header Host $http_host;
305+
proxy_redirect off;
306+
proxy_read_timeout 600;
307+
}
308+
# for pipeline
309+
location ~ ^/o/pipeline/ {
310+
proxy_pass http://SAAS_PIPELINE;
311+
proxy_pass_header Server;
312+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
313+
proxy_set_header X-Real-IP $remote_addr;
314+
proxy_set_header X-Scheme $scheme;
315+
proxy_set_header Host $http_host;
316+
proxy_redirect off;
317+
proxy_read_timeout 600;
318+
}
319+
# for repo
320+
location ~ ^/o/repo/ {
321+
proxy_pass http://SAAS_REPO;
322+
proxy_pass_header Server;
323+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
324+
proxy_set_header X-Real-IP $remote_addr;
325+
proxy_set_header X-Scheme $scheme;
326+
proxy_set_header Host $http_host;
327+
proxy_redirect off;
328+
proxy_read_timeout 600;
329+
}
330+
# for deploy
331+
location ~ ^/o/deploy/ {
332+
proxy_pass http://SAAS_DEPLOY;
288333
proxy_pass_header Server;
289334
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
290335
proxy_set_header X-Real-IP $remote_addr;

install/conf/opsany-paas/websocket/settings_production.py.websocket

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,14 @@ CHANNEL_LAYERS = {
113113
},
114114
}
115115
}
116+
117+
118+
# Elastic APM
119+
ELASTIC_APM = {
120+
'ENABLED': 'false',
121+
'SERVICE_NAME': 'opsany-paas-websocket',
122+
'SECRET_TOKEN': 'APM_SECRET_TOKEN',
123+
'SERVER_URL': 'https://APM_SERVER_HOST:8200',
124+
'VERIFY_SERVER_CERT': 'false',
125+
'ENVIRONMENT': 'prod',
126+
}

install/conf/opsany-saas/bastion/bastion-prod.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,7 @@
103103
}
104104
)
105105

106-
CHANNEL_LAYERS = {
107-
'default': {
108-
'BACKEND': 'channels_redis.core.RedisChannelLayer',
109-
'CONFIG': {
110-
'hosts': ["redis://{}:{}@{}:{}/8".format(REDIS_USERNAME, REDIS_PASSWORD, REDIS_HOST, REDIS_PORT)],
111-
"symmetric_encryption_keys": [SECRET_KEY],
112-
},
113-
}
114-
}
106+
WEBSOCKET_CHANNEL_LAYERS = ["redis://{}:{}@{}:{}/8".format(REDIS_USERNAME, REDIS_PASSWORD, REDIS_HOST, REDIS_PORT)]
115107

116108
# Elastic APM
117109
ELASTIC_APM = {

install/conf/proxy/proxy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:opsany-proxy]
2-
command=gunicorn wsgi --bind 0.0.0.0:8010 -k gevent -w 4 -n proxy --access-logfile - --error-logfile -
2+
command=gunicorn wsgi --bind 0.0.0.0:8010 -k gevent -w 3 -n proxy --access-logfile - --error-logfile -
33
directory=/opt/opsany-proxy
44
environment=DJANGO_SETTINGS_MODULE=settings,OPS_ANY_ENV="production"
55
startsecs=0

install/conf/salt/master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ default_include: master.d/*.conf
264264
# return calls made from minions to the master. If the master seems to be
265265
# running slowly, increase the number of threads. This setting can not be
266266
# set lower than 3.
267-
#worker_threads: 5
267+
worker_threads: 3
268268

269269
# Set the ZeroMQ high water marks
270270
# http://api.zeromq.org/3-2:zmq-setsockopt

install/devops-install.sh

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
#!/bin/bash
2+
#******************************************
3+
# Author: Jason Zhao
4+
# Email: zhaoshundong@opsany.com
5+
# Organization: OpsAny https://www.opsany.com/
6+
# Description: Zabbix Server Install Script
7+
#******************************************
8+
9+
# Data/Time
10+
CTIME=$(date "+%Y-%m-%d-%H-%M")
11+
12+
# Shell Envionment Variables
13+
CDIR=$(pwd)
14+
SHELL_NAME="zabbix-install.sh"
15+
SHELL_LOG="${SHELL_NAME}.log"
16+
17+
# Install Inspection
18+
if [ ! -f ./install.config ];then
19+
echo "Please Change Directory to ${INSTALL_PATH}/install"
20+
exit
21+
else
22+
grep '^[A-Z]' install.config > install.env
23+
source ./install.env && rm -f install.env
24+
fi
25+
26+
# Shell Log Record
27+
shell_log(){
28+
LOG_INFO=$1
29+
echo "----------------$CTIME ${SHELL_NAME} : ${LOG_INFO}----------------"
30+
echo "$CTIME ${SHELL_NAME} : ${LOG_INFO}" >> ${SHELL_LOG}
31+
}
32+
33+
# Check Install requirement
34+
install_init(){
35+
shell_log "=====Begin: Init======"
36+
# Configuration file write to DB
37+
pip3 install requests==2.25.1 grafana-api==1.0.3 mysql-connector==2.2.9 SQLAlchemy==1.4.22 \
38+
-i http://mirrors.aliyun.com/pypi/simple/ \
39+
--trusted-host mirrors.aliyun.com
40+
mkdir -p ${INSTALL_PATH}/{zabbix-volume/alertscripts,zabbix-volume/externalscripts,zabbix-volume/snmptraps}
41+
mkdir -p ${INSTALL_PATH}/{zabbix-mysql8-volume,conf/mysql8,logs/mysql8}
42+
/bin/cp ./conf/mysqld.cnf ${INSTALL_PATH}/conf/mysql8/mysqld.cnf
43+
}
44+
45+
# Start Zabbix
46+
zabbix_5_0_install(){
47+
shell_log "=====Start Zabbix 5.0LTS======"
48+
docker run --restart=always --name opsany-zabbix-server-st2 -t \
49+
-e DB_SERVER_HOST="${MYSQL_SERVER_IP}" \
50+
-e MYSQL_DATABASE="${ZABBIX_DB_NAME}" \
51+
-e MYSQL_USER="${ZABBIX_DB_USER}" \
52+
-e MYSQL_PASSWORD="${ZABBIX_DB_PASSWORD}" \
53+
-e MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \
54+
-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
55+
-p 10051:10051 \
56+
-v ${INSTALL_PATH}/zabbix-volume/alertscripts:/usr/lib/zabbix/alertscripts \
57+
-v ${INSTALL_PATH}/zabbix-volume/externalscripts:/usr/lib/zabbix/externalscripts \
58+
-v ${INSTALL_PATH}/zabbix-volume/snmptraps:/var/lib/zabbix/snmptraps \
59+
-v /etc/localtime:/etc/localtime:ro \
60+
-d ${PAAS_DOCKER_REG}/zabbix-server-mysql:alpine-5.0-st2
61+
62+
sleep 20
63+
# Jenkins Master
64+
docker run --restart=always --name opsany-devops-jenkins -t \
65+
-v /etc/localtime:/etc/localtime:ro \
66+
-v ${INSTALL_PATH}/jenkins-home:/var/jenkins_home \
67+
-p 8008:8080 -p 8009:5000 \
68+
-d ${PAAS_DOCKER_REG}/jenkins:2.452.2-lts
69+
}
70+
71+
zabbix_6_0_install(){
72+
73+
shell_log "=====Start mysql 8.0======"
74+
docker run -d --restart=always --name opsany-zabbix-mysql8 \
75+
-e MYSQL_ROOT_PASSWORD="$MYSQL_ROOT_PASSWORD" \
76+
-p 3307:3306 -v ${INSTALL_PATH}/zabbix-mysql8-volume:/var/lib/mysql \
77+
-v ${INSTALL_PATH}/conf/mysql8/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf \
78+
-v ${INSTALL_PATH}/logs/mysql8:/var/log/mysql \
79+
-v /etc/localtime:/etc/localtime:ro \
80+
${PAAS_DOCKER_REG}/mysql:8.0 --character-set-server=utf8 --collation-server=utf8_general_ci
81+
82+
83+
84+
shell_log "=====Start Zabbix 6.0 LTS======"
85+
docker run --restart=always --name opsany-zabbix-server-6.0 -t \
86+
-e DB_SERVER_HOST="${MYSQL_SERVER_IP}" \
87+
-e DB_SERVER_PORT="3307" \
88+
-e MYSQL_DATABASE="${ZABBIX_DB_NAME}" \
89+
-e MYSQL_USER="${ZABBIX_DB_USER}" \
90+
-e MYSQL_PASSWORD="${ZABBIX_DB_PASSWORD}" \
91+
-e MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \
92+
-p 10051:10051 \
93+
-v ${INSTALL_PATH}/zabbix-volume/alertscripts:/usr/lib/zabbix/alertscripts \
94+
-v ${INSTALL_PATH}/zabbix-volume/externalscripts:/usr/lib/zabbix/externalscripts \
95+
-v ${INSTALL_PATH}/zabbix-volume/snmptraps:/var/lib/zabbix/snmptraps \
96+
-v /etc/localtime:/etc/localtime:ro \
97+
-d ${PAAS_DOCKER_REG}/zabbix-server-mysql:6.0-centos-latest
98+
99+
100+
sleep 20
101+
102+
docker run --restart=always --name opsany-zabbix-web-6.0 -t \
103+
-e ZBX_SERVER_HOST="${MYSQL_SERVER_IP}" \
104+
-e DB_SERVER_HOST="${MYSQL_SERVER_IP}" \
105+
-e DB_SERVER_PORT="3307" \
106+
-e MYSQL_DATABASE="${ZABBIX_DB_NAME}" \
107+
-e MYSQL_USER="${ZABBIX_DB_USER}" \
108+
-e MYSQL_PASSWORD="${ZABBIX_DB_PASSWORD}" \
109+
-e MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \
110+
-v /etc/localtime:/etc/localtime:ro \
111+
-p 8006:8080 \
112+
-d ${PAAS_DOCKER_REG}/zabbix-web-nginx-mysql:6.0-centos-latest
113+
114+
115+
}
116+
117+
zabbix_7_0_install(){
118+
119+
shell_log "=====Start mysql 8.0======"
120+
docker run -d --restart=always --name opsany-zabbix-mysql8 \
121+
-e MYSQL_ROOT_PASSWORD="$MYSQL_ROOT_PASSWORD" \
122+
-p 3307:3306 -v ${INSTALL_PATH}/zabbix-mysql8-volume:/var/lib/mysql \
123+
-v ${INSTALL_PATH}/conf/mysql8/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf \
124+
-v ${INSTALL_PATH}/logs/mysql8:/var/log/mysql \
125+
-v /etc/localtime:/etc/localtime:ro \
126+
${PAAS_DOCKER_REG}/mysql:8.0 --character-set-server=utf8 --collation-server=utf8_general_ci --default-authentication-plugin=caching_sha2_password
127+
128+
129+
130+
shell_log "=====Start Zabbix 7.0 LTS======"
131+
docker run --restart=always --name opsany-zabbix-server-7.0 -t \
132+
-e DB_SERVER_HOST="${MYSQL_SERVER_IP}" \
133+
-e DB_SERVER_PORT="3307" \
134+
-e MYSQL_DATABASE="${ZABBIX_DB_NAME}" \
135+
-e MYSQL_USER="${ZABBIX_DB_USER}" \
136+
-e MYSQL_PASSWORD="${ZABBIX_DB_PASSWORD}" \
137+
-e MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \
138+
-p 10051:10051 \
139+
-v ${INSTALL_PATH}/zabbix-volume/alertscripts:/usr/lib/zabbix/alertscripts \
140+
-v ${INSTALL_PATH}/zabbix-volume/externalscripts:/usr/lib/zabbix/externalscripts \
141+
-v ${INSTALL_PATH}/zabbix-volume/snmptraps:/var/lib/zabbix/snmptraps \
142+
-v /etc/localtime:/etc/localtime:ro \
143+
-d ${PAAS_DOCKER_REG}/zabbix-server-mysql:7.0-centos-latest
144+
145+
146+
sleep 20
147+
148+
docker run --restart=always --name opsany-zabbix-web-7.0 -t \
149+
-e ZBX_SERVER_HOST="${MYSQL_SERVER_IP}" \
150+
-e DB_SERVER_HOST="${MYSQL_SERVER_IP}" \
151+
-e DB_SERVER_PORT="3307" \
152+
-e MYSQL_DATABASE="${ZABBIX_DB_NAME}" \
153+
-e MYSQL_USER="${ZABBIX_DB_USER}" \
154+
-e MYSQL_PASSWORD="${ZABBIX_DB_PASSWORD}" \
155+
-e MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \
156+
-v /etc/localtime:/etc/localtime:ro \
157+
-p 8006:8080 \
158+
-d ${PAAS_DOCKER_REG}/zabbix-web-nginx-mysql:7.0-centos-latest
159+
160+
161+
}
162+
163+
zabbix_uninstall5(){
164+
shell_log "=====Uninstall Zabbix 5.0======"
165+
docker stop opsany-zabbix-web
166+
docker stop opsany-zabbix-server-st2
167+
docker rm opsany-zabbix-web
168+
docker rm opsany-zabbix-server-st2
169+
rm -rf ${INSTALL_PATH}/zabbix-volume
170+
}
171+
172+
zabbix_uninstall6(){
173+
shell_log "=====Uninstall Zabbix 6.0======"
174+
docker stop opsany-zabbix-web-6.0
175+
docker stop opsany-zabbix-server-6.0
176+
docker stop opsany-zabbix-mysql8
177+
docker rm opsany-zabbix-web-6.0
178+
docker rm opsany-zabbix-server-6.0
179+
docker rm opsany-zabbix-mysql8
180+
rm -rf ${INSTALL_PATH}/{zabbix-volume,logs/mysql8,conf/mysql8,zabbix-mysql8-volume}
181+
}
182+
183+
zabbix_uninstall7(){
184+
shell_log "=====Uninstall Zabbix 7.0======"
185+
docker stop opsany-zabbix-web-7.0
186+
docker stop opsany-zabbix-server-7.0
187+
docker stop opsany-zabbix-mysql8
188+
docker rm opsany-zabbix-web-7.0
189+
docker rm opsany-zabbix-server-7.0
190+
docker rm opsany-zabbix-mysql8
191+
rm -rf ${INSTALL_PATH}/{zabbix-volume,logs/mysql8,conf/mysql8,zabbix-mysql8-volume}
192+
}
193+
194+
# Main
195+
main(){
196+
case "$1" in
197+
5.0)
198+
install_init
199+
zabbix_5_0_install
200+
;;
201+
6.0)
202+
install_init
203+
zabbix_6_0_install
204+
;;
205+
7.0)
206+
install_init
207+
zabbix_7_0_install
208+
;;
209+
uninstall5)
210+
zabbix_uninstall5
211+
;;
212+
uninstall6)
213+
zabbix_uninstall6
214+
;;
215+
uninstall7)
216+
zabbix_uninstall7
217+
;;
218+
help|*)
219+
echo $"Usage: $0 {5.0|6.0|7.0|uninstall5|uninstall6|uninstall7|help}"
220+
;;
221+
esac
222+
}
223+
224+
main $1

install/init/esb-init/esb_api_doc.sql

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

install/init/esb-init/esb_channel.sql

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)