summaryrefslogtreecommitdiffstats
path: root/Services/mariadb
diff options
context:
space:
mode:
Diffstat (limited to 'Services/mariadb')
-rw-r--r--Services/mariadb/Dockerfile30
-rw-r--r--Services/mariadb/README.md2
-rw-r--r--Services/mariadb/docker-compose.yml15
-rw-r--r--Services/mariadb/run.sh15
-rw-r--r--Services/mariadb/sx/mariadb.sh2
5 files changed, 49 insertions, 15 deletions
diff --git a/Services/mariadb/Dockerfile b/Services/mariadb/Dockerfile
index 5efa265..047cdda 100644
--- a/Services/mariadb/Dockerfile
+++ b/Services/mariadb/Dockerfile
@@ -1,25 +1,29 @@
FROM startx/fedora
MAINTAINER Christophe LARUE <dev@startx.fr>
+USER root
RUN dnf -y install mariadb-common mariadb-libs mariadb-config mariadb-errmsg mariadb-server mariadb \
&& dnf 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 \
+ && mkdir -p /var/logs/mariadb \
+ && touch /var/logs/mariadb/.keep /var/lib/mariadb/.keep \
+ && chown -R mariadb:mariadb /var/logs/mariadb /var/lib/mariadb \
&& mkdir -p /tmp/sql
-COPY sx/* /sx/
+ENV STARTUPLOG=/data/logs/mariadb/startup.log
+COPY *.sh /bin/
COPY *.sql /tmp/sql/
+RUN chmod 775 /bin/run.sh && \
+ mkdir /data && \
+ mkdir /data/mariadb && \
+ mkdir /data/logs && \
+ mkdir /data/logs/mariadb && \
+ touch $STARTUPLOG
+COPY ./ /data/www
+RUN rm -f /data/www/Dockerfile /data/www/httpd.conf /data/www/run.sh /data/www/sx-httpd.sh && \
+ chown -R apache:apache /data/www /data/logs
RUN chmod ug+rx /sx/mariadb* /tmp/sql \
&& chown -R mysql:mysql /sx/mariadb* /tmp/sql
EXPOSE 3306
-VOLUME ["/var/lib/mysql", "/var/log/mysql"]
+VOLUME ["/data/mariadb", "/var/logs/mariadb"]
-USER mysql
-# if you wan't to set root password, otherwise auto-generated
-# see docker logs <containerId>
-ENV mysql_newadminpwd newRootPassword
-
-
-#ENDPOINT ["/sx/mariadb_run.sh"]
-CMD ["/sx/mariadb_run.sh"] \ No newline at end of file
+CMD ["/sx/run.sh"] \ No newline at end of file
diff --git a/Services/mariadb/README.md b/Services/mariadb/README.md
index 0636335..b5f3d78 100644
--- a/Services/mariadb/README.md
+++ b/Services/mariadb/README.md
@@ -6,7 +6,7 @@ Container running mysqld daemon under a fedora server
docker run -d -p 3306:3306 --name="mariadb" startx/sv-mariadb
# when used with a volume container (run data container, then run service)
- docker run -d -v /var/lib/mysql -v /var/log/mysql --name mariadb-data startx/sv-mariadb echo "Data container for mariadb"
+ docker run -d -v /var/lib/mysql -v /var/logs/mysql --name mariadb-data startx/sv-mariadb echo "Data container for mariadb"
docker run -d -p 3306:3306 --volumes-from mariadb-data --name="mariadb" startx/sv-mariadb
# when used in a linked container
docker run -d --name="mariadb" startx/sv-mariadb
diff --git a/Services/mariadb/docker-compose.yml b/Services/mariadb/docker-compose.yml
new file mode 100644
index 0000000..62ae6b8
--- /dev/null
+++ b/Services/mariadb/docker-compose.yml
@@ -0,0 +1,15 @@
+mariadb:
+ build: ./
+# image: sx-mariadb
+ container_name: "sx-mariadb"
+ mem_limit: 1g
+ memswap_limit: 2g
+ cpu_shares: 2
+ restart: "on-failure:2"
+ environment:
+ CONTAINER_TYPE: "service"
+ CONTAINER_SERVICE: "mariadb"
+ CONTAINER_INSTANCE: "sx-mariadb"
+ volumes:
+ - "/tmp/container/logs:/data/logs"
+ - "/tmp/container/mariadb:/data/mariadb" \ No newline at end of file
diff --git a/Services/mariadb/run.sh b/Services/mariadb/run.sh
new file mode 100644
index 0000000..a59a9af
--- /dev/null
+++ b/Services/mariadb/run.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+source /bin/sx-lib.sh
+source /bin/sx-httpd.sh
+
+if [[ "$0" == *"run.sh" && ! $1 = "" ]];then
+ eval "$@";
+fi
+
+check_environment | tee -a $STARTUPLOG
+check_httpd_environment | tee -a $STARTUPLOG
+display_container_httpd_header | tee -a $STARTUPLOG
+begin_config | tee -a $STARTUPLOG
+end_config | tee -a $STARTUPLOG
+display_container_started | tee -a $STARTUPLOG
+start_daemon | tee -a $STARTUPLOG
diff --git a/Services/mariadb/sx/mariadb.sh b/Services/mariadb/sx/mariadb.sh
index 5b2857d..7ff208e 100644
--- a/Services/mariadb/sx/mariadb.sh
+++ b/Services/mariadb/sx/mariadb.sh
@@ -1,7 +1,7 @@
#!/bin/bash
export TERM=dumb
-export logfile="/var/log/mysql/mysqld.log"
+export logfile="/var/logs/mysql/mysqld.log"
# Begin configuration before starting daemonized process
# redirect mysql.log to /dev/stderr