LXCize MariaDB setup
This commit is contained in:
parent
7ebdfc1866
commit
677ac1bc4c
@ -15,7 +15,7 @@ RUN EOF
|
|||||||
chown mysql:mysql /run/mysqld
|
chown mysql:mysql /run/mysqld
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
MOUNT /srv/mariadb/conf etc/mysqld
|
MOUNT /srv/mariadb/conf etc/mysql
|
||||||
MOUNT /srv/mariadb/data var/lib/mysql
|
MOUNT /srv/mariadb/data var/lib/mysql
|
||||||
|
|
||||||
USER 3306 3306
|
USER 3306 3306
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/mariadb
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||||
|
|
||||||
# Build Docker container
|
|
||||||
docker build -t mariadb ${SOURCE_DIR}
|
|
||||||
cp ${SOURCE_DIR}/etc/init.d/mariadb /etc/init.d/mariadb
|
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Create MariaDB instance
|
# Create MariaDB instance
|
||||||
mkdir -p /srv/mariadb/conf /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
|
lxc-execute mariadb -- /usr/bin/mysql_install_db --user=mysql
|
||||||
|
|
||||||
# Configure MariaDB
|
# Configure MariaDB
|
||||||
cp ${SOURCE_DIR}/srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
|
cp ${SOURCE_DIR}/srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
|
||||||
@ -21,7 +16,11 @@ if [ ${DEBUG:-0} -eq 1 ]; then
|
|||||||
sed -i 's/#general_log/general_log/g' /srv/mariadb/conf/my.cnf
|
sed -i 's/#general_log/general_log/g' /srv/mariadb/conf/my.cnf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Install service
|
||||||
|
cp ${SOURCE_DIR}/etc/init.d/mariadb /etc/init.d/mariadb
|
||||||
|
rc-update -u
|
||||||
|
|
||||||
# Configure MariaDB admin
|
# Configure MariaDB admin
|
||||||
service mariadb start
|
service mariadb start
|
||||||
cat ${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql
|
cat ${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- /usr/bin/mysql
|
||||||
service mariadb stop
|
service mariadb stop
|
||||||
|
@ -1,24 +1,19 @@
|
|||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
description="MariaDB docker container"
|
description="MariaDB container"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need docker
|
need cgroups
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
/usr/bin/docker run -d --rm \
|
/usr/bin/lxc-start mariadb
|
||||||
--name mariadb \
|
|
||||||
-h mariadb \
|
|
||||||
-v /srv/mariadb/conf:/etc/mysql \
|
|
||||||
-v /srv/mariadb/data:/var/lib/mysql \
|
|
||||||
mariadb
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_post() {
|
start_post() {
|
||||||
timeout -t 60 docker exec mariadb sh -c 'until [ -e /run/mysqld/mysqld.sock ]; do usleep 50000; done'
|
ewaitfile 60 /var/lib/lxc/mariadb/delta0/run/mysqld/mysqld.sock
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
/usr/bin/docker stop mariadb
|
/usr/bin/lxc-stop mariadb
|
||||||
}
|
}
|
||||||
|
17
setup-all.sh
17
setup-all.sh
@ -6,9 +6,26 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))
|
|||||||
# Setup components
|
# Setup components
|
||||||
${SOURCE_DIR}/activemq/setup.sh
|
${SOURCE_DIR}/activemq/setup.sh
|
||||||
${SOURCE_DIR}/ckan-datapusher/setup.sh
|
${SOURCE_DIR}/ckan-datapusher/setup.sh
|
||||||
|
${SOURCE_DIR}/mariadb/setup.sh
|
||||||
${SOURCE_DIR}/postgres/setup.sh
|
${SOURCE_DIR}/postgres/setup.sh
|
||||||
|
#${SOURCE_DIR}/rabbitmq/setup.sh
|
||||||
${SOURCE_DIR}/redis/setup.sh
|
${SOURCE_DIR}/redis/setup.sh
|
||||||
${SOURCE_DIR}/solr/setup.sh
|
${SOURCE_DIR}/solr/setup.sh
|
||||||
|
|
||||||
# Setup applications
|
# Setup applications
|
||||||
${SOURCE_DIR}/ckan/setup.sh
|
${SOURCE_DIR}/ckan/setup.sh
|
||||||
|
#${SOURCE_DIR}/crisiscleanup/setup.sh
|
||||||
|
#${SOURCE_DIR}/cts/setup.sh
|
||||||
|
#${SOURCE_DIR}/frontlinesms/setup.sh
|
||||||
|
#${SOURCE_DIR}/gnuhealth/setup.sh
|
||||||
|
#${SOURCE_DIR}/kanboard/setup.sh
|
||||||
|
#${SOURCE_DIR}/opendatakit/setup.sh
|
||||||
|
#${SOURCE_DIR}/opendatakit-build/setup.sh
|
||||||
|
#${SOURCE_DIR}/openmapkit/setup.sh
|
||||||
|
#${SOURCE_DIR}/pandora/setup.sh
|
||||||
|
#${SOURCE_DIR}/sahana/setup.sh
|
||||||
|
#${SOURCE_DIR}/sahana-demo/setup.sh
|
||||||
|
#${SOURCE_DIR}/sambro/setup.sh
|
||||||
|
#${SOURCE_DIR}/seeddms/setup.sh
|
||||||
|
#${SOURCE_DIR}/sigmah/setup.sh
|
||||||
|
#${SOURCE_DIR}/ushahidi/setup.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user