Moved image building from docker-compose to startup script. Added mounting volume with openstack.

This commit is contained in:
yohan 2020-02-26 17:52:40 +01:00
parent c1aee48deb
commit ec5ba7730b
2 changed files with 34 additions and 18 deletions

View File

@ -4,29 +4,29 @@ services:
apache-for-fpm:
image: apache-scuttle:$VERSION_APACHE_FPM
build: "https://git.scimetis.net/yohan/docker-apache-for-fpm.git"
#build: "https://git.scimetis.net/yohan/docker-apache-for-fpm.git"
container_name: apache-scuttle
restart: always
networks:
- reverse-proxy
- php5-fpm
volumes:
- scuttle_code:/var/www/html:z
- /mnt/volumes/scuttle_code/data:/var/www/html:z
environment:
FPM_HOST: php5-fpm:9000
SERVER_NAME: scuttle.scimetis.net
php5-fpm:
image: php5-fpm:$VERSION_PHP_FPM
build: "https://git.scimetis.net/yohan/docker-php5-fpm.git"
#build: "https://git.scimetis.net/yohan/docker-php5-fpm.git"
container_name: php5-fpm
restart: always
networks:
- php5-fpm
- mysqlnet
volumes:
- scuttle_code:/var/www/html:z
- scuttle_php5-fpm_conf:/etc/php5/fpm/pool.d:Z
- /mnt/volumes/scuttle_code/data:/var/www/html:z
- /mnt/volumes/scuttle_php5-fpm_conf/data:/etc/php5/fpm/pool.d:Z
networks:
@ -37,11 +37,3 @@ networks:
mysqlnet:
external: true
volumes:
scuttle_code:
external: true
scuttle_php5-fpm_conf:
external: true

View File

@ -1,6 +1,30 @@
#!/bin/bash
unset VERSION_APACHE_FPM
unset VERSION_PHP_FPM
VERSION_APACHE_FPM=$(git ls-remote https://git.scimetis.net/yohan/docker-apache-for-fpm.git| head -1 | cut -f 1|cut -c -10) \
VERSION_PHP_FPM=$(git ls-remote https://git.scimetis.net/yohan/docker-php5-fpm.git| head -1 | cut -f 1|cut -c -10) \
source ~/openrc.sh
INSTANCE=$(/home/yohan/env_py3/bin/openstack server show -c id --format value $(hostname))
mkdir -p /mnt/volumes/scuttle_code /mnt/volumes/scuttle_php5-fpm_conf
if ! mountpoint -q /mnt/volumes/scuttle_code
then
VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show scuttle_code -c id --format value)
test -e /dev/disk/by-id/*${VOLUME_ID:0:20} || nova volume-attach $INSTANCE $VOLUME_ID auto
sudo mount /dev/disk/by-id/*${VOLUME_ID:0:20} /mnt/volumes/scuttle_code
fi
if ! mountpoint -q /mnt/volumes/scuttle_php5-fpm_conf
then
VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show scuttle_php5-fpm_conf -c id --format value)
test -e /dev/disk/by-id/*${VOLUME_ID:0:20} || nova volume-attach $INSTANCE $VOLUME_ID auto
sudo mount /dev/disk/by-id/*${VOLUME_ID:0:20} /mnt/volumes/scuttle_php5-fpm_conf
fi
unset VERSION_APACHE_FPM VERSION_PHP_FPM
export VERSION_APACHE_FPM=$(git ls-remote https://git.scimetis.net/yohan/docker-apache-for-fpm.git| head -1 | cut -f 1|cut -c -10)
export VERSION_PHP_FPM=$(git ls-remote https://git.scimetis.net/yohan/docker-php5-fpm.git| head -1 | cut -f 1|cut -c -10)
mkdir -p ~/build
git clone https://git.scimetis.net/yohan/docker-apache-for-fpm.git ~/build/docker-apache-for-fpm
sudo docker build -t apache-scuttle:$VERSION_APACHE_FPM ~/build/docker-apache-for-fpm
git clone https://git.scimetis.net/yohan/docker-php5-fpm.git ~/build/docker-php5-fpm
sudo docker build -t php5-fpm:$VERSION_PHP_FPM ~/build/docker-php5-fpm
sudo -E bash -c 'docker-compose up -d'
rm -rf ~/build