summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-02-21 18:44:26 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-02-21 18:44:26 +0100
commit350abf69de17b079c7589022bb0b2df01a51f84e (patch)
tree66bba94094c096b21c181d1a77c6a4ca4078482d
parent3d19ce5671e45b8e06a91cb09065d81e22f9d6fd (diff)
downloadadei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.gz
adei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.bz2
adei-350abf69de17b079c7589022bb0b2df01a51f84e.tar.xz
adei-350abf69de17b079c7589022bb0b2df01a51f84e.zip
Use volume for apache configuration in order to run in read-only containers
-rw-r--r--adei/Dockerfile6
-rwxr-xr-xadei/scripts/run-apache.sh17
-rwxr-xr-xadei/scripts/run-cron.sh10
-rw-r--r--docker-compose.yml16
4 files changed, 45 insertions, 4 deletions
diff --git a/adei/Dockerfile b/adei/Dockerfile
index 94f5016..ab38acf 100644
--- a/adei/Dockerfile
+++ b/adei/Dockerfile
@@ -25,6 +25,8 @@ VOLUME /adei/src
VOLUME /adei/cfg
VOLUME /adei/tmp
VOLUME /adei/sys
+VOLUME /adei/ovr
+
COPY supervisor/supervisord.conf /etc/supervisord.conf
@@ -37,6 +39,10 @@ RUN /opt/scripts/configure.sh
RUN rm -rf /srv/www/htdocs/adei && \
ln -s /adei/src /srv/www/htdocs/adei
+RUN ln -sf /etc/mime.types /etc/apache2/mime.types && \
+ mv /etc/apache2 /opt/ && \
+ ln -s /adei/ovr/apache2 /etc/apache2
+
ENV MYSQL_SERVER adei-mysql
ENV MYSQL_PORT 3306
ENV MYSQL_USER adei
diff --git a/adei/scripts/run-apache.sh b/adei/scripts/run-apache.sh
index 3ad9d5f..90438a7 100755
--- a/adei/scripts/run-apache.sh
+++ b/adei/scripts/run-apache.sh
@@ -1,8 +1,19 @@
#! /bin/bash
-if [ ! -f /adei/cfg/apache.conf ]; then
- cp -a /opt/configs/apache* /adei/cfg
-fi
+LOCK_FILE=.lock
+(
+ flock -x 10
+ if [ ! -d /adei/ovr/apache2 ]; then
+ cp -ar /opt/apache2 /adei/ovr/
+ fi
+) 10> /adei/ovr/$LOCK_FILE
+
+(
+ flock -x 10
+ if [ ! -f /adei/cfg/apache.conf ]; then
+ cp -a /opt/configs/apache* /adei/cfg
+ fi
+) 10> /adei/cfg/$LOCK_FILE
sed -i'' -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf
if [ -n "$ADEI_PORTS" ]; then
diff --git a/adei/scripts/run-cron.sh b/adei/scripts/run-cron.sh
index 5f4b9e2..f0539f6 100755
--- a/adei/scripts/run-cron.sh
+++ b/adei/scripts/run-cron.sh
@@ -2,6 +2,14 @@
printenv | grep -v affinity:container | sed -r 's/^(.*)=("?)(.*)\2$/export \1="\3"/g' > /adei/env
-/opt/scripts/adei-branch.sh
+LOCK_FILE=.lock
+(
+ flock -x 10
+ flock -x 11
+
+ /opt/scripts/adei-branch.sh
+
+) 10> /adei/cfg/$LOCK_FILE 11> /adei/src/$LOCK_FILE
+
cron -n -m '/usr/bin/procmail -d root'
diff --git a/docker-compose.yml b/docker-compose.yml
index 1f790ee..6c167db 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,6 +9,7 @@ services:
- tmp:/adei/tmp
- sys:/adei/sys
- cfg:/adei/cfg
+ - ovr:/adei/ovr
- mail:/var/spool/mail
- logs:/var/log/apache2
@@ -89,6 +90,20 @@ services:
- MYSQL_DATABASE=adei_tango
ports:
- 82:80
+
+ debug:
+ image: chsa/adei:latest
+ tty: true
+ entrypoint: /bin/bash
+ restart: always
+ volumes_from:
+ - data
+ links:
+ - mysql:adei-mysql
+ environment:
+ - ADEI_ENABLED_SETUPS=autogen
+ ports:
+ - 79:80
volumes:
db:
@@ -96,5 +111,6 @@ volumes:
tmp:
cfg:
sys:
+ ovr:
mail:
logs: