summaryrefslogtreecommitdiffstats
path: root/Services/mariadb
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2014-11-20 03:17:46 +0100
committerstartxfr <clarue@startx.fr>2014-11-20 03:17:46 +0100
commita699d0d06feeb1859efea16dd6b3df17901a1bc5 (patch)
tree3a2646acb64a4a9d2440549b2a895648b9289466 /Services/mariadb
parent8829f895c890685cc25fe3022299b4275808dc06 (diff)
downloadphpmyadmin-a699d0d06feeb1859efea16dd6b3df17901a1bc5.tar.gz
phpmyadmin-a699d0d06feeb1859efea16dd6b3df17901a1bc5.tar.bz2
phpmyadmin-a699d0d06feeb1859efea16dd6b3df17901a1bc5.tar.xz
phpmyadmin-a699d0d06feeb1859efea16dd6b3df17901a1bc5.zip
modif des services et ajout de memcache, apache et nodejs
Diffstat (limited to 'Services/mariadb')
-rw-r--r--Services/mariadb/Dockerfile22
-rw-r--r--Services/mariadb/README.md16
-rw-r--r--Services/mariadb/mariadb_run.sh56
3 files changed, 94 insertions, 0 deletions
diff --git a/Services/mariadb/Dockerfile b/Services/mariadb/Dockerfile
new file mode 100644
index 0000000..b354a0e
--- /dev/null
+++ b/Services/mariadb/Dockerfile
@@ -0,0 +1,22 @@
+FROM startx/fedora
+MAINTAINER Chistophe LARUE <dev@startx.fr>
+
+COPY mariadb_run.sh /bin/
+RUN yum -y install \
+ mariadb-libs \
+ mariadb-server \
+ mariadb \
+ && yum clean all \
+ && mkdir -p /var/log/mysql \
+ && touch /var/log/mysql/.keep /var/lib/mysql/.keep \
+ && chown -R mysql:mysql /var/log/mysql /var/lib/mysql \
+ && chmod ug+rx /bin/mariadb_*
+
+VOLUME ["/var/lib/mysql", "/var/log/mysql"]
+USER mysql
+
+EXPOSE 3306
+
+#CMD ["/usr/libexec/mysqld"]
+CMD ["/bin/mariadb_run.sh"]
+ONBUILD CMD ["/bin/mariadb_run.sh"] \ No newline at end of file
diff --git a/Services/mariadb/README.md b/Services/mariadb/README.md
new file mode 100644
index 0000000..f81f3de
--- /dev/null
+++ b/Services/mariadb/README.md
@@ -0,0 +1,16 @@
+docker-images MariaDB
+=====================
+
+**Description**
+Based on the [tutum php](https://registry.hub.docker.com/u/tutum/mariadb) Dockerfile
+
+**Usage**
+
+ docker run --name="test-maria" -d startx/sv-maria
+
+ docker run --name="test-maria" -d startx/sv-maria
+ docker run -d -p 3306:3306 startx/sv-maria
+ docker run -d -p 3306:3306 --name="test-maria" startx/sv-maria
+
+ docker run -d --name="test-maria" startx/sv-maria // linked to another container
+ docker run -d --name="test-www" --link test-maria:maria startx/sv-php
diff --git a/Services/mariadb/mariadb_run.sh b/Services/mariadb/mariadb_run.sh
new file mode 100644
index 0000000..b5b1421
--- /dev/null
+++ b/Services/mariadb/mariadb_run.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+ln -s /dev/stderr /var/log/mysql/mysqld.log
+if [ ! -f /var/lib/mysql/.created ]; then
+ function wait_for_mysqld_start {
+ for i in {1..30}; do
+ if echo 'select 1' | mysql -u root > /dev/null 2>&1; then
+ return 0
+ fi
+ sleep 1
+ done
+
+ echo "MariaDB did not start in time"
+ exit 1
+ }
+
+
+
+ password=${DB_PASSWORD:-password}
+ dbname=${DB_NAME:-master}
+
+ /usr/bin/mysql_install_db -u mysql
+
+ /usr/libexec/mysqld &
+ pid=$!
+
+ wait_for_mysqld_start
+
+ echo "Creating database $dbname ..."
+
+ sql=$(cat <<SQL
+ drop database if exists test;
+ create database \`$dbname\`
+ DEFAULT CHARACTER SET utf8 DEFAULT
+ COLLATE utf8_general_ci;
+SQL
+)
+ echo $sql | mysql -u root
+
+ #delete from user;
+
+ sql=$(cat <<SQL
+ delete from user where user='';
+ grant all on *.* to 'mysql'@'localhost' identified by '$password' with grant option;
+ grant all on *.* to 'mysql'@'%' identified by '$password' with grant option;
+ flush privileges;
+SQL
+)
+ echo $sql | mysql -u root mysql
+
+ touch /var/lib/mysql/.created
+ kill -TERM $pid
+
+ echo "Starting mysqld ..."
+fi
+
+exec /usr/libexec/mysqld \ No newline at end of file