2020-02-22 21:21:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
for NETWORK in mailnet mysqlnet reverse-proxy
|
|
|
|
do
|
2020-02-23 15:56:51 +00:00
|
|
|
sudo docker network inspect ${NETWORK} &> /dev/null && continue
|
2020-02-22 21:21:40 +00:00
|
|
|
sudo docker network create ${NETWORK}
|
2020-02-23 15:56:51 +00:00
|
|
|
sudo docker network inspect ${NETWORK} &> /dev/null || \
|
2020-02-22 21:21:40 +00:00
|
|
|
{ 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
|
2020-02-26 17:39:34 +00:00
|
|
|
sudo mkdir -p /mnt/volumes/${VOLUME}
|
2020-02-22 21:21:40 +00:00
|
|
|
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'
|