summaryrefslogtreecommitdiffstats
path: root/Services
diff options
context:
space:
mode:
Diffstat (limited to 'Services')
-rw-r--r--Services/apache/run.sh1
-rw-r--r--Services/apache/sx-httpd.sh2
-rw-r--r--Services/mariadb/Dockerfile32
-rw-r--r--Services/mariadb/docker-compose.yml2
-rw-r--r--Services/mariadb/my.cnf29
-rw-r--r--Services/mariadb/run.sh78
-rw-r--r--Services/php/Dockerfile8
-rw-r--r--Services/php/read2
-rw-r--r--Services/php/run.sh1
9 files changed, 130 insertions, 25 deletions
diff --git a/Services/apache/run.sh b/Services/apache/run.sh
index 026c618..e06a7c5 100644
--- a/Services/apache/run.sh
+++ b/Services/apache/run.sh
@@ -6,7 +6,6 @@ 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
diff --git a/Services/apache/sx-httpd.sh b/Services/apache/sx-httpd.sh
index c955689..fb50be9 100644
--- a/Services/apache/sx-httpd.sh
+++ b/Services/apache/sx-httpd.sh
@@ -1,6 +1,7 @@
#!/bin/bash
function check_httpd_environment {
+ check_environment
if [ ! -v SERVER_NAME ]; then
SERVER_NAME="localhost"
export SERVER_NAME
@@ -25,6 +26,7 @@ function display_container_httpd_header {
echo "+====================================================="
echo "| Container : $HOSTNAME"
echo "| OS : $(</etc/redhat-release)"
+ echo "| Engine : " httpd -v | head -1
if [ -v CONTAINER_TYPE ]; then
echo "| Type : $CONTAINER_TYPE"
fi
diff --git a/Services/mariadb/Dockerfile b/Services/mariadb/Dockerfile
index 047cdda..fbeacce 100644
--- a/Services/mariadb/Dockerfile
+++ b/Services/mariadb/Dockerfile
@@ -3,27 +3,27 @@ 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/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
-ENV STARTUPLOG=/data/logs/mariadb/startup.log
+ && dnf clean all && \
+ mkdir -p /tmp/sql
+ENV MY_CONF=/etc/my.cnf \
+ STARTUPLOG=/data/logs/mariadb/startup.log \
+ LOG_PATH=/data/logs/mariadb \
+ DATA_PATH=/data/mariadb \
+ LOADSQL_PATH=/tmp/sql
COPY *.sh /bin/
-COPY *.sql /tmp/sql/
+COPY my.cnf $MY_CONF
+COPY *.sql $LOADSQL_PATH/
RUN chmod 775 /bin/run.sh && \
+ chmod ug+r $MY_CONF && \
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
+ mkdir $DATA_PATH && \
+ mkdir $LOG_PATH && \
+ touch $STARTUPLOG && \
+ touch $DATA_PATH/.keep && \
+ chown -R mariadb:mariadb $LOG_PATH $DATA_PATH $LOADSQL_PATH
EXPOSE 3306
-VOLUME ["/data/mariadb", "/var/logs/mariadb"]
+VOLUME [$DATA_PATH,$LOG_PATH]
CMD ["/sx/run.sh"] \ No newline at end of file
diff --git a/Services/mariadb/docker-compose.yml b/Services/mariadb/docker-compose.yml
index 62ae6b8..b1f6807 100644
--- a/Services/mariadb/docker-compose.yml
+++ b/Services/mariadb/docker-compose.yml
@@ -1,4 +1,4 @@
-mariadb:
+server:
build: ./
# image: sx-mariadb
container_name: "sx-mariadb"
diff --git a/Services/mariadb/my.cnf b/Services/mariadb/my.cnf
new file mode 100644
index 0000000..ac882ac
--- /dev/null
+++ b/Services/mariadb/my.cnf
@@ -0,0 +1,29 @@
+[mysqld]
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
+# Settings user and group are ignored when systemd is used.
+# If you need to run mysqld under a different user or group,
+# customize your systemd unit file for mysqld/mariadb according to the
+# instructions in http://fedoraproject.org/wiki/Systemd
+
+# Currently, there are mariadb and community-mysql packages in Fedora.
+# This particular config file is included in respective RPMs of both of them,
+# so the following settings are general and will be also used by both of them.
+# Otherwise the RPMs would be in conflict.
+# Settings for particular implementations like MariaDB are then
+# defined in appropriate sections; for MariaDB server in [mariadb] section in
+# /etc/my.cnf.d/server.cnf (part of mariadb-server).
+# It doesn't matter that we set these settings only for [mysqld] here,
+# because they will be read and used in mysqld_safe as well.
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
+[mysqld_safe]
+
+#
+# include all files from the config directory
+#
+!includedir /etc/my.cnf.d
+
diff --git a/Services/mariadb/run.sh b/Services/mariadb/run.sh
index a59a9af..cd22b99 100644
--- a/Services/mariadb/run.sh
+++ b/Services/mariadb/run.sh
@@ -1,14 +1,84 @@
#!/bin/bash
source /bin/sx-lib.sh
-source /bin/sx-httpd.sh
+
+function check_mariadb_environment {
+ check_environment
+ if [ ! -v SERVER_NAME ]; then
+ SERVER_NAME="localhost"
+ export SERVER_NAME
+ echo "! WARNING : environment var SERVER_NAME is missing..."
+ echo "! WARNING : auto-assigned value : $SERVER_NAME"
+ fi
+ if [ ! -v DOC_ROOT ]; then
+ DOC_ROOT="/data/apache"
+ export DOC_ROOT
+ fi
+ if [ ! -v APP_PATH ]; then
+ APP_PATH="/data/apache"
+ export APP_PATH
+ fi
+ if [ ! -v LOG_PATH ]; then
+ LOG_PATH="/data/logs/apache"
+ export LOG_PATH
+ fi
+}
+
+function display_container_mariadb_header {
+ echo "+====================================================="
+ echo "| Container : $HOSTNAME"
+ echo "| OS : $(</etc/redhat-release)"
+ echo "| Engine : " mysql -V
+ if [ -v CONTAINER_TYPE ]; then
+ echo "| Type : $CONTAINER_TYPE"
+ fi
+ if [ -v CONTAINER_INSTANCE ]; then
+ echo "| Instance : $CONTAINER_INSTANCE"
+ fi
+ if [ -v CONTAINER_SERVICE ]; then
+ echo "| Service : $CONTAINER_SERVICE"
+ fi
+ if [ -v CONTAINER_SERVICE ]; then
+ echo "| ServerName : $SERVER_NAME"
+ fi
+ if [ -v APP_PATH ]; then
+ echo "| Data path : $DATA_PATH"
+ fi
+ if [ -v LOG_PATH ]; then
+ echo "| Log path : $LOG_PATH"
+ fi
+ if [ -v LOADSQL_PATH ]; then
+ echo "| sql path : $LOADSQL_PATH"
+ fi
+ echo "+====================================================="
+}
+
+
+# Begin configuration before starting daemonized process
+# and start generating host keys
+function begin_config {
+ echo "=> BEGIN MARIADB CONFIGURATION"
+}
+
+# End configuration process just before starting daemon
+function end_config {
+ echo "=> END MARIADB CONFIGURATION"
+}
+
+# Start the mariadb server as a deamon and execute it inside
+# the running shell
+function start_daemon {
+ echo "=> Starting mariadb daemon ..."
+ display_container_started
+ exec mysqld_safe
+}
+
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
+check_mariadb_environment | tee -a $STARTUPLOG
+display_container_mariadb_header | tee -a $STARTUPLOG
begin_config | tee -a $STARTUPLOG
end_config | tee -a $STARTUPLOG
display_container_started | tee -a $STARTUPLOG
diff --git a/Services/php/Dockerfile b/Services/php/Dockerfile
index 62b9564..ee02d89 100644
--- a/Services/php/Dockerfile
+++ b/Services/php/Dockerfile
@@ -9,12 +9,16 @@ RUN dnf -y install php php-pecl-mongo php-cli php-pear \
php-tcpdf-dejavu-sans-fonts php-tidy \
&& dnf clean all
ENV LOG_PATH=/data/logs/apache_php \
- APP_PATH=/data/apache_php
+ APP_PATH=/data/apache_php \
+ STARTUPLOG=/data/logs/apache_php/startup.log
COPY httpd.conf $HTTPDCONF
COPY php.ini /etc/php.d/sx.ini
COPY run.sh /bin/
RUN chmod 775 /bin/run.sh && \
- chmod ug+r $HTTPDCONF
+ chmod ug+r $HTTPDCONF && \
+ mkdir $APP_PATH && \
+ mkdir $LOG_PATH && \
+ touch $STARTUPLOG
COPY ./ $APP_PATH
RUN rm -f $APP_PATH/Dockerfile $APP_PATH/httpd.conf $APP_PATH/run.sh && \
chown -R apache:apache $APP_PATH $LOG_PATH && \
diff --git a/Services/php/read b/Services/php/read
new file mode 100644
index 0000000..3cd6763
--- /dev/null
+++ b/Services/php/read
@@ -0,0 +1,2 @@
+Server version: Apache/2.4.16 (Fedora)
+Server built: Jul 17 2015 08:02:56
diff --git a/Services/php/run.sh b/Services/php/run.sh
index a59a9af..4d4c580 100644
--- a/Services/php/run.sh
+++ b/Services/php/run.sh
@@ -6,7 +6,6 @@ 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