Added shutdown scripts. Added HTTP_X_FORWARDED_FOR in reverse-proxy configuration. Added mounting volumes with openstack. Auto-creation of networks.

This commit is contained in:
yohan 2020-02-22 22:21:40 +01:00
parent ed1f45e8ed
commit d2d33bd76b
5 changed files with 54 additions and 9 deletions

View File

@ -4,7 +4,7 @@ services:
nextcloud:
container_name: nextcloud-full
image: nextcloud:16.0.6
image: nextcloud:17.0.3
build: ./docker/.examples/dockerfiles/full/apache/
restart: unless-stopped
networks:
@ -14,8 +14,8 @@ services:
expose:
- "80/tcp"
volumes:
- nextcloud:/var/www/html:Z
- ./supervisord.conf:/etc/supervisor/supervisord.conf
- /mnt/volumes/nextcloud/data:/var/www/html:Z
- ./supervisord.conf:/supervisord.conf
- ./run_elasticsearch.sh:/run_elasticsearch.sh
networks:
@ -28,8 +28,3 @@ networks:
mailnet:
external: true
volumes:
nextcloud:
external: true

22
down.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
sudo docker-compose kill -s SIGTERM
COUNT=1
ATTEMPT=0
while [ $COUNT -ne 0 ] && [ $ATTEMPT -lt 10 ]
do
sleep 1
COUNT=$(sudo docker-compose top | wc -l)
ATTEMPT=$(( $ATTEMPT + 1 ))
done
if [ $COUNT -eq 0 ]
then
sudo docker-compose down
exit 0
else
echo "ERROR: Some containers are still running"
sudo docker-compose ps
exit 1
fi

View File

@ -1,4 +1,6 @@
<?php
$CONFIG = array (
'overwriteprotocol' => 'https',
'trusted_proxies' => array('172.19.0.2'),
'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'),
);

26
start_or_update.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
for NETWORK in mailnet mysqlnet reverse-proxy
do
sudo docker network inspect ${NETWORK} && continue
sudo docker network create ${NETWORK}
sudo docker network inspect ${NETWORK} || \
{ echo "ERROR: could not create network ${NETWORK}, exiting."; exit 1; }
done
test -f ~/openrc.sh || { echo "ERROR: ~/openrc.sh not found, exiting."; exit 1; }
source ~/openrc.sh
INSTANCE=$(~/env_py3/bin/openstack server show -c id --format value $(hostname))
for VOLUME in nextcloud
do
mkdir -p /mnt/volumes/${VOLUME}
if ! mountpoint -q /mnt/volumes/${VOLUME}
then
VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show ${VOLUME} -c id --format value)
test -e /dev/disk/by-id/*${VOLUME_ID:0:20} || nova volume-attach $INSTANCE $VOLUME_ID auto
sleep 3
sudo mount /dev/disk/by-id/*${VOLUME_ID:0:20} /mnt/volumes/${VOLUME}
mountpoint -q /mnt/volumes/${VOLUME} || { echo "ERROR: could not mount /mnt/volumes/${VOLUME}, exiting."; exit 1; }
fi
done
sudo -E bash -c 'docker-compose up -d --build'

View File

@ -13,7 +13,7 @@ done
if [ $COUNT -eq 0 ]
then
sudo docker-compose down
sudo docker-compose stop
exit 0
else
echo "ERROR: Some containers are still running"