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:
|
elasticsearch:
|
||||||
image: elasticsearch:$VERSION_ELASTICSEARCH
|
image: elasticsearch:$VERSION_ELASTICSEARCH
|
||||||
container_name: elasticsearch
|
container_name: elasticsearch
|
||||||
build: "https://git.scimetis.net/yohan/docker-elasticsearch.git"
|
#build: "https://git.scimetis.net/yohan/docker-elasticsearch.git"
|
||||||
environment:
|
environment:
|
||||||
- discovery.type=single-node
|
- discovery.type=single-node
|
||||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||||
@ -16,12 +16,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- reverse-proxy
|
- reverse-proxy
|
||||||
volumes:
|
volumes:
|
||||||
- elasticsearch_data:/usr/share/elasticsearch/data
|
- /mnt/volumes/elasticsearch_data/data:/usr/share/elasticsearch/data
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
reverse-proxy:
|
reverse-proxy:
|
||||||
external: true
|
external: true
|
||||||
|
|
||||||
volumes:
|
|
||||||
elasticsearch_data:
|
|
||||||
external: true
|
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# --force-recreate is used to recreate container when crontab file has changed
|
# --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
|
unset VERSION_ELASTICSEARCH
|
||||||
VERSION_ELASTICSEARCH=$(git ls-remote https://git.scimetis.net/yohan/docker-elasticsearch.git| head -1 | cut -f 1|cut -c -10) \
|
export 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'
|
|
||||||
|
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