- Move & Rename repo from Rx3/Ampache-MGA9 to Rx3-Docker/Ampache,

- New version naming standard,
- Now use docker_tools for .env building,
- Now use rx3-docker/php-apache:1.4.0-mga9 & rx3-docker/mariadb-1.1.0-mga9 images,
- Add /var/log/init*, /var/log/supervisor* volumes,
- Fix crontab: user ampache user instead of root and add it to git,
- Fix database restart in compose file,
- Add database healthcheck & webapp service depencies.
This commit is contained in:
Arnaud G. GIBERT 2024-12-02 16:51:20 +01:00
parent 5c3076ba6f
commit aa2c81cca9
19 changed files with 170 additions and 106 deletions

View File

@ -1,24 +1,24 @@
# # Rx3-Docker/Ampache Dockerfile
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ARG IMG_URL_PREFIX="rx3" ARG IMG_FROM_URL="rx3-docker/php-apache:latest"
FROM ${IMG_URL_PREFIX}/php-apache-mga9:1.3.3 FROM ${IMG_FROM_URL}
ARG IMG_NAME ARG IMG_NAME
ARG IMG_FULL_NAME ARG IMG_NAME_FULL
ARG IMG_VERSION ARG IMG_VERSION
ARG IMG_MAINTAINER ARG IMG_MAINTAINER
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 AMPACHE_VERSION=6.6.0 ARG AMPACHE_VERSION=6.6.0
ENV DISABLE_INOTIFYWAIT_CLEAN=0 ENV DISABLE_INOTIFYWAIT_CLEAN=0
LABEL org.rx3.${IMG_NAME}.name=${IMG_FULL_NAME}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
@ -61,5 +61,3 @@ VOLUME ["/var/www/html/config"]
VOLUME ["/var/log/ampache"] VOLUME ["/var/log/ampache"]
VOLUME ["/media"] VOLUME ["/media"]
EXPOSE 80

View File

@ -1,11 +1,12 @@
Welcome to Rx3/Ampache-Mga9 docker image! Welcome to Rx3-Docker/Ampache docker image!
This is project aims to build a Ampache + Mageia 9 docker image. This is project aims to build an Ampache docker image.
Features: Features:
- Based on rx3/php-apache-mga9:1.3.3 & rx3/mariadb-mga9:1.0.2 images, - Using Ampache V 6.6.0,
- Based on rx3-docker/php-apache:1.4.0-mga9 & rx3-docker/mariadb:1.1.0 images,
- Support mysql & external pwauth authentication. - Support mysql & external pwauth authentication.

View File

@ -1,7 +1,12 @@
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Rx3/Ampache-Mga9 V 1.2.3 - A. GIBERT - 2024/10/xx Rx3-Docker/Ampache V 1.3.0 - A. GIBERT - 2024/12/02
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Move & Rename repo from Rx3/Ampache-MGA9 to Rx3-Docker/Ampache,
- New version naming standard,
- Now use docker_tools for .env building,
- Now use rx3-docker/php-apache:1.4.0-mga9 & rx3-docker/mariadb-1.1.0-mga9 images,
- Add /var/log/init*, /var/log/supervisor* volumes,
- Fix crontab: user ampache user instead of root and add it to git, - Fix crontab: user ampache user instead of root and add it to git,
- Fix database restart in compose file, - Fix database restart in compose file,
- Add database healthcheck & webapp service depencies. - Add database healthcheck & webapp service depencies.

View File

