Compare commits

..

3 Commits

Author SHA1 Message Date
03259cffdb - Move & Rename repo from Rx3/MariaDB-MGA9 to Rx3-Docker/MariaDB,
- New version naming standard,
- Now use docker_tools for .env building,
- Now use docker_service_add macro,
- Use now rx3-docker/server:1.2.0-mga9 image,
- Add /var/log/init, /var/log/supervisor & var/log/mysql volumes.
2024-11-17 23:11:27 +01:00
1c23ba75b8 - Add healthcheck example in compose file. 2024-10-29 09:10:02 +01:00
17ddc89aa4 - Now use server-mga9:1.1.3 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
2024-10-05 18:18:19 +02:00
10 changed files with 150 additions and 73 deletions

36
.env
View File

@ -1,36 +0,0 @@
# Rx3 MariaDB Mageia-9 Docker Image
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Global Settings
#-------------------------------------------------------------------------------
IMG_ORG="rx3"
IMG_REGISTRY="docker.xor.rx3:5000"
IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}"
#-------------------------------------------------------------------------------
# Image Settings
#-------------------------------------------------------------------------------
IMG_NAME="mariadb-mga9"
IMG_FULL_NAME="Rx3 MariaDB Mageia-9 Docker Image"
IMG_VERSION="1.0.1"
IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
#-------------------------------------------------------------------------------
# User Settings
#-------------------------------------------------------------------------------
MARIADB_UID=983
MARIADB_GID=981
MARIADB_ROOT_HOST= '%' # needs to be enclosed with quotes
MARIADB_ROOT_PASSWORD="mysqladmin"
MARIADB_DATABASE="test"
MARIADB_USER="test"
MARIADB_PASSWORD="testadmin"

View File

@ -1,20 +1,28 @@
# Rx3 MariaDB Mageia-9 Docker Image
# Rx3-Docker/MariaDB Docker Image
#-------------------------------------------------------------------------------
ARG IMG_URL_PREFIX="rx3"
ARG IMG_FROM_URL="rx3-docker/server:latest"
FROM ${IMG_URL_PREFIX}/server-mga9:1.1.2
FROM ${IMG_FROM_URL}
ARG IMG_NAME
ARG IMG_FULL_NAME
ARG IMG_NAME_FULL
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_FULL_NAME}
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 MARIADDB_LIB
ARG MARIADDB_LOG
ARG MARIADDB_PORT
ARG POSTSQL_LOG
ARG MARIADB_LOG_FILE="${MARIADDB_LOG}/mariadb.err"
ARG POSTSQL_LOG_FILE="${POSTSQL_LOG}/postsql.log"
#---------------------------------------------------------------------------------------------------
@ -23,18 +31,21 @@ ARG MYSQLD='#!/bin/bash
usermod -u ${MARIADB_UID} mysql \n\
groupmod -g ${MARIADB_GID} mysql \n\
\n\
chown -R mysql:mysql /var/log/mysqld /var/run/mysqld \n\
chown -R mysql:mysql '${MARIADDB_LIB}' '${MARIADDB_LOG}' /var/run/mysqld \n\
\n\
sed -i -e "s/^skip-networking/#skip-networking/" /etc/my.cnf.d/server.cnf \n\
sed -i -e "s/^skip-networking/#skip-networking/" /etc/my.cnf.d/server.cnf \n\
sed -i -e "s%hostname$%hostname\\n\\nlog_error='${MARIADB_LOG_FILE}'%" /etc/my.cnf.d/server.cnf \n\
sed -i -e "s/^plugin-load-add=/#plugin-load-add=/" /etc/my.cnf.d/cracklib_password_check.cnf \n\
\n\
rm -Rf /var/log/mysqld* \n\
\n\
echo "CREATE USER `root`@`${MARIADB_ROOT_HOST}` IDENTIFIED BY `${MARIADB_ROOT_PASSWORD}`; \n\
GRANT ALL ON *.* TO `root`@`${MARIADB_ROOT_HOST}` WITH GRANT OPTION; \n\
GRANT PROXY ON ``@`%` TO `root`@`${MARIADB_ROOT_HOST}` WITH GRANT OPTION;" >>/tmp/post.sql \n\
\n\
if [[ -n "${MARIADB_DATABASE}" ]] \n\
then \n\
echo "CREATE DATABASE IF NOT EXISTS $MARIADB_DATABASE;" >>/tmp/post.sql \n\
echo "CREATE DATABASE IF NOT EXISTS ${MARIADB_DATABASE};" >>/tmp/post.sql \n\
fi \n\
\n\
if [[ -n "${MARIADB_USER}" ]] && [[ -n "${MARIADB_PASSWORD}" ]] \n\
@ -59,7 +70,7 @@ command=/usr/sbin/mysqld'
#---------------------------------------------------------------------------------------------------
ARG POSTSQL='#!/bin/bash \n\
\n\
function log() { echo "$(date --rfc-3339=ns) PostSQL: $*" | tee -a /var/log/postsql.log; } \n\
function log() { echo "$(date --rfc-3339=ns) PostSQL: $*" | tee -a '${POSTSQL_LOG_FILE}'; } \n\
\n\
log "Starting" \n\
\n\
@ -105,6 +116,7 @@ RUN urpmi --force mariadb
VOLUME /var/lib/mysql
VOLUME ${MARIADDB_LIB}
VOLUME ${MARIADDB_LOG}
EXPOSE 3306
EXPOSE ${MARIADDB_PORT}

