jenkins发项目成功
访问一直报错:nginx的502
jps查看进程 进程在 此时想着是nginx的问题?有人修改nginx的配置了?
找了半天 找不到有用的日志
那项目启动失败,jenkins再次发布 还是不行
再仔细看了下服务进程,服务的pid一直在修改,即项目一直在重启。
最后看了日志发现,发现项目启动失败(yml文件中少了常量配置导致),然后项目一直在自动重启,所以nginx也就一直在报502
原因搞清楚了,下面了解下supervisord
中文版介绍:https://www.jianshu.com/p/2e11c9a38cf4
官网:http://supervisord.org/可参考的配置如下:
supervisord.conf内容如下:
[work@iz8vb0ff0zehhy4dc9h9hjz etc]$ cat supervisord.conf
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[unix_http_server]
file = /var/tmp/supervisor.sock
[supervisord]
;http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
logfile=/var/log/supervisor/supervisord.log ; (main log file;default /supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (logging level;default info; others: debug,warn)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files = /etc/supervisor.conf.d/*.conf
supervisor.conf.d路径下配置文件:
[work@iz8vb0ff0zehhy4dc9h9hjz supervisor.conf.d]$ cat cloud-community.conf
[program:cloud-community]
environment=JAVA_HOME=/usr/local/jdk-13.0.1/bin
user = work
group = work
command = /usr/local/jdk-13.0.1/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xmx512m --enable-preview -jar -verbose:gc -Xlog:gc*:file=/data/logs/gc_log/cloud-community-gc.log -Dserver.port="8089" -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog.level.console=warn -Dlog.level.com.tal=all /data/webroot/apps/coding-cloud-community.jar
numprocs=1
autostart=true
autorestart=true
startsecs=10
startretries=3
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups = 200
stdout_logfile = /data/logs/cloud-community/community.log