@ -1,73 +1,82 @@
# Rx3 Ampache Mageia-9 Docker Image # Rx3-Docker/Ampache Docker Image
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
name: ${APPL_NAME} name: ${HOST_NAME_PREFIX}
services: services:
database: database:
container_name: ${DATABASE_CONT_NAME} container_name: ${DB_HOST_NAME}
hostname: ${DB_HOST_NAME}
image: ${DATABASE_IMG} image: ${DB_IMG_URL}
restart: unless-stopped restart: unless-stopped
environment: environment:
MARIADB_UID: ${MARIADB_UID} MARIADB_UID: ${DB_USER_ID}
MARIADB_GID: ${MARIADB_GID} MARIADB_GID: ${DB_GROUP_ID}
MARIADB_ROOT_HOST: ${MARIADB_ROOT_HOST} MARIADB_ROOT_HOST: ${DB_ROOT_HOST}
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD} MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MARIADB_DATABASE: ${MARIADB_DATABASE} MARIADB_DATABASE: ${DB_DB_NAME}
MARIADB_USER: ${MARIADB_USER} MARIADB_USER: ${DB_DB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD} MARIADB_PASSWORD: ${DB_DB_PASSWORD}
healthcheck: healthcheck:
test: ["CMD", 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p${MARIADB_ROOT_PASSWORD}' ] test: ["CMD", 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p${DB_ROOT_PASSWORD}' ]
interval: 10s interval: 10s
timeout: 3s timeout: 3s
retries: 3 retries: 3
volumes: volumes:
- ./var/lib/mysql:/var/lib/mysql - ./${DB_LIB_EXT}:${DB_LIB_INT}
- ./${DB_LOG_INIT_EXT}:${DB_LOG_INIT_INT}
- ./${DB_LOG_SV_EXT}:${DB_LOG_SV_INT}
- ./${DB_LOG_MAIN_EXT}:${DB_LOG_MAIN_INT}
networks: networks:
- appl - appl
ports: ports:
- "127.0.0.1:${DATABASE_SV_PORT}:9001" - "127.0.0.1:${DB_PORT_SV_EXT}:${DB_PORT_SV_INT}"
- "127.0.0.1:${DATABASE_PORT}:3306" - "127.0.0.1:${DB_PORT_MAIN_EXT}:${DB_PORT_MAIN_INT}"
webapp-internal: webapp-internal:
container_name: ${WEBAPP_INT_CONT_NAME} container_name: ${WAI_HOST_NAME}
hostname: ${WAI_HOST_NAME}
image: ${WEBAPP_IMG} image: ${WAI_IMG_URL}
build: build:
context: . context: .
args: args:
- IMG_NAME=${APPL_NAME} IMG_NAME: ${WAI_IMG_URL}
- IMG_FULL_NAME=${APPL_FULL_NAME} IMG_NAME_FULL: ${WAI_IMG_NAME_FULL}
- IMG_VERSION=${APPL_VERSION} IMG_VERSION: ${WAI_IMG_VERSION}
- IMG_MAINTAINER=${APPL_MAINTAINER} IMG_MAINTAINER: ${APPL_MAINTAINER}
- IMG_URL_PREFIX=${APPL_URL_PREFIX} IMG_FROM_URL: ${WAI_IMG_FROM_URL}
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
database: database:
condition: service_healthy condition: service_healthy
environment: environment:
APACHE_UID: ${APACHE_UID} APACHE_UID: ${WAI_USER_ID}
APACHE_GID: ${APACHE_GID} APACHE_GID: ${WAI_GROUP_ID}
APACHE_DOC_ROOT: ${APACHE_DOC_ROOT} APACHE_DOC_ROOT: ${APACHE_DOC_ROOT}
volumes: volumes:
- ./etc/ampache-internal:/var/www/config - ./${WAI_LOG_INIT_EXT}:${WAI_LOG_INIT_INT}
- ./var/log/ampache-internal:/var/log/ampache - ./${WAI_LOG_SV_EXT}:${WAI_LOG_SV_INT}
- ./${WAI_LOG_MAIN_EXT}:${WAI_LOG_MAIN_INT}
- ./etc/ampache-webapp-internal:/var/www/config
- ./etc/cron.d/ampache:/etc/cron.d/ampache:ro - ./etc/cron.d/ampache:/etc/cron.d/ampache:ro
- /etc/passwd:/etc/passwd:ro - /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro - /etc/group:/etc/group:ro
- /etc/shadow:/etc/shadow:ro - /etc/shadow:/etc/shadow:ro
- ${MUSIC_REPO}:/media/music - ${MUSIC_REPO}:/media/music
- ${VIDEO_REPO}:/media/video - ${VIDEO_REPO}:/media/video
@ -75,30 +84,35 @@ services:
- appl - appl
ports: ports:
- "127.0.0.1:${WEBAPP_INT_SV_PORT}:9001" - "127.0.0.1:${WAI_PORT_SV_EXT}:${WAI_PORT_SV_INT}"
- "127.0.0.1:${WEBAPP_INT_PORT}:80" - "127.0.0.1:${WAI_PORT_MAIN_EXT}:${WAI_PORT_MAIN_INT}"
webapp-external: webapp-external:
container_name: ${WEBAPP_EXT_CONT_NAME} container_name: ${WAE_HOST_NAME}
hostname: ${WAE_HOST_NAME}
image: ${WEBAPP_IMG}
restart: unless-stopped image: ${WAE_IMG_URL}
restart: unless-stopped
depends_on: depends_on:
database: database:
condition: service_healthy condition: service_healthy
environment: environment:
APACHE_UID: ${APACHE_UID} APACHE_UID: ${WAE_USER_ID}
APACHE_GID: ${APACHE_GID} APACHE_GID: ${WAE_GROUP_ID}
APACHE_DOC_ROOT: ${APACHE_DOC_ROOT} APACHE_DOC_ROOT: ${APACHE_DOC_ROOT}
volumes: volumes:
- ./etc/ampache-external:/var/www/config - ./${WAE_LOG_INIT_EXT}:${WAE_LOG_INIT_INT}
- ./var/log/ampache-external:/var/log/ampache - ./${WAE_LOG_SV_EXT}:${WAE_LOG_SV_INT}
- ./${WAE_LOG_MAIN_EXT}:${WAE_LOG_MAIN_INT}
- ./etc/ampache-webapp-external:/var/www/config
- /etc/passwd:/etc/passwd:ro - /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro - /etc/group:/etc/group:ro
- ${MUSIC_REPO}:/media/music - ${MUSIC_REPO}:/media/music
- ${VIDEO_REPO}:/media/video - ${VIDEO_REPO}:/media/video
@ -106,16 +120,16 @@ services:
- appl - appl
ports: ports:
- "127.0.0.1:${WEBAPP_EXT_SV_PORT}:9001" - "127.0.0.1:${WAE_PORT_SV_EXT}:${WAE_PORT_SV_INT}"
- "127.0.0.1:${WEBAPP_EXT_PORT}:80" - "127.0.0.1:${WAE_PORT_MAIN_EXT}:${WAE_PORT_MAIN_INT}"
networks: networks:
appl: appl:
name: ${NETWORK_NAME} name: ${NETWORK_NAME}
driver: bridge driver: bridge
driver_opts: driver_opts:
com.docker.network.bridge.name: ${NETWORK_IF_NAME} com.docker.network.bridge.name: ${NETWORK_IF_NAME}
ipam: ipam:
config: config:
- subnet: 10.2.33.0/24 - subnet: 10.2.33.0/24
gateway: 10.2.33.254 gateway: 10.2.33.254

