Commit 4d8ebba5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

updates

parent 0c3f9257
......@@ -327,7 +327,9 @@ rmdir *.tar 2>/dev/null
# common project
if [ -n "$AUSERID" ] ; then
if [ -n "$DOCKID" ] ; then
tune_hosts_azbyka_a05
#tune_hosts_azbyka_a05
# set in docker-compose
true
else
tune_hosts_azbyka
fi
......
......@@ -87,38 +87,49 @@ assure $VEID
# TODO: do via docker compose
# TODO: user Dockerfile
if [ -n "$DOCKID" ] ; then
mkdir -p composers/$AUSER/
cat <<EOF > composers/$AUSER/docker-compose.yml
version: '3.3'
services:
mkdir -p composers/sites.d/
cat <<EOF > composers/sites.d/$AUSER.yml
$AUSER:
container_name: $AUSER
restart: always
image: docker.hub.eterfund.ru/2hatokhin/containers/altlinux-p9:latest
build: dockers/altlinux-p9-apache2-php7
command:
- /sbin/systemd
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- $HOSTHOME/$AUSER:/home/$AUSER
EOF
if [ -n "$DOCKVOLUME" ] ; then
cat <<EOF >> composers/sites.d/$AUSER.yml
- $DOCKVOLUME
EOF
fi
cat <<EOF >> composers/sites.d/$AUSER.yml
cap_add:
- SYS_ADMIN
extra_hosts:
# - "mysql:172.18.0.3"
- "memcached:172.18.0.2"
- "redis:172.18.0.2"
- "sphinx.azbyka:$SPHINXHOST"
- "memcached memcached.azbyka:$MEMCACHEDHOST"
- "redis redis.azbyka:$MEMCACHEDHOST"
- "mysql mysql.azbyka mysql.$AUSER:$MYSQLHOST"
- "mariadb mariadb.azbyka mariadb.$AUSER:$MYSQLHOST"
networks:
- default
# default:
# Error response from daemon: Invalid address 178.18.0.125: It does not belong to any of this network's subnets
# ipv4_address: $VEIP
networks:
default:
external:
name: azbyka_default
default:
ipv4_address: $VEIP
EOF
cd composers/$AUSER
docker-compose create || fatal
cd -
composers/update_compose.sh
#cd composers
DOCKID=$AUSER
#evz destroy $DOCKID
docker-compose -f composers/docker-compose.yml -p $BASENAME create $DOCKID || fatal
#cd -
docker start $DOCKID || fatal
VEIP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DOCKID)
#VEIP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DOCKID)
else
if ! vzlist -a | grep " $VEIP " ; then
vzctl create $VEID --ostemplate=$TEMPLATE || fatal
......@@ -161,9 +172,11 @@ st()
# TODO: first time only or force?
if true ; then
st update_chrooted conf
st epm update
st epm --auto install eepm
st epm --auto upgrade
if [ -n "$VEIDORIG" ] ; then
st epm update
st epm --auto install eepm
st epm --auto upgrade
fi
fi
......@@ -171,8 +184,8 @@ fi
if [ -n "$VEIDORIG" ] ; then
# copy nginx config from a01
if [ ! -s "/etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf" ] ; then
hostserver cat /var/lib/vz/root/900/etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf > /etc/nginx/sites-enabled.d/azbyka.d/$NAME.conf
hostserver cat /var/lib/vz/root/900/etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf > /etc/nginx/sites-enabled.d/azbyka.d/$NAME-manual.conf
hostserver cat /var/lib/vz/root/900/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 /var/lib/vz/root/900/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
hostserver cat /var/lib/vz/root/900/etc/nginx/include/static-fallback-$NAME.conf > /etc/nginx/include/static-fallback-$NAME.conf
fi
......@@ -186,7 +199,7 @@ upstream sites8$VEPORT {
}
EOF
serv nginx reload
if [ ! -s "apache/$ACONF.conf" ] ; then
hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf
......
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