Added supervisor/logrotate and startup dirs use symlinks

This commit is contained in:
Deon George 2019-08-14 20:56:48 +10:00
parent 7ac241d5bc
commit 6986bc92d8
4 changed files with 33 additions and 9 deletions

View File

@ -5,11 +5,14 @@ FROM debian:stretch-slim
# Base utilities
RUN apt-get update \
&& apt-get install -yqq curl procps less zip unzip arj unrar-free lhasa arc zoo logrotate libmozjs185-1.0 cron \
&& apt-get install -yqq curl supervisor procps less zip unzip arj unrar-free lhasa arc zoo logrotate libmozjs185-1.0 cron \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set the default timezone for the container
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
# Add in Leenooks' apt repository
RUN curl -s http://apt.leenooks.net/setup.sh | sh
@ -39,6 +42,7 @@ RUN apt-get update \
&& make RELEASE=1 USE_DOSEMU=1 NO_X=1 JSINCLUDE=/usr/include/js JSLIB=mozjs185 SBBSDIR=/opt/sbbs install \
&& rm -rf /opt/sbbs/3rdp /opt/sbbs/src \
&& mv /opt/sbbs/ctrl /opt/sbbs/ctrl.orig \
&& mv /opt/sbbs/text /opt/sbbs/text.orig \
&& mkdir /opt/sbbs/nodes.orig && mv /opt/sbbs/node[1-4] /opt/sbbs/nodes.orig \
&& ln -sf nodes/node1 /opt/sbbs/ \
&& ln -sf nodes/node2 /opt/sbbs/ \
@ -55,12 +59,12 @@ ENV SBBSCTRL=/opt/sbbs/ctrl
ENV SBBSEXEC=/opt/sbbs/exec
ENV PATH=$PATH:${SBBSEXEC}
VOLUME [ "/var/lib/zerotier-one" ]
VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido","/opt/sbbs/text" ]
COPY logrotate.d /etc/logrotate.d/
COPY supervisord.d /etc/supervisor/conf.d/
COPY init /sbin/init
ENTRYPOINT [ "/sbin/init" ]
CMD ["sbbs"]
VOLUME [ "/var/lib/zerotier-one" ]
VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido" ]
# Set the default timezone for the container
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

12
init
View File

@ -7,12 +7,17 @@ export PATH=$PATH:${SBBSEXEC}
if [ ! -e "${SBBSCTRL}/sbbs.ini" ]; then
echo "* Installing SBBS ctrl files into ${SBBSCTRL}"
cp -a ${SBBSCTRL}.orig/* ${SBBSCTRL}
cp -Ras ${SBBSCTRL}.orig/* ${SBBSCTRL}
fi
if [ ! -d "${SBBSCTRL}/../nodes/node1" ]; then
echo "* Installing SBBS nodes files into ${SBBSCTRL}/../nodes"
cp -Ra ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/
cp -Ras ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/
fi
if [ ! -e "${SBBSCTRL}/../text/answer.msg" ]; then
echo "* Installing SBBS text files into ${SBBSCTRL}/../text"
cp -Ras ${SBBSCTRL}/../text.orig/* ${SBBSCTRL}/../text/
fi
if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then
@ -21,4 +26,7 @@ if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then
/usr/sbin/zerotier-one -d
fi
# Start Supervisord
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
exec "$@"

10
logrotate.d/sbbsecho Normal file
View File

@ -0,0 +1,10 @@
/opt/sbbs/data/*.log {
daily
compress
rotate 31
dateext
olddir /opt/sbbs/data/old
missingok
createolddir 775 root root
notifempty
}

2
supervisord.d/cron.conf Normal file
View File

@ -0,0 +1,2 @@
[program:cron]
command=/usr/sbin/cron -f