View File

@ -5,9 +5,10 @@
# Global Settings # Global Settings
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
APPL_ORG="rx3" ORG_NAME="rx3-docker"
APPL_REGISTRY="docker.xor.rx3:5000" ORG_REGISTRY="docker.xor.rx3:5000"
APPL_URL_PREFIX="${APPL_REGISTRY}/${APPL_ORG}"
ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
@ -15,11 +16,11 @@ APPL_URL_PREFIX="${APPL_REGISTRY}/${APPL_ORG}"
# Image Settings # Image Settings
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
APPL_NAME="ampache-mga9" APPL_NAME="ampache"
APPL_FULL_NAME="Rx3 Ampache Mageia-9 Docker Image" APPL_NAME_FULL="Ampache"
APPL_SHORT_NAME="ampache" APPL_NAME_SHORT="ampache"
APPL_VERSION="1.2.2" APPL_ORG="rx3-docker"
APPL_URL="${APPL_URL_PREFIX}/${APPL_NAME}:${APPL_VERSION}" APPL_VERSION="1.3.0"
APPL_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>' APPL_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
@ -45,17 +46,40 @@ VIDEO_REPO="./opt/video"
if [[ "${APPL_ENV}" != "prd" ]] if [[ "${APPL_ENV}" != "prd" ]]
then then
APPL_SUFFIX="-${APPL_ENV}" APPL_SUFFIX="-${APPL_ENV}"
ENV_PORT_OFFSET=100 PORT_ENV_OFFSET=100
else else
APPL_SUFFIX="" APPL_SUFFIX=""
ENV_PORT_OFFSET=0 PORT_ENV_OFFSET=0
fi fi
CONT_NAME_PREFIX=${APPL_NAME/-mga9}${APPL_SUFFIX} ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
APPL_URL_PREFIX="${ORG_REGISTRY}/${APPL_ORG}/${APPL_NAME_SHORT}"
SV_PORT_OFFSET=1000 HOST_NAME_PREFIX=${APPL_NAME_SHORT}${APPL_SUFFIX}
NETWORK_NAME=${CONT_NAME_PREFIX}
NETWORK_IF_NAME=br-${APPL_SHORT_NAME}-${APPL_ENV} PORT_ENV_OFFSET=0
PORT_SV_INT=9001
PORT_SV_OFFSET=1000
NETWORK_NAME=${HOST_NAME_PREFIX}
NETWORK_IF_NAME=br-${APPL_NAME_SHORT}-${APPL_ENV}
DOCKER_TOOLS_DEBUG=FALSE
DOCKER_TOOLS_VOLUME=MERGED
#DOCKER_TOOLS_EXECPTION_LIBS="postgres:pgsql"
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+-----------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
# | Variable | Service | Target Image | From Image | Module | Main Port | Admin Port | User | Group |
# | Prefix | Name | URL Prefix | Name | Name Full | Version | URL Prefix | Name | Version | Name | Version | Ext | Int | Ext | Int | Name / Id | Name / Id |
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+-----------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
docker_service_add DB database ${ORG_URL_PREFIX} mariadb - 1.1.0-mga9 - - - mysql - 8006 3306 - - postgres postgres
docker_service_add WAI webapp-internal ${ORG_URL_PREFIX} ampache "Rx3-Docker/Ampache" 1.3.0-mga9 ${ORG_URL_PREFIX} php-apache 1.4.0-mga9 - - 8085 80 - - apache apache
docker_service_add WAE webapp-external ${ORG_URL_PREFIX} ampache - 1.3.0-mga9 - - - - - 8086 80 - - apache apache
@ -63,18 +87,11 @@ NETWORK_IF_NAME=br-${APPL_SHORT_NAME}-${APPL_ENV}
# Database # Database
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
DATABASE_IMG=${APPL_URL_PREFIX}/mariadb-mga9:1.0.2 DB_ROOT_HOST='%' # needs to be enclosed with quotes
DATABASE_CONT_NAME="${CONT_NAME_PREFIX}-database" DB_ROOT_PASSWORD="mysqladmin"
DATABASE_PORT=$(( 8006 + ${ENV_PORT_OFFSET})) DB_DB_NAME="ampache"
DATABASE_SV_PORT=$(( ${DATABASE_PORT} + ${SV_PORT_OFFSET})) DB_DB_USER="ampache"
DB_DB_PASSWORD="ampacheadmin"
MARIADB_UID=983
MARIADB_GID=981
MARIADB_ROOT_HOST='%' # needs to be enclosed with quotes
MARIADB_ROOT_PASSWORD="mysqladmin"
MARIADB_DATABASE="ampache"
MARIADB_USER="ampache"
MARIADB_PASSWORD="ampacheadmin"
@ -82,16 +99,9 @@ MARIADB_PASSWORD="ampacheadmin"
# WebApp # WebApp
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
WEBAPP_IMG=${APPL_URL}
WEBAPP_INT_CONT_NAME="${CONT_NAME_PREFIX}-webapp-internal"
WEBAPP_INT_PORT=$(( 8085 + ${ENV_PORT_OFFSET}))
WEBAPP_INT_SV_PORT=$(( ${WEBAPP_INT_PORT} + ${SV_PORT_OFFSET}))
WEBAPP_EXT_CONT_NAME="${CONT_NAME_PREFIX}-webapp-external"
WEBAPP_EXT_PORT=$(( ${WEBAPP_INT_PORT} + 1))
WEBAPP_EXT_SV_PORT=$(( ${WEBAPP_EXT_PORT} + ${SV_PORT_OFFSET}))
APACHE_UID=980
APACHE_GID=977
APACHE_DOC_ROOT=/var/www/public APACHE_DOC_ROOT=/var/www/public
WAI_LOG_MAIN_INT="/var/log/httpd"
WAI_LOG_MAIN_EXT="./var/log/httpd-webapp-internal"
WAE_LOG_MAIN_INT="/var/log/httpd"
WAE_LOG_MAIN_EXT="./var/log/httpd-webapp-external"

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
var/log/init-database/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
var/log/mysql-database/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore