summaryrefslogtreecommitdiffstats
path: root/adei/scripts
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
commit79c76eaef5039276bb3a8725ac8c9f05f89ef0de (patch)
tree1bde68d36ce44d75fafc6dfb41f5f6d2b555815f /adei/scripts
parentbc1b77dc912adfd040d432972e2d3256c9ea2065 (diff)
downloadadei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.gz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.bz2
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.xz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.zip
Optimize Dockerfile
Diffstat (limited to 'adei/scripts')
-rwxr-xr-xadei/scripts/adei-branch.sh80
-rwxr-xr-xadei/scripts/configure.sh14
-rwxr-xr-xadei/scripts/log.sh54
-rw-r--r--adei/scripts/override.sed19
-rwxr-xr-xadei/scripts/run-apache.sh66
-rwxr-xr-xadei/scripts/run-cron.sh7
6 files changed, 0 insertions, 240 deletions
diff --git a/adei/scripts/adei-branch.sh b/adei/scripts/adei-branch.sh
deleted file mode 100755
index e56f792..0000000
--- a/adei/scripts/adei-branch.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#! /bin/bash
-
-function branch {
- url="$1"
- bzr branch "$url"
-}
-
-if [ ! -d /adei/src -o ! -d /adei/tmp -o ! -d /adei/sys -o ! -d /adei/cfg ]; then
- echo "Incorrect volume configration, we expect /adei folder with populated docker volumes"
- exit 1
-fi
-
-LOCK_FILE=.lock
-
-#(
-# flock -x 10
-# if [ ! -f /adei/sys/adei.cron.sh ]; then
-# cp -a /opt/configs/*.cron.sh /adei/sys
-# fi
-#) 10> /adei/sys/$LOCK_FILE
-
-
-(
- flock -x 10
- flock -x 11
-
-
- if [ ! -f /adei/cfg/config.actual.php ]; then
- cp -a /opt/configs/config.*.php /adei/cfg/
- fi
-
- if [ ! -f /adei/src/VERSION ]; then
- bzr branch -r $ADEI_REVISION --use-existing-dir http://darksoft.org/bzr/adei/trunk/ /adei/src
- (
- cd /adei/src
- make
-
- [ -n "$ADEI_REPOSITORY" ] && bzr config push_location=${ADEI_REPOSITORY}/adei
-
- [ -d tmp ] && rm tmp
- ln -s ../tmp tmp
- chmod 0777 /adei/tmp
-
- # Additional setups are clonned based on the environment for adei container creation
- # but can be easily added in future. We cache all non-excluded setups. The .exclude
- # file is removed afterwards from all
-
- ln -s ../cfg/config.actual.php config.actual.php
- ln -s ../cfg/config.override.php config.override.php
- )
- fi
-
- (
- cd /adei/src
- for setup in $ADEI_ENABLED_SETUPS $ADEI_SETUP; do
- if [[ ! -a setups/$setup ]]; then
- if [[ ! -a /adei/cfg/$setup ]]; then
- (
- cd /adei/cfg/
- if [[ "$setup" == *-logs ]]; then
- branch "http://darksoft.org/bzr/adei/setups/$setup" &> /dev/null
- [ $? -eq 0 ] || cp -ar /adei/src/setups/logs $setup
- else
- branch "http://darksoft.org/bzr/adei/setups/$setup"
- fi
- (
- cd $setup
- [ -n "$ADEI_REPOSITORY" -a -d .bzr ] && bzr config push_location=${ADEI_REPOSITORY}/adei-setups/$setup
- )
- )
- fi
- if [ -d ../cfg/$setup ]; then
- ln -s ../../cfg/$setup setups/$setup
- fi
- fi
- done
- )
-
- touch /adei/cfg/.ready
-) 10> /adei/cfg/$LOCK_FILE 11> /adei/src/$LOCK_FILE
diff --git a/adei/scripts/configure.sh b/adei/scripts/configure.sh
deleted file mode 100755
index 458c3dc..0000000
--- a/adei/scripts/configure.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /bin/bash
-
-chmod 0777 /adei/tmp
-
-sed -i'' -re 's/^.*pam_loginuid\.so.*$//' /etc/pam.d/crond
-
-sed -i'' -re 's/APACHE_MODULES="(.*)"/APACHE_MODULES="\1 php5 rewrite proxy mod_proxy_http access_compat"/' /etc/sysconfig/apache2
-sed -i'' -rf /opt/scripts/override.sed /etc/apache2/default-server.conf
-sed -i'' -re 's/short_open_tag\s*=.*/short_open_tag = On/' /etc/php5/apache2/php.ini
-sed -i'' -re 's@session.save_path\s*=.*@session.save_path=/tmp@' /etc/php5/apache2/php.ini
-
-# Docker allows to view stdout/stderr streams individually, but OpenShift not. So we skip CustomLog for now
-# Redirection fails here. So lets keep logging to stdout for now.
-sed -i'' -re 's@^ErrorLog .*@ErrorLog "|/usr/bin/tee -a /var/log/apache2/error_log"@' /etc/apache2/httpd.conf
diff --git a/adei/scripts/log.sh b/adei/scripts/log.sh
deleted file mode 100755
index 4237682..0000000
--- a/adei/scripts/log.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /bin/bash
-
-max_age=10
-max_mails=10
-log_lines=50
-
-cur=`date +%s`
-since=$(($cur - $max_age * 60))
-
-echo "Apache error log"
-echo "================"
-tail -n $log_lines /var/log/apache2/error_log | perl -MDateTime::Format::Strptime -F';' -ane '
- my $parser = DateTime::Format::Strptime->new(
- pattern => "%a %b %d %H:%M:%S.%N %Y"
- );
- my $formater = DateTime::Format::Strptime->new(
- pattern => "%s"
- );
- if (/^\[([^]]+)\]/) {
- $last = $formater->format_datetime($parser->parse_datetime($1));
- } elsif ($last !~ /\d+/) {
- $last = 0;
- }
- print "$last $_\n";
-' | awk "{ if (\$1 > $since) print \$0 }" | cut -d ' ' -f 2-
-echo
-echo
-
-
-mails=`mailutil check | cut -d ' ' -f 6`
-if [ "$mails" == "in" ]; then
- mails=`mailutil check | cut -d ' ' -f 4`
-fi
-
-if [ $mails -gt 0 ]; then
- [ $mails -gt $max_mails ] && mails=$max_mails
-
- cur=`date -u +%s`
- for id in `seq $mails -1 1`; do
- mail=$(($mails - $id + 1))
-
- lastmail=`echo "type $mail" | mailx -R "" -N`
- dt=`echo "$lastmail" | grep "From" | head -n 1 | cut -d ' ' -f 3-`
- last=`date -u --date "$dt" +%s`
- since=$((($cur - $last) / 60))
- if [ $since -le $max_age ]; then
- echo "Cron reports on$dt"
- echo "========================================"
- echo "$lastmail" | sed -e '1,/^$/d' | head -n 10
- echo
- echo
- fi
- done
-fi
diff --git a/adei/scripts/override.sed b/adei/scripts/override.sed
deleted file mode 100644
index 7b96a5b..0000000
--- a/adei/scripts/override.sed
+++ /dev/null
@@ -1,19 +0,0 @@
-\,<Directory "/srv/www/htdocs">, {
- :loop
-
- \,</Directory>, {
- b exit
- }
-
- s/^(\s*Options|\s*AllowOverride).*/\1 All/
- n
-
- b loop
-}
-\,/adei/cfg/apache.conf, {
- $ ! d
-}
-\,/adei/cfg/apache.conf, ! {
- $aInclude /adei/cfg/apache.conf
-}
-:exit
diff --git a/adei/scripts/run-apache.sh b/adei/scripts/run-apache.sh
deleted file mode 100755
index 202df62..0000000
--- a/adei/scripts/run-apache.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#! /bin/bash
-
-LOCK_FILE=.lock
-(
- flock -x 10
- if [ ! -f /adei/cfg/apache.conf ]; then
- cp -a /opt/configs/apache* /adei/cfg
- fi
-) 10> /adei/cfg/$LOCK_FILE
-
-
-function ised {
-#Creates temporary file in the file folder
-# sed -i'' "$@"
-
- tmp=$(mktemp)
- fn="${@: -1}"
- echo $fn
- sed "$@" > "$tmp"
- cat "$tmp" > "$fn"
-
- rm -f "$tmp"
-}
-
-#Keep 80 & 443
-#ised -re '/Listen/ { /(80|443)/!d }' /etc/apache2/listen.conf
-#if [ -n "$ADEI_PORTS" ]; then
-# for port in $ADEI_PORTS; do
-# [ $port -eq 80 ] && continue
-# [ $port -eq 443 ] && continue
-# echo "Listen $port" >> /etc/apache2/listen.conf
-# done
-#fi
-
-if [ -n "$ADEI_PORTS" ]; then
- echo -n "" > /etc/apache2/listen.conf
- for port in $ADEI_PORTS; do
- echo "Listen $port" >> /etc/apache2/listen.conf
- done
-fi
-
-if [ -n "$APACHE_SERVERS" -a "$APACHE_SERVERS" -ne 0 ]; then
- if [ $APACHE_SERVERS -eq 1 ]; then
- start=1
- limit=1
- min_spare=1
- max_spare=1
- elif [ $APACHE_SERVERS -lt 10 ]; then
- start=$(($APACHE_SERVERS / 2))
- limit=$APACHE_SERVERS
- min_spare=$start
- max_spare=$limit
- else
- start=0
- limit=$APACHE_SERVERS
- min_spare=0
- max_spare=0
- fi
- [ $start -eq 0 ] || ised -re "s/StartServers(.*)/StartServers $start/" /etc/apache2/server-tuning.conf
- [ $limit -eq 0 ] || ised -re "s/MaxClients(.*)/MaxClients $limit/" /etc/apache2/server-tuning.conf
- [ $min_spare -eq 0 ] || ised -re "s/MinSpareServers(.*)/MinSpareServers $min_spare/" /etc/apache2/server-tuning.conf
- [ $max_spare -eq 0 ] || ised -re "s/MaxSpareServers(.*)/MaxSpareServers $max_spare/" /etc/apache2/server-tuning.conf
-fi
-
-rm -f /tmp/httpd.pid
-/usr/sbin/apache2ctl start -D FOREGROUND
diff --git a/adei/scripts/run-cron.sh b/adei/scripts/run-cron.sh
deleted file mode 100755
index 5f4b9e2..0000000
--- a/adei/scripts/run-cron.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/bash
-
-printenv | grep -v affinity:container | sed -r 's/^(.*)=("?)(.*)\2$/export \1="\3"/g' > /adei/env
-
-/opt/scripts/adei-branch.sh
-
-cron -n -m '/usr/bin/procmail -d root'