Moved image building from docker-compose to startup script. Added mounting volume with openstack.
This commit is contained in:
parent
f7b94ab289
commit
7ce80f9f12
@ -5,7 +5,7 @@ services:
|
||||
elasticsearch:
|
||||
image: elasticsearch:$VERSION_ELASTICSEARCH
|
||||
container_name: elasticsearch
|
||||
build: "https://git.scimetis.net/yohan/docker-elasticsearch.git"
|
||||
#build: "https://git.scimetis.net/yohan/docker-elasticsearch.git"
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
@ -16,12 +16,8 @@ services:
|
||||
networks:
|
||||
- reverse-proxy
|
||||
volumes:
|
||||
- elasticsearch_data:/usr/share/elasticsearch/data
|
||||
- /mnt/volumes/elasticsearch_data/data:/usr/share/elasticsearch/data
|
||||
|
||||
networks:
|
||||
reverse-proxy:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
elasticsearch_data:
|
||||
external: true
|
||||
|
@ -1,5 +1,23 @@
|
||||
#!/bin/bash
|
||||
# --force-recreate is used to recreate container when crontab file has changed
|
||||
source ~/openrc.sh
|
||||
INSTANCE=$(/home/yohan/env_py3/bin/openstack server show -c id --format value $(hostname))
|
||||
mkdir -p /mnt/volumes/elasticsearch_data
|
||||
if ! mountpoint -q /mnt/volumes/elasticsearch_data
|
||||
then
|
||||
VOLUME_ID=$(/home/yohan/env_py3/bin/openstack volume show elasticsearch_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/elasticsearch_data
|
||||
fi
|
||||
|
||||
unset VERSION_ELASTICSEARCH
|
||||
VERSION_ELASTICSEARCH=$(git ls-remote https://git.scimetis.net/yohan/docker-elasticsearch.git| head -1 | cut -f 1|cut -c -10) \
|
||||
sudo -E bash -c 'docker-compose up -d --force-recreate'
|
||||
export VERSION_ELASTICSEARCH=$(git ls-remote https://git.scimetis.net/yohan/docker-elasticsearch.git| head -1 | cut -f 1|cut -c -10)
|
||||
|
||||
mkdir -p ~/build
|
||||
git clone https://git.scimetis.net/yohan/docker-elasticsearch.git ~/build/docker-elasticsearch
|
||||
sudo docker build -t elasticsearch:$VERSION_ELASTICSEARCH ~/build/docker-elasticsearch
|
||||
|
||||
sudo -E bash -c 'docker-compose up -d --force-recreate'
|
||||
|
||||
rm -rf ~/build
|
||||
|
Loading…
Reference in New Issue
Block a user