From 8e467b7509072f52ab4f9e0fdf51643294a0aa53 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Wed, 26 Feb 2020 17:40:13 +0100 Subject: [PATCH] Added mounting volume with openstack. --- docker-compose.yml | 10 ++-------- start.sh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100755 start.sh diff --git a/docker-compose.yml b/docker-compose.yml index 8f3aa6e..9bae496 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,15 +12,9 @@ services: - '80' - '443' volumes: - - onlyoffice_data:/var/www/onlyoffice/Data - - onlyoffice_log:/var/log/onlyoffice + - /mnt/volumes/onlyoffice_data/data:/var/www/onlyoffice/Data + - /mnt/volumes/onlyoffice_log/data:/var/log/onlyoffice networks: reverse-proxy: external: true - -volumes: - onlyoffice_data: - external: true - onlyoffice_log: - external: true diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..05f9c38 --- /dev/null +++ b/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash +source ~/openrc.sh +INSTANCE=$(/home/yohan/env_py3/bin/openstack server show -c id --format value $(hostname)) +mkdir -p /mnt/volumes/onlyoffice_data +if ! mountpoint -q /mnt/volumes/onlyoffice_data +then + VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show onlyoffice_data -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/onlyoffice_data +fi +mkdir -p /mnt/volumes/onlyoffice_log +if ! mountpoint -q /mnt/volumes/onlyoffice_log +then + VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show onlyoffice_log -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/onlyoffice_log +fi + +sudo docker-compose up -d