Gitlab启动所有服务的方式

gitlab开机启动是一个systemd的脚本(multi-user.target.wants可能是同级目录下其他文件夹):

/et/systemd/system/multi-user.target.wants/gitlab-runsvdir.service

内容很简单,就是执行一条命令:

[Unit]
Description=GitLab Runit supervision process
After=basic.target

[Service]
ExecStart=/opt/gitlab/embedded/bin/runsvdir-start
Restart=always

[Install]
WantedBy=basic.target

而,/opt/gitlab/embedded/bin/runsvdir-start 这个脚本是干什么的呢?看看内容,最主要的一句就是:

exec env - PATH=$PATH \

runsvdir -P /opt/gitlab/service 'log: ............

runsvdir就是执行一个文件夹下面的所有的子文件夹的服务,而/opt/gitlab/service这个下面的服务有:

pi@raspberrypi:/opt/gitlab/sv $ ll
total 28
drwxr-xr-x 4 root root 4096 Nov 25 21:06 gitlab-workhorse
drwxr-xr-x 5 root root 4096 Nov 25 21:06 logrotate
drwxr-xr-x 4 root root 4096 Nov 25 21:06 nginx
drwxr-xr-x 5 root root 4096 Nov 25 21:06 postgresql
drwxr-xr-x 4 root root 4096 Nov 25 21:06 redis
drwxr-xr-x 4 root root 4096 Nov 25 21:06 sidekiq
drwxr-xr-x 5 root root 4096 Nov 25 21:06 unicorn

这样有一个好处,就是,自己启动自己的定制服务,而不需要系统层面也安装这些,比如nginx和unicorn。

再来看看系统启动的这些服务:

pi@raspberrypi:~ $ ps aux | grep runsv
root    542 0.0 0.0  1836  924 ?    Ss  22:21  0:00 runsvdir -P /opt/gitlab/service log:
root    702 0.0 0.0  1692  356 ?    Ss  22:21  0:00 runsv sidekiq
root    703 0.0 0.0  1692  364 ?    Ss  22:21  0:00 runsv unicorn
root    704 0.0 0.0  1692  340 ?    Ss  22:21  0:00 runsv logrotate
root    705 0.0 0.0  1692  356 ?    Ss  22:21  0:00 runsv nginx
root    706 0.0 0.0  1692  320 ?    Ss  22:21  0:00 runsv redis
root    707 0.0 0.0  1692  324 ?    Ss  22:21  0:00 runsv gitlab-workhorse
root    708 0.0 0.0  1692  308 ?    Ss  22:21  0:00 runsv postgresql
pi    3334 0.0 0.1  4280 1912 pts/0  S+  22:50  0:00 grep --color=auto runsv

可见,runsvdir把指定的子目录都运行了,而且要求生成log。

转载自:多客博图

posted on   德邦总管  阅读(1111)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示