mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function update_agent () {
|
|
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_image}
|
|
}
|
|
|
|
function update () {
|
|
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_image}
|
|
}
|
|
|
|
portainer_image=""
|
|
image_name=""
|
|
|
|
case ${HOSTNAME} in
|
|
vperanda)
|
|
portainer_image="portainer/portainer-ee:latest"
|
|
image_name="portainer"
|
|
;;
|
|
io)
|
|
portainer_image="portainer/agent:latest"
|
|
image_name="portainer_agent"
|
|
;;
|
|
svr-office)
|
|
portainer_image="portainer/agent:latest"
|
|
image_name="portainer_agent"
|
|
;;
|
|
esac
|
|
|
|
# stop and remove portainer
|
|
docker stop ${image_name}
|
|
docker rm ${image_name}
|
|
|
|
# pull the latest image
|
|
docker pull ${portainer_image}
|
|
|
|
# run the command run the latest [portainer,portainer-agent] docker image
|
|
case ${HOSTNAME} in
|
|
vperanda)
|
|
update
|
|
;;
|
|
io)
|
|
update_agent
|
|
;;
|
|
svr-office)
|
|
update_agent
|
|
;;
|
|
esac
|
|
|
|
# send a notification to https://notify.peterwood.rocks\lab
|
|
curl \
|
|
-H priority:default \
|
|
-H tags:update,docker,portainer,${HOSTNAME} \
|
|
-d "The ${image_name} image has been updated." \
|
|
https://notify.peterwood.rocks/lab
|