Commit 280a6213 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update azbyka functions

parent 9201cc05
#!/bin/bash #!/bin/bash
. functions . ./functions
# TODO: from alt's # TODO: from alt's
tune_yandex_mirror() tune_yandex_mirror()
...@@ -115,7 +115,7 @@ fi ...@@ -115,7 +115,7 @@ fi
# common projects (copy from base container) # common projects (copy from base container)
if [ -n "$VEIDORIG" ] ; then if [ -n "$VEIDORIG" ] ; then
# copy nginx config from a06 # copy nginx config from a06
if [ ! -s "/etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf" ] ; then if [ ! -s "/etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf" ] && [ -n "$STANDALONE" ] ; then
hostserver cat /etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf | sed -e "s|/home/|/azbyka/|" > /etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf hostserver cat /etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf | sed -e "s|/home/|/azbyka/|" > /etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf
hostserver cat /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf | sed -e "s|/home/|/azbyka/|"> /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf hostserver cat /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf | sed -e "s|/home/|/azbyka/|"> /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf
[ -s /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf ] || rm -f /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf [ -s /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf ] || rm -f /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf
...@@ -123,19 +123,19 @@ if [ -n "$VEIDORIG" ] ; then ...@@ -123,19 +123,19 @@ if [ -n "$VEIDORIG" ] ; then
fi fi
# hack # hack
VEPORT=$(printf "%03d" $(($VEID-100))) #VEPORT=$(printf "%03d" $(($VEID-100)))
cat <<EOF > /etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf #cat <<EOF > /etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf
# for site $ADOMAIN/$NAME ## for site $ADOMAIN/$NAME
upstream sites8$VEPORT { #upstream sites8$VEPORT {
server $VEIP; # server $VEIP;
} #}
EOF #EOF
serv nginx reload serv nginx reload
if [ ! -s "apache/$ACONF.conf" ] ; then #if [ ! -s "apache/$ACONF.conf" ] ; then
hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf # hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf
fi #fi
if [ -s apache/$ACONF.conf ] ; then if [ -s apache/$ACONF.conf ] ; then
cat apache/$ACONF.conf | st tee /tmp/$ACONF.conf >/dev/null cat apache/$ACONF.conf | st tee /tmp/$ACONF.conf >/dev/null
...@@ -143,9 +143,9 @@ serv nginx reload ...@@ -143,9 +143,9 @@ serv nginx reload
echo "Empty apache/$ACONF.conf, skipped" echo "Empty apache/$ACONF.conf, skipped"
fi fi
if [ ! -s apache/prepend.php ] ; then #if [ ! -s apache/prepend.php ] ; then
hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php > apache/prepend.php # hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php > apache/prepend.php
fi #fi
cat apache/prepend.php | st tee /tmp/prepend.php >/dev/null cat apache/prepend.php | st tee /tmp/prepend.php >/dev/null
st test -s /tmp/prepend.php || fatal "Empty prepend.php" st test -s /tmp/prepend.php || fatal "Empty prepend.php"
fi fi
......
...@@ -36,8 +36,10 @@ fi ...@@ -36,8 +36,10 @@ fi
# TODO # TODO
[ -n "$VEIP" ] || VEIP=$BASEIP.$VEID [ -n "$VEIP" ] || VEIP=$BASEIP.$VEID
STANDALONE=''
# Если не указан системный пользователь AUSER, считаем, что это отдельный проект # Если не указан системный пользователь AUSER, считаем, что это отдельный проект
if [ -z "$AUSER" ] ; then if [ -z "$AUSER" ] ; then
STANDALONE=1
if [ -n "$BASENAME" ] ; then if [ -n "$BASENAME" ] ; then
AUSER=${BASENAME}_$NAME AUSER=${BASENAME}_$NAME
ADOMAIN="$NAME.$DOMAIN" ADOMAIN="$NAME.$DOMAIN"
......
...@@ -97,6 +97,10 @@ VEPORT=$(printf "%03d" $(($VEID-100))) ...@@ -97,6 +97,10 @@ VEPORT=$(printf "%03d" $(($VEID-100)))
ECODE=$((430+$VEID-100)) ECODE=$((430+$VEID-100))
echo "VEPORT: $VEPORT ECODE: $ECODE" echo "VEPORT: $VEPORT ECODE: $ECODE"
print_nginx_conf >$NGINXSUBDIR/$NAME.conf print_nginx_conf >$NGINXSUBDIR/$NAME.conf
if [ "$NGINX_disable_static_stub" ] ; then
sed -i -e "s|\(.*static-stub.*\)|#\1|" $NGINXSUBDIR/$NAME.conf
fi
if ! grep -q $UPSTREAMNAME /etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf ; then if ! grep -q $UPSTREAMNAME /etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf ; then
print_upstream_conf >/etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf print_upstream_conf >/etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf
fi fi
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