mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-26 20:54:21 +01:00
fix ES upgrade script for classical docker installations
This commit is contained in:
parent
ffbe3e0b4a
commit
770ae9aaef
@ -80,10 +80,14 @@ This procedure is not easy to follow so if you don't need to write some code for
|
||||
Your system may provide a pre-packaged version of docker in its repositories, but this version may be outdated.
|
||||
Please refer to [ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [debian](https://docs.docker.com/install/linux/docker-ce/debian/) or [MacOS](https://docs.docker.com/docker-for-mac/install/) documentation to setup a recent version of docker.
|
||||
|
||||
5. Add your current user to the docker group and restart.
|
||||
5. Add your current user to the docker group, to allow using docker without sudo.
|
||||
This may not be required on some systems, if docker was already installed.
|
||||
```bash
|
||||
# add the docker group if it doesn't already exist
|
||||
sudo groupadd doker
|
||||
# add the current user to the docker group
|
||||
sudo usermod -aG docker $(whoami)
|
||||
# restart to validate changes
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
|
@ -334,8 +334,11 @@ upgrade_docker()
|
||||
local name=$(docker inspect -f '{{.Name}}' "$id" | sed s:^/::g)
|
||||
# get container network name
|
||||
local network=$(docker inspect -f '{{.NetworkSettings.Networks}}' "$id" | sed 's/map\[\(.*\):0x[a-f0-9]*\]/\1/')
|
||||
# get container mapping to data folder
|
||||
local mounts=$(docker inspect -f '{{.Mounts}}' "$id" | sed 's/} {/\n/g' | sed 's/^\[\?{\?bind[[:blank:]]*\([^[:blank:]]*\)[[:blank:]]*\([^[:blank:]]*\)[[:blank:]]*true \(rprivate\)\?}\?]\?$/-v \1:\2/g' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g')
|
||||
# get container mappings
|
||||
local volumes=$(docker inspect -f '{{.Mounts}}' "$id" | sed 's/} {/\n/g' | sed 's/^\[\?{\?bind[[:blank:]]*\([^[:blank:]]*\)[[:blank:]]*\([^[:blank:]]*\)[[:blank:]]*true \(rprivate\)\?}\?]\?$/-v \1:\2/g')
|
||||
local mounts=$(echo "$volumes" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g')
|
||||
# get mapped ports
|
||||
local ports=$(docker inspect -f '{{.NetworkSettings.Ports}}' "$id") | sed 's!\([0-9]*\)/tcp:\[{0\.0\.0\.0 \([0-9]*\)}\]!\1:\2!g' | sed 's/^map\[\(.*\)\]/\1/'| sed 's/^map\[\(.*\)\]/\1/' | sed 's/ / -p /' | sed 's/^/-p /'
|
||||
prepare_upgrade
|
||||
# stop current elastic
|
||||
docker stop "$name"
|
||||
@ -347,9 +350,15 @@ upgrade_docker()
|
||||
then
|
||||
image_name="elasticsearch-oss:$target"
|
||||
image="docker.elastic.co/elasticsearch/$image_name"
|
||||
elif [ $target = '5.6' ]
|
||||
then
|
||||
configdir=$(echo "$volumes" | grep config | awk -F'[ :]' '{print $2}')
|
||||
echo -e "\nCopying ElasticSearch 2.4 configuration files from $(pwd)/docker to $configdir..."
|
||||
sudo cp docker/elasticsearch.yml "$configdir"
|
||||
sudo cp docker/log4j2.properties "$configdir"
|
||||
fi
|
||||
docker pull "$image"
|
||||
echo docker run --restart=always -d --name="$name" --network="$network" --ip="$ES_IP" "$mounts" "$image_name" | bash
|
||||
echo docker run --restart=always -d --name="$name" --network="$network" --ip="$ES_IP" "$mounts" "$ports" "$image_name" | bash
|
||||
wait_for_online
|
||||
wait_for_green_status
|
||||
# check status
|
||||
|
Loading…
x
Reference in New Issue
Block a user