- Move all supervisor logs from /tmp to /var/log/supivisor,

- Add /var/log/init & var/log/supervisor volumes.
This commit is contained in:
2024-11-11 22:56:40 +01:00
parent 28e24b2bd9
commit 1ac4e60906
7 changed files with 53 additions and 25 deletions

View File

@@ -1,27 +1,32 @@
# Rx3-Docker/Server Docker Image
#-------------------------------------------------------------------------------
ARG IMG_FROM_URL="rx3-docker/base:latest"
FROM ${IMG_FROM_URL}
ARG IMG_NAME
ARG IMG_NAME_FULL
ARG IMG_VERSION
ARG IMG_MAINTAINER
ARG IMG_FROM_URL
ARG SERVER_PORT_SV_INT
FROM ${IMG_FROM_URL}
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
ARG SERVER_LOG_INIT_DIR
ARG SERVER_LOG_SV_DIR
ARG SERVER_PORT_SV_INT
ARG SERVER_LOG_INIT_FILE=${SERVER_LOG_INIT_DIR}/init.log
#---------------------------------------------------------------------------------------------------
ARG INIT_SHELL='#!/bin/bash \n\
\n\
function log() { echo "$(date --rfc-3339=ns) Init: $*" | tee -a /var/log/init.log; } \n\
function log() { echo "$(date --rfc-3339=ns) Init: $*" | tee -a '${SERVER_LOG_INIT_FILE}'; } \n\
\n\
log "Starting" \n\
\n\
@@ -59,10 +64,11 @@ fi'
#---------------------------------------------------------------------------------------------------
ARG SUPERVISORD_INI='[inet_http_server] \n\
port=*:9001 \n\
port=*:'${SERVER_PORT_SV_INT}' \n\
\n\
[supervisord] \n\
nodaemon=true \n\
childlogdir='${SERVER_LOG_SV_DIR}' \n\
user=root'
#---------------------------------------------------------------------------------------------------
@@ -74,10 +80,11 @@ command=crond -n'
RUN urpmi --force supervisor \
&& echo -e "${INIT_SHELL}" | sed -e 's/ *$//' >/usr/local/sbin/init.sh \
&& echo -e "${INIT_SHELL}" | sed -e "s/\`/'/g" -e 's/ *$//' > /usr/local/sbin/init.sh \
&& chmod a+x /usr/local/sbin/init.sh \
&& mkdir /etc/rc.d/rcD.d \
&& ln -s /etc/rc.d/rcD.d /etc \
&& mkdir "${SERVER_LOG_INIT_DIR}" \
&& echo -e "${CROND}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/crond \
&& echo -e "${SUPERVISORD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/supervisord \
&& chmod a+x /etc/init.d/crond \
@@ -86,7 +93,10 @@ RUN urpmi --force supervisor
&& ln -s /etc/init.d/supervisord /etc/rcD.d/S99supervisord \
&& echo -e "${CROND_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/crond.ini \
&& echo -e "${SUPERVISORD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/supervisord.ini
VOLUME ${SERVER_LOG_INIT_DIR}
VOLUME ${SERVER_LOG_SV_DIR}
EXPOSE ${SERVER_PORT_SV_INT}