From dca8a2771923f1d26031fef55147c1c4c1cf39a9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 31 Mar 2020 15:00:48 -0700 Subject: [PATCH] [docker-syncd-vs]: add support for vs syncd docker auto restart (#4344) Signed-off-by: Guohan Lu --- platform/vs/docker-syncd-vs/Dockerfile.j2 | 2 ++ platform/vs/docker-syncd-vs/critical_processes | 1 + platform/vs/docker-syncd-vs/supervisord.conf | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 platform/vs/docker-syncd-vs/critical_processes diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index 070d8b984f4b..25d82499edf1 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -24,6 +24,8 @@ debs/{{ deb }}{{' '}} COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["critical_processes", "/etc/supervisor/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/vs/docker-syncd-vs/critical_processes b/platform/vs/docker-syncd-vs/critical_processes new file mode 100644 index 000000000000..6082f242b872 --- /dev/null +++ b/platform/vs/docker-syncd-vs/critical_processes @@ -0,0 +1 @@ +syncd diff --git a/platform/vs/docker-syncd-vs/supervisord.conf b/platform/vs/docker-syncd-vs/supervisord.conf index 1af5d70a1d0c..0c6285d46ae0 100644 --- a/platform/vs/docker-syncd-vs/supervisord.conf +++ b/platform/vs/docker-syncd-vs/supervisord.conf @@ -3,6 +3,12 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name syncd +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected + [program:start.sh] command=/usr/bin/start.sh priority=1 @@ -15,7 +21,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false -autorestart=false +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog