mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 03:20:12 -08:00
update portainer based on which host script is running on
This commit is contained in:
BIN
.update-portainer.sh.swp
Normal file
BIN
.update-portainer.sh.swp
Normal file
Binary file not shown.
@@ -1,3 +1,47 @@
|
||||
docker stop portainer
|
||||
docker rm portainer
|
||||
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ee:latest
|
||||
#!/bin/bash
|
||||
|
||||
function run_io () {
|
||||
docker run -d -p 9001:9001 --name=${image_name} --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/${portainer_image}
|
||||
|
||||
}
|
||||
|
||||
function run_vperanda () {
|
||||
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=${image_name} --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/${portainer_image}
|
||||
}
|
||||
|
||||
portainer_image=""
|
||||
image_name=""
|
||||
|
||||
case ${HOSTNAME} in
|
||||
vperanda)
|
||||
portainer_image="portainer-ee:latest"
|
||||
image_name="portainer"
|
||||
;;
|
||||
io)
|
||||
portainer_image="agent:latest"
|
||||
image_name="portainer_agent"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "We're on ${HOSTNAME} so the portainer image is ${portainer_image}. The name will be ${image_name}."
|
||||
|
||||
# stop and remove portainer
|
||||
docker stop ${image_name}
|
||||
docker rm ${image_name}
|
||||
|
||||
# run the command to pull and run the latest [portainer,portainer-edge] docker image
|
||||
case ${HOSTNAME} in
|
||||
vperanda)
|
||||
run_vperanda
|
||||
;;
|
||||
io)
|
||||
run_io
|
||||
;;
|
||||
esac
|
||||
|
||||
# send a notification to https://notify.peterwood.rocks\lab
|
||||
curl \
|
||||
-H priority:default \
|
||||
-H tags:update,docker,portainer,${HOSTNAME} \
|
||||
-d "The ${image_name} portainer image has been updated." \
|
||||
https://notify.peterwood.rocks/lab
|
||||
|
||||
Reference in New Issue
Block a user