[docker-frr]: use service dependency in supervisord to start services
Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
parent
c915c3cbd6
commit
2c7e55ae98
@ -40,8 +40,7 @@ RUN apt-get clean -y && \
|
|||||||
rm -rf /debs ~/.cache
|
rm -rf /debs ~/.cache
|
||||||
|
|
||||||
COPY ["frr", "/usr/share/sonic/templates"]
|
COPY ["frr", "/usr/share/sonic/templates"]
|
||||||
COPY ["bgpcfgd", "start.sh", "/usr/bin/"]
|
COPY ["bgpcfgd", "docker_init.sh", "/usr/bin/"]
|
||||||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
|
||||||
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
|
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
|
||||||
COPY ["TSA", "/usr/bin/TSA"]
|
COPY ["TSA", "/usr/bin/TSA"]
|
||||||
COPY ["TSB", "/usr/bin/TSB"]
|
COPY ["TSB", "/usr/bin/TSB"]
|
||||||
@ -52,4 +51,4 @@ RUN chmod a+x /usr/bin/TSA && \
|
|||||||
chmod a+x /usr/bin/TSB && \
|
chmod a+x /usr/bin/TSB && \
|
||||||
chmod a+x /usr/bin/TSC
|
chmod a+x /usr/bin/TSC
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
ENTRYPOINT ["/usr/bin/docker_init.sh"]
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
mkdir -p /etc/frr
|
mkdir -p /etc/frr
|
||||||
|
mkdir -p /etc/supervisor/conf.d
|
||||||
|
|
||||||
|
sonic-cfggen -d -t /usr/share/sonic/templates/supervisord/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
CONFIG_TYPE=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["docker_routing_config_mode"]'`
|
CONFIG_TYPE=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["docker_routing_config_mode"]'`
|
||||||
|
|
||||||
if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then
|
if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then
|
||||||
sonic-cfggen -d -t /usr/share/sonic/templates/bgpd/bgpd.conf.j2 -y /etc/sonic/constants.yml > /etc/frr/bgpd.conf
|
sonic-cfggen -d -t /usr/share/sonic/templates/bgpd/bgpd.conf.j2 -y /etc/sonic/constants.yml > /etc/frr/bgpd.conf
|
||||||
sonic-cfggen -d -t /usr/share/sonic/templates/zebra/zebra.conf.j2 > /etc/frr/zebra.conf
|
sonic-cfggen -d -t /usr/share/sonic/templates/zebra/zebra.conf.j2 > /etc/frr/zebra.conf
|
||||||
@ -29,24 +31,4 @@ chmod 0755 /usr/sbin/bgp-unisolate
|
|||||||
mkdir -p /var/sonic
|
mkdir -p /var/sonic
|
||||||
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
|
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
|
||||||
|
|
||||||
rm -f /var/run/rsyslogd.pid
|
exec /usr/bin/supervisord
|
||||||
|
|
||||||
supervisorctl start rsyslogd
|
|
||||||
|
|
||||||
# start eoiu pulling, only if configured so
|
|
||||||
if [[ $(sonic-cfggen -d -v 'WARM_RESTART.bgp.bgp_eoiu') == 'true' ]]; then
|
|
||||||
supervisorctl start bgp_eoiu_marker
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start Quagga processes
|
|
||||||
supervisorctl start zebra
|
|
||||||
supervisorctl start staticd
|
|
||||||
supervisorctl start bgpd
|
|
||||||
|
|
||||||
if [ "$CONFIG_TYPE" == "unified" ]; then
|
|
||||||
supervisorctl start vtysh_b
|
|
||||||
fi
|
|
||||||
|
|
||||||
supervisorctl start fpmsyncd
|
|
||||||
|
|
||||||
supervisorctl start bgpcfgd
|
|
@ -3,38 +3,29 @@ logfile_maxbytes=1MB
|
|||||||
logfile_backups=2
|
logfile_backups=2
|
||||||
nodaemon=true
|
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]
|
[eventlistener:supervisor-proc-exit-listener]
|
||||||
command=/usr/bin/supervisor-proc-exit-listener --container-name bgp
|
command=/usr/bin/supervisor-proc-exit-listener --container-name bgp
|
||||||
events=PROCESS_STATE_EXITED
|
events=PROCESS_STATE_EXITED
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=unexpected
|
autorestart=unexpected
|
||||||
|
|
||||||
[program:start.sh]
|
|
||||||
command=/usr/bin/start.sh
|
|
||||||
priority=1
|
|
||||||
autostart=true
|
|
||||||
autorestart=false
|
|
||||||
startsecs=0
|
|
||||||
stdout_logfile=syslog
|
|
||||||
stderr_logfile=syslog
|
|
||||||
|
|
||||||
[program:bgpcfgd]
|
|
||||||
command=/usr/bin/bgpcfgd
|
|
||||||
priority=2
|
|
||||||
autostart=false
|
|
||||||
autorestart=false
|
|
||||||
startsecs=0
|
|
||||||
stdout_logfile=syslog
|
|
||||||
stderr_logfile=syslog
|
|
||||||
|
|
||||||
[program:rsyslogd]
|
[program:rsyslogd]
|
||||||
command=/usr/sbin/rsyslogd -n
|
command=/usr/sbin/rsyslogd -n -iNONE
|
||||||
priority=3
|
priority=1
|
||||||
autostart=false
|
autostart=false
|
||||||
autorestart=unexpected
|
autorestart=unexpected
|
||||||
startsecs=0
|
startsecs=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
|
||||||
[program:zebra]
|
[program:zebra]
|
||||||
command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp
|
command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp
|
||||||
@ -44,6 +35,8 @@ autorestart=false
|
|||||||
startsecs=0
|
startsecs=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
|
|
||||||
[program:staticd]
|
[program:staticd]
|
||||||
command=/usr/lib/frr/staticd -A 127.0.0.1
|
command=/usr/lib/frr/staticd -A 127.0.0.1
|
||||||
@ -53,6 +46,8 @@ autorestart=false
|
|||||||
startsecs=0
|
startsecs=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
|
|
||||||
[program:bgpd]
|
[program:bgpd]
|
||||||
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp
|
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp
|
||||||
@ -63,15 +58,8 @@ autorestart=false
|
|||||||
startsecs=0
|
startsecs=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
[program:vtysh_b]
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
command=/usr/bin/vtysh -b
|
|
||||||
priority=6
|
|
||||||
autostart=false
|
|
||||||
autorestart=false
|
|
||||||
startsecs=0
|
|
||||||
stdout_logfile=syslog
|
|
||||||
stderr_logfile=syslog
|
|
||||||
|
|
||||||
[program:fpmsyncd]
|
[program:fpmsyncd]
|
||||||
command=fpmsyncd
|
command=fpmsyncd
|
||||||
@ -81,7 +69,34 @@ autorestart=false
|
|||||||
startsecs=0
|
startsecs=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=bgpd:running
|
||||||
|
|
||||||
|
[program:bgpcfgd]
|
||||||
|
command=/usr/bin/bgpcfgd
|
||||||
|
priority=6
|
||||||
|
autostart=false
|
||||||
|
autorestart=false
|
||||||
|
startsecs=0
|
||||||
|
stdout_logfile=syslog
|
||||||
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=bgpd:running
|
||||||
|
|
||||||
|
{% if DEVICE_METADATA.localhost.docker_routing_config_mode is defined and DEVICE_METADATA.localhost.docker_routing_config_mode == "unified" %}
|
||||||
|
[program:vtysh_b]
|
||||||
|
command=/usr/bin/vtysh -b
|
||||||
|
priority=6
|
||||||
|
autostart=false
|
||||||
|
autorestart=false
|
||||||
|
startsecs=0
|
||||||
|
stdout_logfile=syslog
|
||||||
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if WARM_RESTART is defined and WARM_RESTART.bgp is defined and WARM_RESTART.bgp.bgp_eoiu is defined and WARM_RESTART.bgp.bgp_eoiu == "true" %}
|
||||||
[program:bgp_eoiu_marker]
|
[program:bgp_eoiu_marker]
|
||||||
command=/usr/bin/bgp_eoiu_marker.py
|
command=/usr/bin/bgp_eoiu_marker.py
|
||||||
priority=7
|
priority=7
|
||||||
@ -91,3 +106,6 @@ startsecs=0
|
|||||||
startretries=0
|
startretries=0
|
||||||
stdout_logfile=syslog
|
stdout_logfile=syslog
|
||||||
stderr_logfile=syslog
|
stderr_logfile=syslog
|
||||||
|
dependent_startup=true
|
||||||
|
dependent_startup_wait_for=rsyslogd:running
|
||||||
|
{% endif %}
|
Reference in New Issue
Block a user