[Dockers]: Manage all Docker containers with Supervisord (#573)

- Consolidate config.sh and start.sh scripts into one script (start.sh)
 - Solve issue #435 - All dockers now run supervisord as their ENTRYPOINT
 - All stdout/stderr output from processes managed by supervisord is now sent to syslog instead of their own files
 - Supervisord log messages are now also sent to syslog
 - Removed unused smartmontools package from docker-platform-monitor
This commit is contained in:
Joe LeVeque 2017-05-08 15:43:31 -07:00 committed by GitHub
parent 97b4924476
commit 8f348399f5
83 changed files with 989 additions and 479 deletions

9
.gitignore vendored
View File

@ -26,15 +26,16 @@ src/thrift/*
src/sonic-device-data/src/device/
# Autogenerated Dockerfiles
dockers/docker-base/Dockerfile
dockers/docker-config-engine/Dockerfile
dockers/docker-database/Dockerfile
dockers/docker-fpm/Dockerfile
dockers/docker-fpm-frr/Dockerfile
dockers/docker-fpm-gobgp/Dockerfile
dockers/docker-fpm-quagga/Dockerfile
dockers/docker-lldp-sv2/Dockerfile
dockers/docker-orchagent/Dockerfile
dockers/docker-snmp-sv2/Dockerfile
dockers/docker-team/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-config-engine/Dockerfile
dockers/docker-base/Dockerfile
platform/*/docker-syncd-*/Dockerfile
platform/*/docker-syncd-*-rpc/Dockerfile

View File

@ -4,36 +4,38 @@ FROM debian:jessie
RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true
## Clean doc directories that are empty or only contain empty directories
RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done
RUN rm -rf \
/usr/share/man/* \
/usr/share/groff/* \
/usr/share/info/* \
/usr/share/lintian/* \
/usr/share/linda/* \
/var/cache/man/* \
/usr/share/locale/*
RUN rm -rf \
/usr/share/man/* \
/usr/share/groff/* \
/usr/share/info/* \
/usr/share/lintian/* \
/usr/share/linda/* \
/var/cache/man/* \
/usr/share/locale/*
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
## Set the apt source
COPY sources.list /etc/apt/sources.list
COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop
## Configure data sources for apt/dpkg
COPY ["sources.list", "/etc/apt/sources.list"]
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
RUN apt-get clean && apt-get update
## Pre-install the fundamental packages
RUN apt-get -y install \
rsyslog \
vim-tiny \
perl \
## Pre-install fundamental packages
RUN apt-get -y install \
rsyslog \
supervisor \
vim-tiny \
perl \
python
COPY rsyslog.conf /etc/rsyslog.conf
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
RUN apt-get -y purge \
exim4 \
exim4-base \
exim4-config \
RUN apt-get -y purge \
exim4 \
exim4-base \
exim4-config \
exim4-daemon-light
{% if docker_base_dbgs %}
@ -46,6 +48,7 @@ RUN apt-get -y install \
## Clean up apt
## Remove /var/lib/apt/lists/*, could be obsoleted for derived images
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \
rm -rf /var/lib/apt/lists/*; \
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \
rm -rf /var/lib/apt/lists/*; \
rm -rf /tmp/*;

View File

@ -0,0 +1,8 @@
$ModLoad imfile
$InputFileName /var/log/supervisor/supervisord.log
$InputFileTag supervisord
$InputFileStateFile state-supervisor
$InputFileSeverity info
$InputFileFacility local0
$InputRunFileMonitor

View File

@ -5,18 +5,19 @@ MAINTAINER Xudong Wu
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
## Set the apt source
## Update apt's cache of available packages
RUN apt-get clean && apt-get update
COPY deps /deps
RUN dpkg -i /deps/libopennsl_*.deb; \
dpkg -i /deps/libsaibcm_*.deb; \
RUN dpkg -i /deps/libopennsl_*.deb; \
dpkg -i /deps/libsaibcm_*.deb; \
apt-get -y install -f
RUN mv /deps/basic_router /usr/sbin/basic_router
ENTRYPOINT rm -f /var/run/rsyslogd.pid \
&& service rsyslog start \
&& /bin/bash
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
rm -f /var/run/rsyslogd.pid
supervisorctl start rsyslogd

View File

@ -0,0 +1,20 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -32,4 +32,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g;
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \
' /etc/redis/redis.conf
ENTRYPOINT ["/usr/bin/redis-server", "/etc/redis/redis.conf"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -0,0 +1,12 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:redis-server]
command=/usr/bin/redis-server /etc/redis/redis.conf
priority=1
autostart=true
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -1,22 +1,21 @@
FROM docker-config-engine
## Make apt-get non-interactive
# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
## Update APT package lists
# Update apt's cache of available packages
RUN apt-get update
## Install isc-dhcp-relay Debian package
# Install isc-dhcp-relay Debian package
RUN apt-get -y install isc-dhcp-relay
## Clean up
# Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"]
COPY ["config.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]
ENTRYPOINT /usr/bin/config.sh \
&& /usr/bin/start.sh \
&& /bin/bash
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,4 +0,0 @@
#!/bin/bash
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Based off /etc/init.d/isc-dhcp-relay
#
# Read init script configuration (interfaces the daemon should listen on
# and the DHCP server we should forward requests to.)
[ -f /etc/default/isc-dhcp-relay ] && . /etc/default/isc-dhcp-relay
# Build command line for interfaces (will be passed to dhrelay below.)
IFCMD=""
if test "$INTERFACES" != ""; then
for I in $INTERFACES; do
IFCMD=${IFCMD}"-i "${I}" "
done
fi
exec /usr/sbin/dhcrelay -d -q ${OPTIONS} ${IFCMD} ${SERVERS}

View File

@ -1,7 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay
rm -f /var/run/rsyslogd.pid
service rsyslog start
supervisorctl start rsyslogd
VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['attachto']"`
@ -11,5 +14,5 @@ until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do
done
# Start the DHCP relay
service isc-dhcp-relay start
supervisorctl start isc-dhcp-relay

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:isc-dhcp-relay]
command=/usr/bin/isc-dhcp-relay.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -3,7 +3,7 @@ FROM docker-fpm-quagga
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y supervisor
RUN apt-get update
COPY \
{% for deb in docker_fpm_gobgp_debs.split(' ') -%}
@ -20,12 +20,10 @@ debs/{{ deb }}{{' '}}
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["start.sh", "config.sh", "/usr/bin/"]
COPY ["daemons", "/etc/quagga/"]
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ENTRYPOINT /usr/bin/config.sh \
&& /usr/bin/start.sh \
&& /usr/bin/supervisord \
&& /bin/bash
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,17 +0,0 @@
#!/bin/bash
mkdir -p /etc/quagga
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 >/etc/gobgp/gobgpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate
chown root:root /usr/sbin/bgp-isolate
chmod 0755 /usr/sbin/bgp-isolate
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate
chown root:root /usr/sbin/bgp-unisolate
chmod 0755 /usr/sbin/bgp-unisolate
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -1,6 +1,26 @@
#!/bin/bash
#!/usr/bin/env bash
mkdir -p /etc/quagga
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate
chown root:root /usr/sbin/bgp-isolate
chmod 0755 /usr/sbin/bgp-isolate
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate
chown root:root /usr/sbin/bgp-unisolate
chmod 0755 /usr/sbin/bgp-unisolate
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
service rsyslog start
supervisorctl start rsyslogd
# Quagga has its own monitor process, 'watchquagga'
service quagga start
fpmsyncd &
supervisorctl start fpmsyncd

View File

@ -1,6 +1,34 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:gobgpd]
command=/usr/sbin/gobgpd -p -f /etc/gobgp/gobgpd.conf -r
priority=1
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:fpmsyncd]
command=fpmsyncd
priority=5
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -22,10 +22,10 @@ debs/{{ deb }}{{' '}}
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["start.sh", "config.sh", "/usr/bin/"]
COPY ["daemons", "/etc/quagga/"]
ENTRYPOINT /usr/bin/config.sh \
&& /usr/bin/start.sh \
&& /bin/bash
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,17 +0,0 @@
#!/bin/bash
mkdir -p /etc/quagga
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/quagga/bgpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate
chown root:root /usr/sbin/bgp-isolate
chmod 0755 /usr/sbin/bgp-isolate
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate
chown root:root /usr/sbin/bgp-unisolate
chmod 0755 /usr/sbin/bgp-unisolate
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -1,6 +1,26 @@
#!/bin/bash
#!/usr/bin/env bash
mkdir -p /etc/quagga
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate
chown root:root /usr/sbin/bgp-isolate
chmod 0755 /usr/sbin/bgp-isolate
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate
chown root:root /usr/sbin/bgp-unisolate
chmod 0755 /usr/sbin/bgp-unisolate
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
service rsyslog start
supervisorctl start rsyslogd
# Quagga has its own monitor process, 'watchquagga'
service quagga start
fpmsyncd &
supervisorctl start fpmsyncd

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:fpmsyncd]
command=fpmsyncd
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -11,7 +11,7 @@ COPY python-wheels /python-wheels
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20
RUN apt-get update && apt-get install -y python-pip libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20
# Pre-install the fundamental packages
# Install Python SwSS SDK
@ -28,10 +28,11 @@ RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \
apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \
rm -rf /debs /python-wheels ~/.cache
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY reconfigure.sh /opt/reconfigure.sh
COPY ["config.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["reconfigure.sh", "/opt/"]
COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"]
COPY ["lldpd", "/etc/default/"]
ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,8 +0,0 @@
#!/bin/bash
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 >/etc/lldpd.conf
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
rm -f /var/run/rsyslogd.pid

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
supervisorctl start rsyslogd
supervisorctl start lldpd
supervisorctl start lldpd-conf-reload
supervisorctl start lldp-syncd

View File

@ -1,6 +1,23 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:lldpd]
# https://github.com/vincentbernat/lldpd/commit/9856f2792c301116cc4a3fcfba91b9672ee5db1f
# - `-d` means to stay in foreground, log to syslog
@ -9,15 +26,22 @@ nodaemon=true
# - `-dddd` means to stay in foreground, log all to console
command=/usr/sbin/lldpd -d -I Ethernet*,eth*
priority=100
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:lldpd-conf-reload]
command=/opt/reconfigure.sh
priority=150
autostart=false
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:lldp-syncd]
command=/usr/bin/env python2 -m lldp_syncd
priority=200
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=1

View File

@ -22,14 +22,14 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}
COPY start.sh /usr/bin/start.sh
COPY config.sh /usr/bin/config.sh
COPY ipinip.json.j2 /usr/share/sonic/templates/ipinip.json.j2
COPY mirror.json.j2 /usr/share/sonic/templates/mirror.json.j2
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
COPY ["start.sh", "orchagent.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"]
COPY ["mirror.json.j2", "/usr/share/sonic/templates/"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,6 +0,0 @@
#!/bin/bash -e
mkdir -p /etc/swss/config.d/
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json

View File

@ -0,0 +1,80 @@
#!/usr/bin/env bash
# Exit immediately upon error
set -e
function start_app {
orchagent $ORCHAGENT_ARGS &
portsyncd $PORTSYNCD_ARGS &
intfsyncd &
neighsyncd &
for file in $SWSSCONFIG_ARGS
do
swssconfig /etc/swss/config.d/$file
sleep 1
done
}
function config_acl {
if [ -f "/etc/sonic/acl.json" ]; then
mkdir -p /etc/swss/config.d/acl
rm -rf /etc/swss/config.d/acl/*
translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json
for filename in /etc/swss/config.d/acl/*.json; do
[ -e "$filename" ] || break
swssconfig $filename
done
fi
}
function clean_up {
pkill -9 orchagent
pkill -9 portsyncd
pkill -9 intfsyncd
pkill -9 neighsyncd
exit
}
trap clean_up SIGTERM SIGKILL
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
ORCHAGENT_ARGS=""
PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini"
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json "
if [ "$HWSKU" == "Force10-S6000" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "
elif [ "$HWSKU" == "Force10-S6100" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "Force10-Z9100" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "Arista-7050-QX32" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "
elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "AS7512" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "ACS-MSN2700" ]; then
SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json "
fi
while true; do
# Check if syncd starts
result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p`
if [ "$result" != "0" ]; then
start_app
config_acl
read
fi
sleep 1
done

View File

@ -1,84 +1,15 @@
#!/bin/bash
#!/usr/bin/env bash
. config.sh
mkdir -p /etc/swss/config.d/
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json
export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform`
function start_app {
orchagent $ORCHAGENT_ARGS &
portsyncd $PORTSYNCD_ARGS &
intfsyncd &
neighsyncd &
for file in $SWSSCONFIG_ARGS
do
swssconfig /etc/swss/config.d/$file
sleep 1
done
}
function config_acl {
if [ -f "/etc/sonic/acl.json" ]; then
mkdir -p /etc/swss/config.d/acl
rm -rf /etc/swss/config.d/acl/*
translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json
for filename in /etc/swss/config.d/acl/*.json; do
[ -e "$filename" ] || break
swssconfig $filename
done
fi
}
function clean_up {
pkill -9 orchagent
pkill -9 portsyncd
pkill -9 intfsyncd
pkill -9 neighsyncd
service rsyslog stop
exit
}
trap clean_up SIGTERM SIGKILL
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
ORCHAGENT_ARGS=""
PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini"
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json "
if [ "$HWSKU" == "Force10-S6000" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "
elif [ "$HWSKU" == "Force10-S6100" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "Force10-Z9100" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "Arista-7050-QX32" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "
elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "AS7512" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
elif [ "$HWSKU" == "ACS-MSN2700" ]; then
SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json "
fi
rm -f /var/run/rsyslogd.pid
service rsyslog start
while true; do
# Check if syncd starts
result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p`
if [ "$result" != "0" ]; then
start_app
config_acl
read
fi
sleep 1
done
supervisorctl start rsyslogd
supervisorctl start orchagent

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:orchagent]
command=/usr/bin/orchagent.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -5,17 +5,14 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y smartmontools sensord
RUN apt-get install -y sensord
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
COPY ["config.sh", "/usr/bin/"]
COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT /usr/bin/config.sh \
&& service rsyslog start \
&& service lm-sensors start \
&& service smartmontools start \
&& service sensord start \
&& /bin/bash

View File

@ -1,12 +0,0 @@
#!/bin/bash
mkdir -p /etc/sensors.d
if [ -e /usr/share/sonic/platform/sensors.conf ]
then
/bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/
fi
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
rm -f /var/run/rsyslogd.pid

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# Based off /etc/init.d/lm-sensors
#
/usr/bin/sensors -s > /dev/null 2>&1
/usr/bin/sensors > /dev/null 2>&1
# Currently, there is no way to run sensord in the foreground, so we
# can't use supervisord. Instead, we just start the service for now.
service sensord start

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
mkdir -p /etc/sensors.d
if [ -e /usr/share/sonic/platform/sensors.conf ]; then
/bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/
fi
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
supervisorctl start rsyslogd
supervisorctl start lm-sensors

View File

@ -0,0 +1,28 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:lm-sensors]
command=/usr/bin/lm-sensors.sh
priority=3
autostart=false
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -82,9 +82,7 @@ RUN mkdir /var/run/sshd \
&& sed -i '$aUseDNS no' /etc/ssh/sshd_config \
&& mkdir /root/deps
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY sshd.conf /etc/supervisor/conf.d/sshd.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
COPY ["supervisord.conf", "sshd.conf", "ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
EXPOSE 22

View File

@ -17,10 +17,12 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
COPY ["deps/saiserver", "start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["profile.ini", "portmap.ini", "/etc/sai/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; rm -rf /deps
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,8 +1,4 @@
#!/bin/bash
function clean_up {
service rsyslog stop
}
#!/usr/bin/env bash
start_bcm()
{
@ -11,11 +7,12 @@ start_bcm()
[ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0
}
trap clean_up SIGTERM SIGKILL
rm -f /var/run/rsyslogd.pid
service rsyslog start
supervisorctl start rsyslogd
start_bcm
/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
supervisorctl start saiserver

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:saiserver]
command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -1,4 +1,3 @@
FROM docker-base
RUN apt-get update \
@ -9,22 +8,24 @@ RUN apt-get update \
COPY deps /root/deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /root/deps/xp-tools.deb \
&& dpkg_apt /root/deps/libsai.deb \
&& dpkg_apt /root/deps/sai.deb \
&& dpkg_apt /root/deps/libthrift-0.9.3_*.deb \
dpkg_apt /root/deps/xp-tools.deb \
&& dpkg_apt /root/deps/libsai.deb \
&& dpkg_apt /root/deps/sai.deb \
&& dpkg_apt /root/deps/libthrift-0.9.3_*.deb \
&& dpkg_apt /root/deps/libnl-3-200_*.deb \
&& dpkg_apt /root/deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /root/deps/libnl-route-3-200_*.deb
&& dpkg_apt /root/deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /root/deps/libnl-route-3-200_*.deb
COPY ["deps/saiserver", "start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["portmap.ini", "profile.ini", "/etc/sai/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf deps
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,12 +1,8 @@
#!/bin/bash
function clean_up {
service rsyslog stop
}
trap clean_up SIGTERM SIGKILL
#!/usr/bin/env bash
rm -f /var/run/rsyslogd.pid
service rsyslog start
/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
supervisorctl start rsyslogd
supervisorctl start saiserver

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:saiserver]
command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -8,23 +8,25 @@ RUN apt-get update
COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"]
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/applibs_*.deb \
&& dpkg_apt /deps/applibs-dev_*.deb \
&& dpkg_apt /deps/sx-complib_*.deb \
&& dpkg_apt /deps/sxd-libs_*.deb \
&& dpkg_apt /deps/sx-scew_*.deb \
&& dpkg_apt /deps/sx-examples_*.deb \
&& dpkg_apt /deps/sx-gen-utils_*.deb \
&& dpkg_apt /deps/python-sdk-api_*.deb \
&& dpkg_apt /deps/iproute2_*.deb \
&& dpkg_apt /deps/mlnx-sai_*.deb \
&& dpkg_apt /deps/libthrift-0.9.3_*.deb \
&& dpkg_apt /deps/libnl-3-200_*.deb \
&& dpkg_apt /deps/libnl-genl-3-200_*.deb \
dpkg_apt /deps/applibs_*.deb \
&& dpkg_apt /deps/applibs-dev_*.deb \
&& dpkg_apt /deps/sx-complib_*.deb \
&& dpkg_apt /deps/sxd-libs_*.deb \
&& dpkg_apt /deps/sx-scew_*.deb \
&& dpkg_apt /deps/sx-examples_*.deb \
&& dpkg_apt /deps/sx-gen-utils_*.deb \
&& dpkg_apt /deps/python-sdk-api_*.deb \
&& dpkg_apt /deps/iproute2_*.deb \
&& dpkg_apt /deps/mlnx-sai_*.deb \
&& dpkg_apt /deps/libthrift-0.9.3_*.deb \
&& dpkg_apt /deps/libnl-3-200_*.deb \
&& dpkg_apt /deps/libnl-genl-3-200_*.deb \
&& dpkg_apt /deps/libnl-route-3-200_*.deb
COPY ["deps/saiserver", "start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["profile.ini", "portmap.ini", "/etc/sai/"]
COPY ["sai_2700.xml", "/usr/share/"]
@ -33,5 +35,5 @@ COPY ["sai_2700.xml", "/usr/share/"]
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,19 +1,16 @@
#!/bin/bash
function clean_up {
service rsyslog stop
}
#!/usr/bin/env bash
start_mlnx()
{
[ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 )
}
trap clean_up SIGTERM SIGKILL
rm -f /var/run/rsyslogd.pid
service rsyslog start
supervisorctl start rsyslogd
start_mlnx
/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
supervisorctl start saiserver

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:saiserver]
command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -16,15 +16,13 @@ ENV PYTHONOPTIMIZE 1
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# install supervisor
# install libsnmp30 dependencies
# install libpython3.6-dev dependencies
# install pip dependencies
# TODO: remove libpython3.6-dev, its and pip's dependencies if we can get pip3 directly
# install subagent
# clean up
RUN apt-get update && apt-get install -y supervisor \
libperl5.20 libpci3 libwrap0 \
RUN apt-get update && apt-get install -y libperl5.20 libpci3 libwrap0 \
libexpat1-dev \
curl gcc && \
dpkg -i \
@ -41,11 +39,12 @@ RUN apt-get update && apt-get install -y supervisor \
find / | grep -E "__pycache__" | xargs rm -rf && \
rm -rf ~/.cache
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["config.sh", "/usr/bin/"]
## Although exposing ports is not need for host net mode, keep it for possible bridge mode
## Although exposing ports is not needed for host net mode, keep it for possible bridge mode
EXPOSE 161/udp 162/udp
ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,16 +0,0 @@
#!/bin/bash
mkdir -p /etc/ssw
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 >/etc/ssw/sysDescription
mkdir -p /etc/snmp
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 >/etc/snmp/alias_map.json
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
rm -f /var/run/rsyslogd.pid

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
mkdir -p /etc/ssw
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription
mkdir -p /etc/snmp
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
supervisorctl start rsyslogd
supervisorctl start snmpd
supervisorctl start snmp-subagent

View File

@ -1,14 +1,34 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:snmpd]
command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid
priority=100
[program:snmp-subagent]
command=/usr/bin/env python3.6 -m sonic_ax_impl
priority=200
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=1
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:snmpd]
command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:snmp-subagent]
command=/usr/bin/env python3.6 -m sonic_ax_impl
priority=4
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -1,6 +1,11 @@
FROM docker-config-engine
RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
## Install redis-tools dependencies
## TODO: implicitly install dependencies
@ -17,14 +22,12 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}
COPY ["start.sh", "config.sh", "/usr/bin/"]
COPY ["start.sh", "teamd.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["teamd.j2", "/usr/share/sonic/templates/"]
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/usr/bin/config.sh && /usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,12 +0,0 @@
#!/bin/bash
mkdir -p /etc/teamd
rm -f /etc/teamd/*
for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do
sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf
done
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -1,45 +1,20 @@
#!/bin/bash
#!/usr/bin/env bash
TEAMD_CONF_PATH=/etc/teamd
# Before teamd could automatically add newly created host interfaces into the
# LAG, this workaround will be needed. It will remove the obsolete files and
# net devices that are failed to be removed in the previous run.
function start_app {
# Remove *.pid and *.sock files if there are any
rm -f /var/run/teamd/*
if [ -d $TEAMD_CONF_PATH ]; then
for f in $TEAMD_CONF_PATH/*; do
# Remove netdevs if there are any
intf=`echo $f | awk -F'[/.]' '{print $4}'`
ip link del $intf
teamd -f $f -d
done
fi
teamsyncd &
}
rm -rf $TEAMD_CONF_PATH
mkdir -p $TEAMD_CONF_PATH
function clean_up {
pkill -9 teamd
pkill -9 teamsyncd
service rsyslog stop
exit
}
for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do
sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf
done
trap clean_up SIGTERM SIGKILL
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
rm -f /var/run/rsyslogd.pid
service rsyslog start
# Before teamd could automatically add newly created host interfaces into the
# LAG, this workaround will wait until the host interfaces are created and then
# the processes will be started.
while true; do
# Check if front-panel ports are configured
result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p`
if [ "$result" == "0" ]; then
start_app
read
fi
sleep 1
done
supervisorctl start rsyslogd
supervisorctl start teamd

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:teamd]
command=/usr/bin/teamd.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

42
dockers/docker-teamd/teamd.sh Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
TEAMD_CONF_PATH=/etc/teamd
# Before teamd could automatically add newly created host interfaces into the
# LAG, this workaround will be needed. It will remove the obsolete files and
# net devices that are failed to be removed in the previous run.
function start_app {
# Remove *.pid and *.sock files if there are any
rm -f /var/run/teamd/*
if [ -d $TEAMD_CONF_PATH ]; then
for f in $TEAMD_CONF_PATH/*; do
# Remove netdevs if there are any
intf=`echo $f | awk -F'[/.]' '{print $4}'`
ip link del $intf
teamd -f $f -d
done
fi
teamsyncd &
}
function clean_up {
pkill -9 teamd
pkill -9 teamsyncd
exit
}
trap clean_up SIGTERM SIGKILL
# Before teamd could automatically add newly created host interfaces into the
# LAG, this workaround will wait until the host interfaces are created and then
# the processes will be started.
while true; do
# Check if front-panel ports are configured
result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p`
if [ "$result" == "0" ]; then
start_app
read
fi
sleep 1
done

View File

@ -0,0 +1,2 @@
sysctl -w net.core.rmem_max=509430500

View File

@ -27,7 +27,6 @@ RUN apt-get update \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
@ -47,10 +46,8 @@ RUN apt-get update \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
COPY ["99-syncd.conf", "/etc/sysctl.d/"]
RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh
ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]

View File

@ -1,2 +0,0 @@
[supervisord]
nodaemon=false

View File

@ -19,12 +19,14 @@ debs/{{ deb }}{{' '}}
## TODO: add kmod into Depends
RUN apt-get install -f kmod
COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"]
COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "syncd.sh", "/usr/bin/"]
RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,15 +1,8 @@
#!/bin/bash
function clean_up {
service syncd stop
service rsyslog stop
exit
}
trap clean_up SIGTERM SIGKILL
#!/usr/bin/env bash
rm -f /var/run/rsyslogd.pid
service rsyslog start
service syncd start
read
supervisorctl start rsyslogd
supervisorctl start syncd

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:syncd]
command=/usr/bin/syncd.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
function clean_up {
service syncd stop
exit
}
trap clean_up SIGTERM SIGKILL
service syncd start
read

View File

@ -0,0 +1,2 @@
sysctl -w net.core.rmem_max=509430500

View File

@ -27,7 +27,6 @@ RUN apt-get update \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
@ -47,10 +46,7 @@ RUN apt-get update \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
COPY ["99-syncd.conf", "/etc/sysctl.d/"]
RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,2 +0,0 @@
[supervisord]
nodaemon=false

View File

@ -18,7 +18,8 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}
COPY ["start.sh", "/usr/bin/"]
COPY ["start.sh", "syncd.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["profile.ini", "/etc/ssw/AS7512/"]
@ -26,5 +27,4 @@ COPY ["profile.ini", "/etc/ssw/AS7512/"]
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,24 +1,8 @@
#!/bin/bash
export XP_ROOT=/usr/bin/
#!/usr/bin/env bash
rm -f /var/run/rsyslogd.pid
service rsyslog start
while true; do
supervisorctl start rsyslogd
# Check if redis-server starts
supervisorctl start syncd
result=$(redis-cli ping)
if [ "$result" == "PONG" ]; then
redis-cli FLUSHALL
syncd -p /etc/ssw/AS7512/profile.ini -N
break
fi
sleep 1
done

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:syncd]
command=/usr/bin/syncd.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
export XP_ROOT=/usr/bin/
while true; do
# Check if redis-server starts
result=$(redis-cli ping)
if [ "$result" == "PONG" ]; then
redis-cli FLUSHALL
syncd -p /etc/ssw/AS7512/profile.ini -N
break
fi
sleep 1
done

View File

@ -0,0 +1,2 @@
sysctl -w net.core.rmem_max=509430500

View File

@ -27,7 +27,6 @@ RUN apt-get update \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
@ -47,10 +46,8 @@ RUN apt-get update \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
COPY ["99-syncd.conf", "/etc/sysctl.d/"]
ENTRYPOINT ["/usr/bin/supervisord"]
RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]

View File

@ -1,2 +0,0 @@
[supervisord]
nodaemon=false

View File

@ -19,11 +19,12 @@ debs/{{ deb }}{{' '}}
## TODO: add kmod into Depends
RUN apt-get install -f kmod
COPY ["start.sh", "/usr/bin/"]
COPY ["start.sh", "syncd.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,15 +1,8 @@
#!/bin/bash
function clean_up {
service syncd stop
service rsyslog stop
exit
}
trap clean_up SIGTERM SIGKILL
#!/usr/bin/env bash
rm -f /var/run/rsyslogd.pid
service rsyslog start
service syncd start
read
supervisorctl start rsyslogd
supervisorctl start syncd

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:syncd]
command=/usr/bin/syncd.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
function clean_up {
service syncd stop
exit
}
trap clean_up SIGTERM SIGKILL
service syncd start
read

View File

@ -0,0 +1,2 @@
sysctl -w net.core.rmem_max=509430500

View File

@ -27,7 +27,6 @@ RUN apt-get update \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
@ -47,10 +46,8 @@ RUN apt-get update \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
COPY ["99-syncd.conf", "/etc/sysctl.d/"]
ENTRYPOINT ["/usr/bin/supervisord"]
RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]

View File

@ -1,2 +0,0 @@
[supervisord]
nodaemon=false

View File

@ -18,13 +18,13 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}
COPY ["start.sh", "/usr/bin/"]
COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"]
COPY ["start.sh", "syncd.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -1,21 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash
function clean_up {
service syncd stop
service rsyslog stop
exit
}
rm -f /var/run/rsyslogd.pid
trap clean_up SIGTERM SIGKILL
supervisorctl start rsyslogd
# fw-upgrade will exit if firmware was actually upgraded or if some error
# occures
. mlnx-fw-upgrade.sh
supervisorctl start syncd
# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up
# Remove rsyslogd.pid file manually so that to start the rsyslog instantly
[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid
service rsyslog start
service syncd start
read

View File

@ -0,0 +1,27 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false ; One-shot
stdout_logfile=syslog
stderr_logfile=syslog
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:syncd]
command=/usr/bin/syncd.sh
priority=3
autostart=false
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
function clean_up {
service syncd stop
exit
}
trap clean_up SIGTERM SIGKILL
# fw-upgrade will exit if firmware was actually upgraded or if some error
# occures
. mlnx-fw-upgrade.sh
# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up
# Remove rsyslogd.pid file manually so that to start the rsyslog instantly
service syncd start
read