View File

@ -1,11 +1,11 @@
Welcome to Rx3/MariaDB-Mga9 docker image!
Welcome to Rx3-Docker/MariaDB docker image!
This is project aims to build a MariaDB + Mageia 9 docker image used by others Rx3 packaging projects.
Features:
- Curtently based on rx3/server-mga9:1.1.2 image,
- Curtently based on rx3-docker/server:1.2.0-mga9 image,
- Following env vars supported:
- MARIADB_UID & MARIADB_GID,
- MARIADB_ROOT_HOST & MARIADB_ROOT_PASSWORD,
@ -19,4 +19,4 @@ Your Rx3 Team.
--
arnaud@rx3.net
https://git.rx3.org/gitea/rx3/mariadb-mga9
https://git.rx3.org/gitea/rx3-docker/mariadb

View File

@ -1,3 +1,34 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/MariaDB-Mga9 V 1.1.0 - A. GIBERT - 2024/11/17
------------------------------------------------------------------------------------------------------------------------------------
- Move & Rename repo from Rx3/MariaDB-MGA9 to Rx3-Docker/MariaDB,
- New version naming standard,
- Now use docker_tools for .env building,
- Now use docker_service_add macro,
- Use now rx3-docker/server:1.2.0-mga9 image,
- Add /var/log/init, /var/log/supervisor & var/log/mysql volumes.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/MariaDB-Mga9 V 1.0.2 - A. GIBERT - 2024/11/05
------------------------------------------------------------------------------------------------------------------------------------
- Add healthcheck example in compose file.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/MariaDB-Mga9 V 1.0.1 - A. GIBERT - 2024/10/05
------------------------------------------------------------------------------------------------------------------------------------
- Now use server-mga9:1.1.3 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/MariaDB-Mga9 V 1.0.1 - A. GIBERT - 2024/08/28
------------------------------------------------------------------------------------------------------------------------------------

View File

