[docker-orchagent]: use service dependency in supervisord to start services

This commit is contained in:
Guohan Lu 2020-05-16 00:09:16 +00:00 committed by lguohan
parent 7ea6d9dc8f
commit b8da6c3588
4 changed files with 76 additions and 77 deletions

View File

@ -59,8 +59,9 @@ RUN apt-get clean -y && \
rm -rf /debs
COPY ["files/arp_update", "/usr/bin"]
COPY ["arp_update.conf", "/usr/share/sonic/templates/"]
COPY ["enable_counters.py", "/usr/bin"]
COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["docker-init.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor/"]
@ -68,4 +69,4 @@ COPY ["critical_processes", "/etc/supervisor/"]
## Copy all Jinja2 template files into the templates folder
COPY ["*.j2", "/usr/share/sonic/templates/"]
ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/docker-init.sh"]

View File

@ -0,0 +1,9 @@
[program:arp_update]
command=/usr/bin/arp_update
priority=7
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited

View File

@ -11,40 +11,10 @@ if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then
/usr/share/sonic/hwsku/hwsku-init
fi
export platform=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
rm -f /var/run/rsyslogd.pid
supervisorctl start rsyslogd
supervisorctl start orchagent
supervisorctl start restore_neighbors
supervisorctl start portsyncd
supervisorctl start neighsyncd
supervisorctl start swssconfig
supervisorctl start vrfmgrd
supervisorctl start vlanmgrd
supervisorctl start intfmgrd
supervisorctl start portmgrd
supervisorctl start buffermgrd
supervisorctl start enable_counters
supervisorctl start nbrmgrd
supervisorctl start vxlanmgrd
# Start arp_update when VLAN exists
VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'`
if [ "$VLAN" != "" ]; then
supervisorctl start arp_update
cp /usr/share/sonic/templates/arp_update.conf /etc/supervisord/conf.d/
fi
exec /usr/bin/supervisord

View File

@ -3,27 +3,28 @@ logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[eventlistener:dependent-startup]
command=python -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
[eventlistener:supervisor-proc-exit-listener]
command=/usr/bin/supervisor-proc-exit-listener --container-name swss
events=PROCESS_STATE_EXITED
autostart=true
autorestart=unexpected
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
[program:orchagent]
command=/usr/bin/orchagent.sh
@ -32,22 +33,20 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
[program:portsyncd]
command=/usr/bin/portsyncd
[program:restore_neighbors]
command=/usr/bin/restore_neighbors.py
priority=4
autostart=false
autorestart=false
startsecs=0
startretries=0
stdout_logfile=syslog
stderr_logfile=syslog
[program:neighsyncd]
command=/usr/bin/neighsyncd
priority=5
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=orchagent:running
[program:swssconfig]
command=/usr/bin/swssconfig.sh
@ -58,14 +57,28 @@ startretries=0
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=orchagent:running
[program:arp_update]
command=/usr/bin/arp_update
priority=7
[program:portsyncd]
command=/usr/bin/portsyncd
priority=4
autostart=false
autorestart=unexpected
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:neighsyncd]
command=/usr/bin/neighsyncd
priority=5
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:vlanmgrd]
command=/usr/bin/vlanmgrd
@ -74,6 +87,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:intfmgrd]
command=/usr/bin/intfmgrd
@ -82,6 +97,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:portmgrd]
command=/usr/bin/portmgrd
@ -90,6 +107,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:buffermgrd]
command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini
@ -98,14 +117,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:enable_counters]
command=/usr/bin/enable_counters.py
priority=12
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:vrfmgrd]
command=/usr/bin/vrfmgrd
@ -114,16 +127,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:restore_neighbors]
command=/usr/bin/restore_neighbors.py
priority=14
autostart=false
autorestart=false
startsecs=0
startretries=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:nbrmgrd]
command=/usr/bin/nbrmgrd
@ -132,6 +137,8 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:vxlanmgrd]
command=/usr/bin/vxlanmgrd
@ -140,3 +147,15 @@ autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
[program:enable_counters]
command=/usr/bin/enable_counters.py
priority=12
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited