Commit 87bcd2c8 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update vz/azbyka

parent 71479c3c
......@@ -5,7 +5,7 @@ TEMPLATE=etersoft-p8
PKGPROFILE="apache2-php7"
# PHP
PHP_memory_limit=386M
PHP_memory_limit=256M
PHP_max_execution_time=30
# Site
......@@ -13,3 +13,5 @@ DOMAIN=site.azbyka.ru
# Original container
VEIDORIG=193
BASENAME=azbyka
......@@ -18,6 +18,46 @@ TASK="$1"
assure $AUSER
tune_hosts()
{
if ! grep -q "Azbyka's hosts" /etc/hosts ; then
cat <<EOF >>/etc/hosts
# Azbyka's hosts
192.168.3.188 memcached.azbyka
192.168.3.186 redis.azbyka
192.168.3.191 mysql.azbyka
192.168.3.191 mysql
192.168.3.191 mysql.$AUSER
EOF
fi
}
tune_monit()
{
epmi --auto --skip-installed monit
serv monit on
cat <<EOF >/etc/monit.d/httpd2
check process httpd2 with pidfile /var/run/httpd2/httpd.pid
group www
group apache2
start program = "/sbin/service httpd2 start"
# start program = "/usr/local/sbin/starthttpd2"
stop program = "/sbin/service httpd2 stop"
# stop program = "/usr/local/sbin/stophttpd2"
if failed host localhost port 80 protocol http
and request "/server-status" timeout 10 seconds 2 times within 3 cycles then alert
# if failed host localhost port 8008 protocol http
# and request "/server-status" timeout 20 seconds 3 times within 4 cycles then restart
EOF
subst "s|monit:secretword|monit:Dip74iFwwP12|g" /etc/monitrc
subst "s|set mailserver localhost|set mailserver mail.etersoft.ru port 587|g" /etc/monitrc
subst "s|set alert root@localhost|set alert lav@etersoft.ru|g" /etc/monitrc
# only on { timeout, action, nonexist }
subst "s|use address 127.0.0.1|use address 0.0.0.0|g" /etc/monitrc
serv monit reload
}
tune_php7()
{
# FIXME: php version
......@@ -62,6 +102,8 @@ EOF
AllowOverride FileInfo\n\
</Directory>\n\
\n\
# due possible .htaccess rewrites\n\
Alias /server-status /var/empty\n\
<Location /server-status>\n\
SetHandler server-status\n\
#<IfModule authz_host_module>\n\
......@@ -84,16 +126,7 @@ EOF
groupadd $AUSER -g $AGROUPID
useradd -M $AUSER -u $AUSERID -g $AGROUPID #|| fatal
if ! grep -q "Azbyka's hosts" /etc/hosts ; then
cat <<EOF >>/etc/hosts
# Azbyka's hosts
192.168.3.188 memcached.azbyka
192.168.3.186 redis.azbyka
192.168.3.191 mysql.azbyka
192.168.3.191 mysql
192.168.3.191 mysql.$AUSER
EOF
fi
tune_hosts
for i in $PKGPROFILE ; do
case $i in
......@@ -113,4 +146,6 @@ for i in $PKGPROFILE ; do
esac
done
tune_monit
epm clean
......@@ -28,9 +28,9 @@ TASK="$1"
# TODO
VEIP=192.168.3.$VEID
AUSER=azbyka_$NAME
AUSER=${BASENAME}_$NAME
# hack
[ "$NAME" = "azbyka" ] && AUSER=azbyka
[ "$NAME" = "$BASENAME" ] && AUSER=$BASENAME
assure $NAME
assure $VEID
......
......@@ -23,6 +23,7 @@ echo "# server-status, generated by $0 at $(date)" > $NGINXSTAT
for i in ves/*.task ; do
. $i
[ "$NAME" = "azbyka" ] && NAME=""
echo $NAME
SERVER="http://sites$((8000 + $VEID - 100))";
add_nginx "$NAME" $SERVER >> $NGINXSTAT
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment