运维手册¶
平台是如何启动的?¶
OpsAny所有服务均是使用Docker容器启动的,可以使用docker ps -a查看所有容器。所有服务的代理均在opsany-openresty容器中,大部分容器的配置都使用了Volume进行了挂载。
安装脚本在安装的过程中,会替换相关配置文件中的IP地址、用户名和密码。
[root@demo ~]# ls -l /opt/opsany/conf/
total 120
-rw-r--r-- 1 root root 242 Jul 12 13:13 daemon.json
drwxr-xr-x 2 root root 4096 Jul 12 13:13 grafana
-rw-r--r-- 1 root root 7284 Jul 12 13:13 heartbeat.yml
-rw-r--r-- 1 root root 191 Jul 12 13:13 mongodb-org.repo
-rw-r--r-- 1 root root 1673 Jul 12 13:13 mysqld.cnf
drwxr-xr-x 3 root root 4096 Jul 12 15:26 nginx-conf.d
-rw-r--r-- 1 root root 2583 Jul 12 13:13 nginx.conf
-rw-r--r-- 1 root root 1005 Jul 12 13:13 openssl.cnf
-rw-r--r-- 1 root root 552 Jul 12 13:14 paas_agent_config.yaml
-rw-r--r-- 1 root root 980 Jul 12 13:13 paasagent.conf
-rw-r--r-- 1 systemd-coredump root 46729 Jul 12 13:13 redis.conf
drwxr-xr-x 5 root root 4096 Jul 12 13:13 salt
-rw-r--r-- 1 root root 1130 Jul 12 13:13 settings_production.py.appengine
-rw-r--r-- 1 root root 1540 Jul 12 13:13 settings_production.py.esb
-rw-r--r-- 1 root root 1616 Jul 12 13:13 settings_production.py.login
-rw-r--r-- 1 root root 1767 Jul 12 13:13 settings_production.py.paas
-rw-r--r-- 1 root root 2385 Jul 12 13:13 settings_production.py.websocket
-rw-r--r-- 1 root root 1068 Jul 12 13:13 settings_production.py.websocket.init
如何查看日志?¶
1.查看PaaS日志
[root@demo ~]# ls -l /opt/opsany/logs/
total 36240
-rw-r--r-- 1 root root 545 Jul 12 13:14 appengine.log
-rw-r--r-- 1 root root 0 Jul 12 13:14 appengine_mysql.log
drwxr-xr-x 2 root root 4096 Jul 12 13:14 control
-rw-r--r-- 1 root root 68209 Jul 13 19:32 esb.log
-rw-r--r-- 1 root root 16363268 Jul 13 19:32 esb_api.log
-rw------- 1 root root 2796017 Jul 13 19:33 heartbeat
-rw-r--r-- 1 root root 8052 Jul 12 13:21 login.log
-rw-r--r-- 1 root root 0 Jul 12 13:14 login_mysql.log
-rw-r--r-- 1 root root 3385 Jul 12 17:10 nginx_paasagent_error.log
-rw-r--r-- 1 root root 2074644 Jul 13 19:32 nginx_paasagnet_access.log
-rw-r--r-- 1 root root 0 Jul 12 13:17 opsany-salt-api.log
-rw-r--r-- 1 root root 355005 Jul 13 19:33 opsany-salt-master.log
-rw-r--r-- 1 root root 592 Jul 12 13:18 opsany-salt-minion.log
-rw-r--r-- 1 root root 170153 Jul 13 16:11 paas-agent.log
-rw-r--r-- 1 root root 1086376 Jul 13 16:11 paas.log
-rw-r--r-- 1 root root 0 Jul 12 13:14 paas_agent-nginx.log
-rw-r--r-- 1 root root 0 Jul 12 13:14 paas_agent-supervisord.log
-rw-r--r-- 1 root root 288479 Jul 13 16:11 paas_appengine.log
-rw-r--r-- 1 root root 1622275 Jul 13 19:32 paas_esb.log
-rw-r--r-- 1 root root 4160086 Jul 13 19:32 paas_login.log
-rw-r--r-- 1 root root 0 Jul 12 13:13 paas_mysql.log
-rw-r--r-- 1 root root 7813059 Jul 13 19:32 paas_nginx_access.log
-rw-r--r-- 1 root root 2444 Jul 12 19:56 paas_nginx_error.log
-rw-r--r-- 1 root root 180758 Jul 13 19:32 paas_paas.log
-rw-r--r-- 1 root root 344 Jul 12 13:14 paas_websocket.log
2.查看SaaS日志
[root@demo ~]# ls -l /opt/opsany/saas/apps/logs/
total 28
drwxr-xr-x 2 root root 4096 Jul 12 13:22 cmdb
drwxr-xr-x 2 root root 4096 Jul 12 13:27 cmp
drwxr-xr-x 2 root root 4096 Jul 12 13:24 control
drwxr-xr-x 2 root root 4096 Jul 12 13:25 job
drwxr-xr-x 2 root root 4096 Jul 12 13:25 monitor
drwxr-xr-x 2 root root 4096 Jul 12 13:20 rbac
drwxr-xr-x 2 root root 4096 Jul 12 13:21 workbench
部署OpsAny的主机重启后,如何启动SaaS¶
[root@demo ~]# cd /opt/opsany-paas/install/
[root@demo install]# ./saas-restart.sh
也可以将该操作放到rc.local中自动开启
[root@demo ~]# chmod +x /etc/rc.d/rc.local
[root@demo ~]# vim /etc/rc.local
cd /opt/opsany-paas/install/ && sleep 60 && /bin/bash saas-restart.sh
为什么这块不直接处理好,还需要手工?因为SaaS的运行未来是在Kubernetes中,不存在重启的问题,这个是临时解决方案。
当内存足够的时候,如何进行性能调优,增加进程数量。¶
- 更新PaaS代码,获取最新的官方案例配置
cd /opt/opsany-paas && git pull
- 修改相关uwsgi参数
vim /opt/opsany-paas/paas-ce/paasagent/etc/templates/uwsgi.ini
参考调优参数 https://www.bookstack.cn/read/uwsgi-docs-2.0-zh/10968bff8b1ff094.md
- 将配置复制到容器中。
docker cp /opt/opsany-paas/paas-ce/paasagent/etc/templates/uwsgi.ini opsany-paas-paasagent:/opt/opsany/paas-agent/etc/templates/uwsgi.ini
- 重新部署所有SAAS
可以手工在开发中心,内置应用,逐个点击部署,也可以使用更新脚本进行更新。
cd /opt/opsany-paas/install && ./saas-update.sh base