Commit 863afa57 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update

parent 68f8c0cb
...@@ -7,6 +7,7 @@ PKGPROFILE="apache2-php7" ...@@ -7,6 +7,7 @@ PKGPROFILE="apache2-php7"
# PHP # PHP
PHP_memory_limit=256M PHP_memory_limit=256M
PHP_max_execution_time=30 PHP_max_execution_time=30
PHP_post_max_size=40M
# Site # Site
DOMAIN=site.azbyka.ru DOMAIN=site.azbyka.ru
......
...@@ -8,7 +8,7 @@ CONFDIR=/vz/root/900/etc/nginx/sites-enabled.d/azbyka.d ...@@ -8,7 +8,7 @@ CONFDIR=/vz/root/900/etc/nginx/sites-enabled.d/azbyka.d
#for task in deti parkhomenko stenyaev molitvoslov ; do #for task in deti parkhomenko stenyaev molitvoslov ; do
#for task in bogosluzhenie chinaorthodox ; do #for task in bogosluzhenie chinaorthodox ; do
#for task in viktorina shorohova orthodoxy ; do #for task in viktorina shorohova orthodoxy ; do
for task in al-masih 03 ; do for task in days ; do
veid=$(grep sites80 $CONFDIR/$task.conf | sed -e "s|.*//sites80\([0-9][0-9]\).*|\1|" | head -n1) veid=$(grep sites80 $CONFDIR/$task.conf | sed -e "s|.*//sites80\([0-9][0-9]\).*|\1|" | head -n1)
[ -n "$veid" ] || { echo "skip $task" ; continue ; } [ -n "$veid" ] || { echo "skip $task" ; continue ; }
cat <<EOF >ves/$task.task cat <<EOF >ves/$task.task
......
...@@ -68,6 +68,12 @@ tune_php7() ...@@ -68,6 +68,12 @@ tune_php7()
#[ -s php7.add ] && cat php7.add | st tee -a $aphp #[ -s php7.add ] && cat php7.add | st tee -a $aphp
[ -n "$PHP_memory_limit" ] && subst "s|^memory_limit =.*|memory_limit = $PHP_memory_limit|" $aphp [ -n "$PHP_memory_limit" ] && subst "s|^memory_limit =.*|memory_limit = $PHP_memory_limit|" $aphp
[ -n "$PHP_max_execution_time" ] && subst "s|^max_execution_time = .*|max_execution_time = $PHP_max_execution_time|" $aphp [ -n "$PHP_max_execution_time" ] && subst "s|^max_execution_time = .*|max_execution_time = $PHP_max_execution_time|" $aphp
if [ -n "$PHP_post_max_size" ] ; then
subst "s|^post_max_size = .*|post_max_size = $PHP_post_max_size|" $aphp
subst "s|^upload_max_filesize = .*|upload_max_filesize = $PHP_post_max_size|" $aphp
fi
PHP_max_file_uploads=200
subst "s|^max_file_uploads = .*|max_file_uploads = $PHP_max_file_uploads|" $aphp
} }
tune_apache2() tune_apache2()
...@@ -127,6 +133,19 @@ EOF ...@@ -127,6 +133,19 @@ EOF
\n\ \n\
\1|" /etc/httpd2/conf/sites-enabled/$ACONF.conf \1|" /etc/httpd2/conf/sites-enabled/$ACONF.conf
if ! grep -q mpm_itk_module /etc/httpd2/conf/extra-available/httpd-mpm.conf ; then
subst "s|\(# worker MPM.*\)|\
<IfModule mpm_itk_module>\n\
StartServers 1\n\
MinSpareServers 2\n\
MaxSpareServers 5\n\
MaxClients 7\n\
MaxRequestsPerChild 0\n\
</IfModule>\n\
\n\
\1|" /etc/httpd2/conf/extra-available/httpd-mpm.conf
fi
# fix remoteip # fix remoteip
subst 's|LogFormat "%h|LogFormat "%a|g' /etc/httpd2/conf/mods-available/log_config.conf subst 's|LogFormat "%h|LogFormat "%a|g' /etc/httpd2/conf/mods-available/log_config.conf
...@@ -138,6 +157,10 @@ EOF ...@@ -138,6 +157,10 @@ 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
# locales
echo "%_install_langs ru_RU en_US" >/etc/rpm/macros
epmi --auto --skip-installed glibc-locales
tune_hosts tune_hosts
for i in $PKGPROFILE ; do for i in $PKGPROFILE ; do
......
...@@ -12,6 +12,15 @@ assure() ...@@ -12,6 +12,15 @@ assure()
[ -n "$1" ] || fatal "empty" [ -n "$1" ] || fatal "empty"
} }
hostserver()
{
if [ $(hostname) = "a01.azbyka.ru" ] ; then
"$@"
else
ssh a01 "$@"
fi
}
if [ -s "base.task" ] ; then if [ -s "base.task" ] ; then
. base.task . base.task
fi fi
...@@ -60,7 +69,7 @@ assure $VEIDORIG ...@@ -60,7 +69,7 @@ assure $VEIDORIG
if ! vzlist -a | grep " $VEIP " ; then if ! vzlist -a | grep " $VEIP " ; then
vzctl create $VEID --ostemplate=$TEMPLATE || fatal vzctl create $VEID --ostemplate=$TEMPLATE || fatal
vzctl set $VEID --name $NAME --hostname $ADOMAIN --onboot yes --ipadd $VEIP --save || fatal vzctl set $VEID --name $NAME --hostname $ADOMAIN --onboot yes --ipadd $VEIP --save || fatal
vzctl set $VEID --shmpages 300M --physpages 1G --privvmpages 2G --tcprcvbuf unlimited --kmemsize 40M:45M --numproc 512 --dcachesize unlimited --save || fatal vzctl set $VEID --shmpages 300M --physpages 1G --privvmpages 3G --tcprcvbuf unlimited --kmemsize 70M:80M --numproc 512 --dcachesize unlimited --save || fatal
fi fi
if [ ! -s /etc/vz/conf/$VEID.mount ] ; then if [ ! -s /etc/vz/conf/$VEID.mount ] ; then
...@@ -80,20 +89,27 @@ if ! vzlist | grep $VEIP ; then ...@@ -80,20 +89,27 @@ if ! vzlist | grep $VEIP ; then
vzctl start $VEID || fatal vzctl start $VEID || fatal
fi fi
# TODO # TODO: first time only or force?
vzctl exec $VEID update_chrooted conf if true ; then
vzctl exec $VEID epmI eepm vzctl exec $VEID update_chrooted conf
vzctl exec $VEID epm --auto upgrade vzctl exec $VEID epmI eepm
vzctl exec $VEID epm --auto upgrade
fi
st() st()
{ {
vzctl exec $VEID "$@" vzctl exec $VEID "$@"
} }
# TODO if [ ! -s "apache/$AUSER.conf" ] ; then
cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf | st tee /tmp/$ACONF.conf cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf | st tee /tmp/$ACONF.conf
fi
[ -s apache/$AUSER.conf ] || fatal "Empty /tmp/$AUSER.conf"
cat apache/$AUSER.conf | st tee /tmp/$AUSER.conf
# /etc/httpd2/conf/sites-enabled/$AUSER.conf || fatal # /etc/httpd2/conf/sites-enabled/$AUSER.conf || fatal
cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php | st tee /tmp/prepend.php hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php | st tee /tmp/prepend.php
# etc/httpd2/conf/include/prepend.php || fatal # etc/httpd2/conf/include/prepend.php || fatal
# copy task into # copy task into
...@@ -106,11 +122,11 @@ echo "AUSER=$AUSER" | st tee -a $ATASK ...@@ -106,11 +122,11 @@ echo "AUSER=$AUSER" | st tee -a $ATASK
echo "ACONF=$ACONF" | st tee -a $ATASK echo "ACONF=$ACONF" | st tee -a $ATASK
echo "ADOMAIN=$ADOMAIN" | st tee -a $ATASK echo "ADOMAIN=$ADOMAIN" | st tee -a $ATASK
auserid=$(vzctl exec $VEIDORIG id -u $AUSER) auserid=$(hostserver vzctl exec $VEIDORIG id -u $AUSER)
[ -n "$auserid" ] || fatal "can't get user id" [ -n "$auserid" ] || fatal "can't get user id"
echo "AUSERID=$auserid" | st tee -a $ATASK echo "AUSERID=$auserid" | st tee -a $ATASK
agroupid=$(vzctl exec $VEIDORIG id -g $AUSER) agroupid=$(hostserver vzctl exec $VEIDORIG id -g $AUSER)
[ -n "$agroupid" ] || fatal "can't get group id" [ -n "$agroupid" ] || fatal "can't get group id"
echo "AGROUPID=$agroupid" | st tee -a $ATASK echo "AGROUPID=$agroupid" | st tee -a $ATASK
......
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