diff --git a/.env b/.env index 538f90b..8771cb1 100644 --- a/.env +++ b/.env @@ -17,7 +17,7 @@ IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}" IMG_ID="server-mga9" IMG_NAME="Rx3 Server Mageia-9 Docker Image" -IMG_VERSION="1.0.0" +IMG_VERSION="1.1.0" IMG_URL="${IMG_URL_PREFIX}/${IMG_ID}:${IMG_VERSION}" IMG_MAINTAINER='"Arnaud G. GIBERT" ' diff --git a/Dockerfile b/Dockerfile index 7a720e6..d660b4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,5 +16,68 @@ LABEL org.rx3.${IMG_ID}.maintainer=${IMG_MAINTAINER} LABEL maintainer=${IMG_MAINTAINER} + +#--------------------------------------------------------------------------------------------------- +ARG INIT_SHELL='#!/bin/bash \n\ + \n\ +function log() { echo "$(date --rfc-3339=ns) Init: $*" | tee -a /var/log/init.log; } \n\ + \n\ +log "Starting" \n\ + \n\ +for pgm in /etc/rcD.d/* \n\ +do \n\ + if [[ -r ${pgm} ]] \n\ + then \n\ + if [[ ${pgm##*/} == S99* ]] \n\ + then \n\ + log "Executing: [${pgm##*/}]" \n\ + log "Completed" \n\ + exec ${pgm} \n\ + else \n\ + log "Calling: [${pgm##*/}]" \n\ + ${pgm} \n\ + fi \n\ + fi \n\ +done' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +ARG SUPERVISORD_INI='[inet_http_server] \n\ +port=*:9001 \n\ + \n\ +[supervisord] \n\ +nodaemon=true \n\ +user=root' +#--------------------------------------------------------------------------------------------------- + + +#--------------------------------------------------------------------------------------------------- +ARG CROND_INI='[program:crond] \n\ +command=crond -n' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +ARG SUPERVISORD='#!/bin/bash \n\ + \n\ +exec supervisord -c /etc/supervisord.conf' +#--------------------------------------------------------------------------------------------------- + + + +RUN urpmi --force supervisor \ + && echo -e "${INIT_SHELL}" | sed -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 \ + && echo -e "${SUPERVISORD_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/supervisord.ini \ + && echo -e "${CROND_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/crond.ini \ + && echo -e "${SUPERVISORD}" | sed -e 's/ *$//' > /etc/init.d/supervisord \ + && chmod a+x /etc/init.d/supervisord \ + && ln -s /etc/init.d/supervisord /etc/rcD.d/S99supervisord + + +EXPOSE 9001 + CMD [] -ENTRYPOINT ["sleep", "60m"] +ENTRYPOINT ["init.sh"] + diff --git a/ReadMe.txt b/ReadMe.txt index 9540ccf..f29b6cf 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -6,7 +6,9 @@ This is project aims to build a Mageia-9 server docker image to be used by other Features: - Curtently based on rx3/base-mga9:1.2.2 image, - - ... + - Init script calling in order sub scripts in /etc/init.d & /etc/rcD.d, + - supervisord managing services, + - crond & logrotate configured. Enjoy it! diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 0a7accf..18aad58 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,5 +1,15 @@ ------------------------------------------------------------------------------------------------------------------------------------ -Server-Mga9 V 1.0.0 - A. GIBERT - 2024/08/25 +Rx3/Server-Mga9 V 1.1.0 - A. GIBERT - 2024/08/26 +------------------------------------------------------------------------------------------------------------------------------------ + +- Add & setup supervisord, +- Add init.sh script calling in order sub scripts in /etc/init.d & /etc/rcD.d, +- Configure crond & logrotate. + + + +------------------------------------------------------------------------------------------------------------------------------------ +Rx3/Server-Mga9 V 1.0.0 - A. GIBERT - 2024/08/25 ------------------------------------------------------------------------------------------------------------------------------------ - Initial release, diff --git a/compose.yaml b/compose.yaml index 81f1a75..07055de 100644 --- a/compose.yaml +++ b/compose.yaml @@ -20,3 +20,6 @@ services: - IMG_URL_PREFIX=${IMG_URL_PREFIX} restart: unless-stopped + + ports: + - "127.0.0.1:9010:9001"