- 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.
This commit is contained in:
parent
1c23ba75b8
commit
03259cffdb
32
Dockerfile
32
Dockerfile
@ -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.3
|
||||
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,11 +31,14 @@ ARG MYSQLD='#!/bin/bash
|
||||
usermod -u ${MARIADB_UID} mysql \n\
|
||||
groupmod -g ${MARIADB_GID} mysql \n\
|
||||
\n\
|
||||
chown -R mysql:mysql /var/lib/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\
|
||||
@ -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}
|
||||
|
@ -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.3 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
|
||||
|
@ -1,5 +1,18 @@
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3/MariaDB-Mga9 V 1.0.2 - A. GIBERT - 2024/11/xx
|
||||
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.
|
||||
|
62
compose.yaml
62
compose.yaml
@ -1,46 +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}
|
||||
|
||||
restart: unless-stopped
|
||||
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
|
||||
|
||||
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
|
||||
test: ["CMD", 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p${MARIADB_ROOT_PASSWORD}' ]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
- ./var/lib/mysql:/var/lib/mysql
|
||||
|
||||
network_mode: bridge
|
||||
- ./${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}
|
||||
|
||||
ports:
|
||||
- "127.0.0.1:${DATABASE_SV_PORT}:9001"
|
||||
- "127.0.0.1:${DATABASE_PORT}: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}"
|
||||
|
42
env
42
env
@ -1,42 +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.2"
|
||||
IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}"
|
||||
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# User Settings
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
ENV_PORT_OFFSET=0
|
||||
SV_PORT_OFFSET=1000
|
||||
|
||||
DATABASE_PORT=$(( 8006 + ${ENV_PORT_OFFSET}))
|
||||
DATABASE_SV_PORT=$(( ${DATABASE_PORT} + ${SV_PORT_OFFSET}))
|
||||
|
||||
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"
|
40
env.dist
Normal file
40
env.dist
Normal 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/log/init/.gitignore
vendored
Normal file
4
var/log/init/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
var/log/mysql/.gitignore
vendored
Normal file
4
var/log/mysql/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
var/log/supervisor/.gitignore
vendored
Normal file
4
var/log/supervisor/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
Loading…
Reference in New Issue
Block a user