- Use now rx3-docker/base:1.3.3-mga9 image,
- Add dnsmasq to perform optional DNS forwarding, - Add "urpmi.update -a" to force mirror sync.
This commit is contained in:
parent
c924a727e4
commit
373a9488f1
174
Dockerfile
174
Dockerfile
@ -23,76 +23,130 @@ 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 '${SERVER_LOG_INIT_FILE}'; } \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\
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG INIT_SHELL='#!/bin/bash \n\
|
||||
\n\
|
||||
function log() { echo "$(date --rfc-3339=ns) Init: $*" | tee -a '${SERVER_LOG_INIT_FILE}'; } \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='#!/bin/bash \n\
|
||||
\n\
|
||||
exec supervisord -c /etc/supervisord.conf'
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
ARG CROND='#!/bin/bash \n\
|
||||
\n\
|
||||
if [[ "${SERVER_CROND_ENABLED}" != "TRUE" ]] \n\
|
||||
then \n\
|
||||
mv /etc/supervisord.d/crond.ini /etc/supervisord.d/crond.ini.disabled \n\
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG DNSMASQ='#!/bin/bash \n\
|
||||
\n\
|
||||
if [[ "${SERVER_DNS_ENABLED}" != "TRUE" ]] \n\
|
||||
then \n\
|
||||
mv /etc/supervisord.d/dnsmasq.ini /etc/supervisord.d/dnsmasq.ini.disabled \n\
|
||||
else \n\
|
||||
echo "" >> /etc/dnsmasq.conf \n\
|
||||
echo "# Listen local address" >> /etc/dnsmasq.conf \n\
|
||||
echo "interface=lo" >> /etc/dnsmasq.conf \n\
|
||||
echo "bind-interfaces" >> /etc/dnsmasq.conf \n\
|
||||
echo "" >> /etc/dnsmasq.conf \n\
|
||||
echo "port=53 # DNS only" >> /etc/dnsmasq.conf \n\
|
||||
echo "no-dhcp-interface= # disables DHCPv4" >> /etc/dnsmasq.conf \n\
|
||||
echo "" >> /etc/dnsmasq.conf \n\
|
||||
echo "# Forward local domains" >> /etc/dnsmasq.conf \n\
|
||||
\n\
|
||||
for map in ${SERVER_DNS_MAP} \n\
|
||||
do \n\
|
||||
OIFS=$IFS \n\
|
||||
IFS=":" \n\
|
||||
set ${map} \n\
|
||||
IFS=$OIFS \n\
|
||||
\n\
|
||||
domain="$1" \n\
|
||||
server="$2" \n\
|
||||
\n\
|
||||
echo "server=/${domain}/${server}" >> /etc/dnsmasq.conf \n\
|
||||
done \n\
|
||||
\n\
|
||||
echo "" >> /etc/dnsmasq.conf \n\
|
||||
echo "# Forward all other queries to default server" >> /etc/dnsmasq.conf \n\
|
||||
echo "server=${SERVER_DNS_DEFAULT}" >> /etc/dnsmasq.conf \n\
|
||||
\n\
|
||||
cp /etc/resolv.conf /etc/resolv.conf.old \n\
|
||||
\n\
|
||||
echo "# Generated by DNSMasq init script" > /etc/resolv.conf \n\
|
||||
echo "" >> /etc/resolv.conf \n\
|
||||
echo "nameserver 127.0.0.1" >> /etc/resolv.conf \n\
|
||||
echo "search ${SERVER_DNS_SEARCH}" >> /etc/resolv.conf \n\
|
||||
\n\
|
||||
fi'
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
ARG SUPERVISORD_INI='[inet_http_server] \n\
|
||||
port=*:'${SERVER_PORT_SV_INT}' \n\
|
||||
\n\
|
||||
[supervisord] \n\
|
||||
nodaemon=true \n\
|
||||
childlogdir='${SERVER_LOG_SV_DIR}' \n\
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG SUPERVISORD='#!/bin/bash \n\
|
||||
\n\
|
||||
exec supervisord -c /etc/supervisord.conf'
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG CROND='#!/bin/bash \n\
|
||||
\n\
|
||||
if [[ "${SERVER_CROND_ENABLED}" != "TRUE" ]] \n\
|
||||
then \n\
|
||||
mv /etc/supervisord.d/crond.ini /etc/supervisord.d/crond.ini.disabled \n\
|
||||
fi'
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG SUPERVISORD_INI='[inet_http_server] \n\
|
||||
port=*:'${SERVER_PORT_SV_INT}' \n\
|
||||
\n\
|
||||
[supervisord] \n\
|
||||
nodaemon=true \n\
|
||||
childlogdir='${SERVER_LOG_SV_DIR}' \n\
|
||||
user=root'
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
ARG CROND_INI='[program:crond] \n\
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG CROND_INI='[program:crond] \n\
|
||||
command=crond -n'
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
ARG DNSMASQ_INI='[program:dnsmasq] \n\
|
||||
command=dnsmasq -k'
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
RUN urpmi --force supervisor \
|
||||
&& 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 \
|
||||
&& chmod a+x /etc/init.d/supervisord \
|
||||
&& ln -s /etc/init.d/crond /etc/rcD.d/S60crond \
|
||||
&& 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
|
||||
RUN urpmi.update -a \
|
||||
&& urpmi --force dnsmasq myip supervisor \
|
||||
&& 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 "${DNSMASQ}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/dnsmasq \
|
||||
&& echo -e "${SUPERVISORD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/supervisord \
|
||||
&& chmod a+x /etc/init.d/crond \
|
||||
&& chmod a+x /etc/init.d/dnsmasq \
|
||||
&& chmod a+x /etc/init.d/supervisord \
|
||||
&& ln -s /etc/init.d/crond /etc/rcD.d/S60crond \
|
||||
&& ln -s /etc/init.d/dnsmasq /etc/rcD.d/S65dnsmasq \
|
||||
&& 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 "${DNSMASQ_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/dnsmasq.ini \
|
||||
&& echo -e "${SUPERVISORD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/supervisord.ini
|
||||
|
||||
|
||||
VOLUME ${SERVER_LOG_INIT_DIR}
|
||||
|
@ -5,10 +5,11 @@ Welcome to Rx3-Docker/Server docker image!
|
||||
This project aims to build a Mageia server docker image to be used by other Rx3 packaging projects.
|
||||
|
||||
Features:
|
||||
- Curtently based on rx3-docker/base:1.3.2-mga9 image,
|
||||
- Curtently based on rx3-docker/base:1.3.3-mga9 image,
|
||||
- Init script calling in order sub scripts in /etc/init.d & /etc/rcD.d,
|
||||
- supervisord managing services,
|
||||
- crond & logrotate configured & crond disabled by default,
|
||||
- DNS forwarding support with dnsmasq, disabled by default,
|
||||
- Export init & supivisor log directories as volume.
|
||||
|
||||
|
||||
|
@ -1,8 +1,19 @@
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Docker/Server V 1.2.3 - A. GIBERT - 2025/05/28
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Use now rx3-docker/base:1.3.3-mga9 image,
|
||||
- Add dnsmasq to perform optional DNS forwarding,
|
||||
- Add "urpmi.update -a" to force mirror sync.
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Docker/Server V 1.2.2 - A. GIBERT - 2025/04/13
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Use now rx3-docker/base:1.3.2-mga9 image.
|
||||
- Use now rx3-docker/base:1.3.2-mga9 image,
|
||||
- Add "urpmi.update -a" to force mirror sync.
|
||||
|
||||
|
||||
|
||||
|
@ -23,11 +23,15 @@ services:
|
||||
SERVER_LOG_INIT_DIR: ${SERVER_LOG_INIT_DIR}
|
||||
SERVER_LOG_SV_DIR: ${SERVER_LOG_SV_DIR}
|
||||
SERVER_PORT_SV_INT: ${SERVER_PORT_SV_INT}
|
||||
|
||||
|
||||
restart: unless-stopped
|
||||
|
||||
environment:
|
||||
SERVER_CROND_ENABLED: ${SERVER_CROND_ENABLED}
|
||||
SERVER_DNS_ENABLED: ${SERVER_DNS_ENABLED}
|
||||
SERVER_DNS_DEFAULT: ${SERVER_DNS_DEFAULT}
|
||||
SERVER_DNS_MAP: ${SERVER_DNS_MAP}
|
||||
SERVER_DNS_SEARCH: ${SERVER_DNS_SEARCH}
|
||||
|
||||
volumes:
|
||||
- ./var/log/init:${SERVER_LOG_INIT_DIR}
|
||||
|
9
env.dist
9
env.dist
@ -18,13 +18,13 @@ ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
|
||||
|
||||
IMG_NAME="server"
|
||||
IMG_NAME_FULL="Rx3-Docker/Server Docker Image"
|
||||
IMG_VERSION="1.2.2-mga9"
|
||||
IMG_VERSION="1.2.3-mga9"
|
||||
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
|
||||
|
||||
IMG_URL_PREFIX="${ORG_URL_PREFIX}"
|
||||
IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}"
|
||||
|
||||
IMG_FROM_URL="${ORG_URL_PREFIX}/base:1.3.2-mga9"
|
||||
IMG_FROM_URL="${ORG_URL_PREFIX}/base:1.3.3-mga9"
|
||||
|
||||
|
||||
|
||||
@ -44,3 +44,8 @@ SERVER_LOG_INIT_DIR="/var/log/init"
|
||||
SERVER_LOG_SV_DIR="/var/log/supervisor"
|
||||
|
||||
SERVER_CROND_ENABLED="FALSE"
|
||||
|
||||
SERVER_DNS_ENABLED="FALSE"
|
||||
SERVER_DNS_DEFAULT="1.1.1.1"
|
||||
SERVER_DNS_MAP="rx3:10.0.0.1 10.in-addr.arpa:10.0.0.1 168.192.in-addr.arpa:10.0.0.1"
|
||||
SERVER_DNS_SEARCH="xor.rx3 and.rx3 not.rx3 mob.rx3 fix.rx3 rx3 rx3.net"
|
||||
|
Loading…
Reference in New Issue
Block a user