@ -1,40 +1,54 @@
# Rx3 MariaDB Mageia-9 Docker Image
# Rx3-Docker/MariaDB Docker Image
#-------------------------------------------------------------------------------
name: ${IMG_NAME}
name: ${DATABASE_IMG_NAME}
services:
database:
container_name: ${IMG_NAME}
container_name: ${DATABASE_HOST_NAME}
hostname: ${DATABASE_HOST_NAME}
image: ${IMG_URL}
image: ${DATABASE_IMG_URL}
build:
context: .
context: .
args:
- IMG_NAME=${IMG_NAME}
- IMG_FULL_NAME=${IMG_FULL_NAME}
- IMG_VERSION=${IMG_VERSION}
- IMG_MAINTAINER=${IMG_MAINTAINER}
- IMG_URL_PREFIX=${IMG_URL_PREFIX}
IMG_NAME: ${DATABASE_IMG_NAME}
IMG_NAME_FULL: ${DATABASE_IMG_NAME_FULL}
IMG_VERSION: ${DATABASE_IMG_VERSION}
IMG_MAINTAINER: ${DATABASE_IMG_MAINTAINER}
IMG_FROM_URL: ${DATABASE_IMG_FROM_URL}
MARIADDB_LIB: ${DATABASE_LIB_INT}
MARIADDB_LOG: ${DATABASE_LOG_MAIN_INT}
MARIADDB_PORT: ${DATABASE_PORT_MAIN_INT}
POSTSQL_LOG: ${DATABASE_LOG_POST_INT}
restart: unless-stopped
restart: unless-stopped
environment:
MARIADB_UID: ${MARIADB_UID}
MARIADB_GID: ${MARIADB_GID}
MARIADB_ROOT_HOST: ${MARIADB_ROOT_HOST}
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
MARIADB_DATABASE: ${MARIADB_DATABASE}
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
MARIADB_UID: ${DATABASE_USER_ID}
MARIADB_GID: ${DATABASE_GROUP_ID}
MARIADB_ROOT_HOST: ${MARIADB_ROOT_HOST}
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
MARIADB_DATABASE: ${MARIADB_DATABASE}
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
healthcheck:
test: ["CMD", 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p${MARIADB_ROOT_PASSWORD}' ]
interval: 10s
timeout: 3s
retries: 3
volumes:
- ./mysql:/var/lib/mysql
- ./${DATABASE_LIB_EXT}:${DATABASE_LIB_INT}
- ./${DATABASE_LOG_INIT_EXT}:${DATABASE_LOG_INIT_INT}
- ./${DATABASE_LOG_SV_EXT}:${DATABASE_LOG_SV_INT}
- ./${DATABASE_LOG_MAIN_EXT}:${DATABASE_LOG_MAIN_INT}
network_mode: bridge
ports:
- "127.0.0.1:9012:9001"
- "127.0.0.1:8006:3306"
- "127.0.0.1:${DATABASE_PORT_SV_EXT}:${DATABASE_PORT_SV_INT}"
- "127.0.0.1:${DATABASE_PORT_MAIN_EXT}:${DATABASE_PORT_MAIN_INT}"

40
env.dist Normal file
View File

@ -0,0 +1,40 @@
# Rx3-Docker/MariaDB Docker Image
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Global Settings
#-------------------------------------------------------------------------------
ORG_NAME="rx3-docker"
ORG_REGISTRY="docker.xor.rx3:5000"
ORG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
#-------------------------------------------------------------------------------
# Image Settings
#-------------------------------------------------------------------------------
HOST_NAME_PREFIX=""
PORT_ENV_OFFSET=0
PORT_SV_OFFSET=1000
#------------------+----------+--------------------+--------------------------+------------------------------------------+------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
# | Variable | Target Image | From Image | Module | Main Port | Admin Port | User | Group |
# | Prefix | URL Prefix | Name | Name Full + Version | URL Prefix | Name + Version | Name | Version | Ext | Int | Ext | Int | Name / Id | Name / Id |
#------------------+----------+--------------------+--------------------------+------------------------------------------+------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
docker_service_add DATABASE ${ORG_URL_PREFIX} mariadb "Rx3-Docker/MariaDB Docker Image" 1.1.0-mga9 ${ORG_URL_PREFIX} server 1.2.0-mga9 mysql - 8006 3306 - - 983 981
MARIADB_ROOT_HOST='%' # needs to be enclosed with quotes
MARIADB_ROOT_PASSWORD="mysqladmin"
MARIADB_DATABASE="test"
MARIADB_USER="test"
MARIADB_PASSWORD="testadmin"

4
var/lib/mysql/.gitignore vendored Normal file
View File

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

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

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

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

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

4
var/log/supervisor/.gitignore vendored Normal file
View File

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