Common configuration files
1.tomcat.serivce
[Unit]
Description=Tomcat
After=network.target
[Service]
Type=forking
ExecStart=/opt/apache-tomcat-8.5.72/bin/catalina.sh start
ExecReload=/opt/apache-tomcat-8.5.72/bin/catalina.sh restart
ExecStop=/opt/apache-tomcat-8.5.72/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target2.pypi-mirror
Path:~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple3.Docker registry mirrors
Path:/etc/docker/daemon.json
{
"registry-mirrors": ["https://lsu57d0u.mirror.aliyuncs.com"]
}restart docker after configure.
4.supervisor
Path:/etc/supervisord.d
[program:train]
command=java -jar -Dspring.profiles.active=dev /data/dev/train/train-v0.1.0.jar
#command=java -jar -Dspring.profiles.active=prod /data/dev/train/train.jar
directory=/data/dev/train
user=root
autorestart=true
redirect_stderr=true
stdout_logfile = /data/logs/train/train.log
loglevel=info5.use supervisor manage redis
[program:redis-server]
command=/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
priority=999
autostart=true
autorestart=true
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=1
user=root
log_stdout=true
log_stderr=false
logfile=/var/log/redis-server.log
logfile_maxbytes=1MB
logfile_backups=10redis must set daemonize no
6.prometheus.service
[Unit]
Description=Prometheus Node Exporter
After=network.target
[Service]
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --web.read-timeout=5m --web.max-connections=10 --storage.tsdb.retention=15d --storage.tsdb.path=/prometheus/data --query.max-concurrency=20 --query.timeout=2m
User=root
[Install]
WantedBy=multi-user.target7.supervisor
[program:healthy]
#command=java -jar -Djava.library.path=$LD_LIBRARY_PATH /data/release/healthy/healthy.jar
command=java -jar /data/release/healthy/healthy.jar
directory=/data/release/healthy
user=root
autorestart=true
redirect_stderr=true
stdout_logfile = /data/logs/healthy/healthy.log
loglevel=info
#environment=LD_LIBRARY_PATH="/usr/local/MATLAB/MATLAB_Runtime/v910/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/extern/bin/glnxa64",LD_PRELOAD="/usr/local/MATLAB/MATLAB_Runtime/v910/bin/glnxa64/glibc-2.17_shim.so"
environment=LD_LIBRARY_PATH="/usr/local/MATLAB/MATLAB_Runtime/v93/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v93/extern/bin/glnxa64"8.supervisor
[program:sociality]
command=java -Xmx1024m -XX:-UseGCOverheadLimit -Dspring.location.config=config/ -jar /data/release/XXXX-java/XXXXXX.jar --server.port=8090
priority=999
#指定进程的启动优先级,数值越高表示优先级越高。
autostart=true
#设置为true时,表示Supervisord启动时会自动启动这个程序。
autorestart=true
#如果设置为true,Supervisord会在进程异常退出时自动重启。
startsecs=10
#在Supervisord认为进程已成功启动之前等待的时间(以秒为单位)。
startretries=3
#如果启动失败,Supervisord尝试重新启动的次数。
exitcodes=0,2
#定义正常退出的进程状态码。0和2被认为是正常退出,Supervisord将不会重启进程。
stopsignal=QUIT
#发送给进程以请求其正常关闭的信号。
stopwaitsecs=1
#在发送停止信号之后,等待进程终止的时间(以秒为单位)。
user=root
#以指定的用户身份运行进程。
redirect_stderr=true
#设置为true时,表示将标准错误(stderr)重定向到与标准输出相同的地方。
stdout_logfile=/data/logs/XXXXXX/XXXXXX.log
#指定标准输出(stdout)的日志文件路径。这表示进程的标准输出将被记录到log文件中。
stdout_logfile_maxbytes=20MB
#设置日志文件的最大大小,超过这个大小会进行日志分割。
stdout_logfile_backups=20
#保留的日志文件备份数量,超过这个数量会删除旧的备份文件。9.使用变量范例
[program:redis-server]
command=$REDIS_EXE $CONF_FILE
priority=999
autostart=true
autorestart=true
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=1
user=root
log_stdout=true
log_stderr=false
logfile=/var/log/redis-server.log
logfile_maxbytes=1MB
logfile_backups=10
environment=REDIS_EXE="/usr/local/redis/bin/redis-server",CONF_FILE="/usr/local/redis/etc/redis.conf"