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

update vz/azbyka

parent 71479c3c
...@@ -5,7 +5,7 @@ TEMPLATE=etersoft-p8 ...@@ -5,7 +5,7 @@ TEMPLATE=etersoft-p8
PKGPROFILE="apache2-php7" PKGPROFILE="apache2-php7"
# PHP # PHP
PHP_memory_limit=386M PHP_memory_limit=256M
PHP_max_execution_time=30 PHP_max_execution_time=30
# Site # Site
...@@ -13,3 +13,5 @@ DOMAIN=site.azbyka.ru ...@@ -13,3 +13,5 @@ DOMAIN=site.azbyka.ru
# Original container # Original container
VEIDORIG=193 VEIDORIG=193
BASENAME=azbyka
...@@ -18,6 +18,46 @@ TASK="$1" ...@@ -18,6 +18,46 @@ TASK="$1"
assure $AUSER 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() tune_php7()
{ {
# FIXME: php version # FIXME: php version
...@@ -62,6 +102,8 @@ EOF ...@@ -62,6 +102,8 @@ EOF
AllowOverride FileInfo\n\ AllowOverride FileInfo\n\
</Directory>\n\ </Directory>\n\
\n\ \n\
# due possible .htaccess rewrites\n\
Alias /server-status /var/empty\n\
<Location /server-status>\n\ <Location /server-status>\n\
SetHandler server-status\n\ SetHandler server-status\n\
#<IfModule authz_host_module>\n\ #<IfModule authz_host_module>\n\
...@@ -84,16 +126,7 @@ EOF ...@@ -84,16 +126,7 @@ EOF
groupadd $AUSER -g $AGROUPID groupadd $AUSER -g $AGROUPID
useradd -M $AUSER -u $AUSERID -g $AGROUPID #|| fatal useradd -M $AUSER -u $AUSERID -g $AGROUPID #|| fatal
if ! grep -q "Azbyka's hosts" /etc/hosts ; then tune_hosts
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
for i in $PKGPROFILE ; do for i in $PKGPROFILE ; do
case $i in case $i in
...@@ -113,4 +146,6 @@ for i in $PKGPROFILE ; do ...@@ -113,4 +146,6 @@ for i in $PKGPROFILE ; do
esac esac
done done
tune_monit
epm clean epm clean
...@@ -28,9 +28,9 @@ TASK="$1" ...@@ -28,9 +28,9 @@ TASK="$1"
# TODO # TODO
VEIP=192.168.3.$VEID VEIP=192.168.3.$VEID
AUSER=azbyka_$NAME AUSER=${BASENAME}_$NAME
# hack # hack
[ "$NAME" = "azbyka" ] && AUSER=azbyka [ "$NAME" = "$BASENAME" ] && AUSER=$BASENAME
assure $NAME assure $NAME
assure $VEID assure $VEID
......
...@@ -23,6 +23,7 @@ echo "# server-status, generated by $0 at $(date)" > $NGINXSTAT ...@@ -23,6 +23,7 @@ echo "# server-status, generated by $0 at $(date)" > $NGINXSTAT
for i in ves/*.task ; do for i in ves/*.task ; do
. $i . $i
[ "$NAME" = "azbyka" ] && NAME="" [ "$NAME" = "azbyka" ] && NAME=""
echo $NAME
SERVER="http://sites$((8000 + $VEID - 100))"; SERVER="http://sites$((8000 + $VEID - 100))";
add_nginx "$NAME" $SERVER >> $NGINXSTAT add_nginx "$NAME" $SERVER >> $NGINXSTAT
done 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