Commit 68f8c0cb authored by Vitaly Lipatov's avatar Vitaly Lipatov

update azbyka creating

parent 87bcd2c8
......@@ -16,7 +16,9 @@ TASK="$1"
[ -s "$TASK" ] || fatal
. $TASK
assure $NAME
assure $AUSER
assure $ACONF
tune_hosts()
{
......@@ -85,11 +87,11 @@ EOF
ln -sr /etc/httpd2/conf/mods-available/remoteip.conf /etc/httpd2/conf/mods-enabled/remoteip.conf
# TODO
cp /tmp/$AUSER.conf /etc/httpd2/conf/sites-enabled/$AUSER.conf || fatal
cp /tmp/$ACONF.conf /etc/httpd2/conf/sites-enabled/$ACONF.conf || fatal
cp /tmp/prepend.php /etc/httpd2/conf/include/prepend.php || fatal
subst "s|^NameVirtualHost.*||g" /etc/httpd2/conf/sites-enabled/$AUSER.conf
subst "s|^<VirtualHost.*|<VirtualHost *:80>|g" /etc/httpd2/conf/sites-enabled/$AUSER.conf
subst "s|^NameVirtualHost.*||g" /etc/httpd2/conf/sites-enabled/$ACONF.conf
subst "s|^<VirtualHost.*|<VirtualHost *:80>|g" /etc/httpd2/conf/sites-enabled/$ACONF.conf
#PORT=$(grep "^<VirtualHost" /etc/httpd2/conf/sites-enabled/$AUSER.conf | sed -e "s|<VirtualHost \*:\([0-9]*\)>.*|\1|")
......@@ -112,8 +114,18 @@ EOF
# Allow from 91.232.225.0/24\n\
#</IfModule>\n\
</Location>\n\
# HACK for a02: \n\
Alias /$NAME/server-status /var/empty\n\
<Location /$NAME/server-status>\n\
SetHandler server-status\n\
#<IfModule authz_host_module>\n\
# Order deny,allow\n\
# Deny from all\n\
# Allow from 91.232.225.0/24\n\
#</IfModule>\n\
</Location>\n\
\n\
\1|" /etc/httpd2/conf/sites-enabled/$AUSER.conf
\1|" /etc/httpd2/conf/sites-enabled/$ACONF.conf
# fix remoteip
subst 's|LogFormat "%h|LogFormat "%a|g' /etc/httpd2/conf/mods-available/log_config.conf
......
......@@ -28,17 +28,38 @@ TASK="$1"
# TODO
VEIP=192.168.3.$VEID
AUSER=${BASENAME}_$NAME
# hack
[ "$NAME" = "$BASENAME" ] && AUSER=$BASENAME
#
if [ -z "$AUSER" ] ; then
if [ -n "$BASENAME" ] ; then
AUSER=${BASENAME}_$NAME
ADOMAIN="$NAME.$DOMAIN"
ACONF="$AUSER"
else
AUSER="$NAME"
ADOMAIN="$NAME.$DOMAIN"
ACONF="$AUSER"
fi
fi
if [ -z "$ADOMAIN" ] ; then
ADOMAIN="$NAME"
fi
if [ -z "$ACONF" ] ; then
ACONF="$NAME"
fi
assure $AUSER
assure $ADOMAIN
assure $ACONF
assure $NAME
assure $VEID
assure $VEIDORIG
if ! vzlist -a | grep " $VEIP " ; then
vzctl create $VEID --ostemplate=$TEMPLATE || fatal
vzctl set $VEID --name $NAME --hostname $NAME.$DOMAIN --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
fi
......@@ -70,7 +91,7 @@ st()
}
# TODO
cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$AUSER.conf | st tee /tmp/$AUSER.conf
cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf | st tee /tmp/$ACONF.conf
# /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
# etc/httpd2/conf/include/prepend.php || fatal
......@@ -81,8 +102,9 @@ ATASK=/tmp/$(basename $TASK)
# if we detected it before
echo "NAME=$NAME" | st tee -a $ATASK
echo "AUSER=$AUSER" | st tee -a $ATASK
echo "ACONF=$ACONF" | st tee -a $ATASK
echo "ADOMAIN=$ADOMAIN" | st tee -a $ATASK
auserid=$(vzctl exec $VEIDORIG id -u $AUSER)
[ -n "$auserid" ] || fatal "can't get user id"
......
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