Make a proper conf mount for MariaDB

This commit is contained in:
Disassembler 2018-01-27 14:13:59 +01:00
parent a1237a25ca
commit 0f2546631a
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
3 changed files with 4 additions and 4 deletions

View File

@ -6,16 +6,16 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/mariadb
docker build -t mariadb ${SOURCE_DIR} docker build -t mariadb ${SOURCE_DIR}
# Create MariaDB instance # Create MariaDB instance
mkdir -p /srv/mariadb/data mkdir -p /srv/mariadb/conf /srv/mariadb/data
chown 3306:3306 /srv/mariadb/data chown 3306:3306 /srv/mariadb/data
docker run --rm --name mariadb -h mariadb -v /srv/mariadb/data:/var/lib/mysql mariadb mysql_install_db --user=mysql docker run --rm --name mariadb -h mariadb -v /srv/mariadb/data:/var/lib/mysql mariadb mysql_install_db --user=mysql
# Configure MariaDB # Configure MariaDB
cp ${SOURCE_DIR}/srv/mariadb/my.cnf /srv/mariadb/my.cnf cp ${SOURCE_DIR}/srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
# Enable query logging. Only if the DEBUG environment variable is set # Enable query logging. Only if the DEBUG environment variable is set
if [ ${DEBUG:-0} -eq 1 ]; then if [ ${DEBUG:-0} -eq 1 ]; then
sed -i 's/#general_log/general_log/g' /srv/mariadb/my.cnf sed -i 's/#general_log/general_log/g' /srv/mariadb/conf/my.cnf
fi fi
# Configure MariaDB service # Configure MariaDB service

View File

@ -11,7 +11,7 @@ start() {
/usr/bin/docker run -d --rm \ /usr/bin/docker run -d --rm \
--name mariadb \ --name mariadb \
-h mariadb \ -h mariadb \
-v /srv/mariadb/my.cnf:/etc/mysql/my.cnf \ -v /srv/mariadb/conf:/etc/mysql \
-v /srv/mariadb/data:/var/lib/mysql \ -v /srv/mariadb/data:/var/lib/mysql \
mariadb mariadb
} }