core: switch from systemd to supervisord

This commit is contained in:
chandi 2020-05-14 18:59:22 +02:00
parent dd3c33941f
commit d89d146bcd
6 changed files with 71 additions and 37 deletions

View File

@ -6,24 +6,12 @@ services:
restart: unless-stopped
depends_on:
- redis
cap_add:
- SYS_NICE # for realtime scheduling
- SYS_ADMIN # for systemd
environment:
DOMAIN: ${DOMAIN}
EXTERNAL_IP: ${EXTERNAL_IP}
SHARED_SECRET: ${SHARED_SECRET}
WELCOME_FOOTER: ${WELCOME_FOOTER}
container: docker
tmpfs:
- /run
- /run/lock
- /tmp:exec,mode=777
volumes:
- bigbluebutton:/var/bigbluebutton
- /sys/fs/cgroup:/sys/fs/cgroup:ro # for systemd
- ./conf/sip_profiles:/opt/freeswitch/conf/sip_profiles/external
- ./conf/dialplan_public:/opt/freeswitch/conf/dialplan/public_docker
network_mode: host
freeswitch:

View File

@ -10,10 +10,9 @@ ENV DEBIAN_FRONTEND noninteractive
ENV container docker
ENV DOCKERIZE_VERSION v0.6.1
RUN apt-get update && apt-get install -y software-properties-common language-pack-en wget
RUN apt-get update && apt-get install -y software-properties-common language-pack-en wget apt-utils
RUN update-locale LANG=en_US.UTF-8
RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:rmescandon/yq
RUN apt-get install -y --no-install-recommends apt-utils
# install dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
@ -24,7 +23,7 @@ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSI
# RUN apt-get install -y tcpdump telnet htop vim
# -- Install Dependencies
RUN apt-get install -y systemd apt-transport-https equivs libreoffice haveged ttf-liberation net-tools
RUN apt-get install -y supervisor apt-transport-https equivs libreoffice haveged ttf-liberation net-tools
# bbb repo & packages
RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:bigbluebutton/support
@ -38,9 +37,6 @@ RUN equivs-control redis-server.control \
&& dpkg -i /*.deb \
&& rm /*.deb
# -- create dummy service to avoid start up errors
COPY dummy.service /etc/systemd/system/redis-server.service
RUN apt-get update && apt-get install -y bbb-web \
bbb-fsesl-akka bbb-apps-akka bbb-transcode-akka bbb-apps \
bbb-apps-video bbb-apps-screenshare bbb-apps-video-broadcast
@ -49,16 +45,9 @@ RUN apt-get update && apt-get install -y bbb-web \
# https://github.com/bigbluebutton/bigbluebutton/issues/8959
RUN sed -i 's|securerandom.source=file:/dev/random|securerandom.source=file:/dev/urandom|g' /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security
# -- Disable unneeded services
RUN find /etc/systemd/ | grep wants | xargs -r -n 1 basename | grep service | grep -v networking | grep -v tty | xargs -r -n 1 -I __ systemctl disable __
RUN systemctl disable systemd-journal-flush systemd-update-utmp.service
RUN systemctl enable red5 bbb-apps-akka bbb-transcode-akka bbb-fsesl-akka bbb-web # bbb-rap-caption-inbox
# -- fix directory permissions
RUN chown bigbluebutton:bigbluebutton /var/bigbluebutton
COPY entrypoint.sh /entrypoint.sh
# -- copy configuration files
COPY red5.properties /usr/share/red5/conf/red5.properties
COPY bigbluebutton.properties /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
@ -70,6 +59,12 @@ COPY bbb-apps-akka/application.conf /usr/share/bbb-apps-akka/conf/application.co
COPY bbb-fsesl-akka/application.conf /etc/bbb-fsesl-akka/application.conf
COPY web-run.sh /usr/share/bbb-web/run-prod.sh
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY entrypoint.sh /entrypoint.sh
COPY prefix-log /usr/local/bin/prefix-log
RUN mkdir -p /var/log/supervisor
ENTRYPOINT ["/entrypoint.sh"]
CMD []

View File

@ -1,9 +0,0 @@
[Unit]
Description=dummy
[Service]
ExecStart=/bin/sleep 30d
ExecReload=/bin/echo reload
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,5 @@
#!/bin/bash
# print logs to stdout/stderr as soon as systemd is started
sh -c 'sleep 5 && journalctl -f' &
# generate bbb folders
mkdir -p /var/bigbluebutton/recording/raw
@ -19,4 +17,4 @@ mkdir -p /var/bigbluebutton/unpublished
dockerize \
-template /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties.tmpl:/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties \
-template /usr/share/bbb-apps-akka/conf/application.conf.tmpl:/usr/share/bbb-apps-akka/conf/application.conf \
/bin/systemd --system --unit=multi-user.target
/usr/bin/supervisord --nodaemon

16
mod/core/prefix-log Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# setup fd-3 to point to the original stdout
exec 3>&1
# setup fd-4 to point to the original stderr
exec 4>&2
# get the prefix from SUPERVISOR_PROCESS_NAME environement variable
printf -v PREFIX "%-14.14s" ${SUPERVISOR_PROCESS_NAME}
# reassign stdout and stderr to a preprocessed and redirected to the original stdout/stderr (3 and 4) we have create eralier
exec 1> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&3)
exec 2> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&4)
# from here on everthing that outputs to stdout/stderr will be go through the perl script
exec "$@"

46
mod/core/supervisord.conf Normal file
View File

@ -0,0 +1,46 @@
[program:red5]
command=/usr/local/bin/prefix-log /usr/share/red5/red5.sh
user=red5
directory=/usr/share/red5
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
[program:bbb-web]
command=/usr/local/bin/prefix-log /usr/share/bbb-web/run-prod.sh
user=bigbluebutton
directory=/usr/share/bbb-web
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
[program:bbb-apps-akka]
command=/usr/local/bin/prefix-log /usr/share/bbb-apps-akka/bin/bbb-apps-akka
user=bigbluebutton
directory=/usr/share/bbb-apps-akka
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
[program:bbb-fsesl-akka]
command=/usr/local/bin/prefix-log /usr/share/bbb-fsesl-akka/bin/bbb-fsesl-akka
user=bigbluebutton
directory=/usr/share/bbb-fsesl-akka
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
[program:bbb-transcode-akka]
command=/usr/local/bin/prefix-log /usr/share/bbb-transcode-akka/bin/bbb-transcode-akka
user=bigbluebutton
directory=/usr/share/bbb-transcode-akka
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0