2021-04-19 07:51:22 +00:00
|
|
|
#!/bin/sh
|
2021-04-23 06:52:21 +00:00
|
|
|
set -e
|
2021-04-22 09:06:03 +00:00
|
|
|
|
|
|
|
apk add openssh
|
2021-04-19 07:51:22 +00:00
|
|
|
|
2021-04-22 09:01:45 +00:00
|
|
|
key=$(cat ./key)
|
2021-04-19 07:51:22 +00:00
|
|
|
|
2021-04-23 06:51:06 +00:00
|
|
|
chmod 600 ./id_root
|
2021-04-22 09:07:57 +00:00
|
|
|
|
2021-04-19 07:51:22 +00:00
|
|
|
for filename in confs/*; do
|
|
|
|
addr=$(basename $filename)
|
|
|
|
echo "Refreshing $addr..."
|
2021-04-23 06:51:06 +00:00
|
|
|
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker pull quackerd/d2ray:latest"
|
2021-04-22 09:09:33 +00:00
|
|
|
set +e
|
2021-04-23 06:51:06 +00:00
|
|
|
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker stop d2ray && docker rm d2ray"
|
2021-04-22 09:09:33 +00:00
|
|
|
set -e
|
2021-04-23 06:51:06 +00:00
|
|
|
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker run -d \
|
2021-04-22 09:15:51 +00:00
|
|
|
--restart unless-stopped \
|
2021-04-22 09:19:13 +00:00
|
|
|
-e KEY=$key \
|
|
|
|
-e FQDN=$addr \
|
2021-04-22 09:01:45 +00:00
|
|
|
-p 80:80 \
|
|
|
|
-p 443:443 \
|
|
|
|
-v d2ray_volume:/opt/config \
|
|
|
|
--name d2ray \
|
|
|
|
quackerd/d2ray:latest"
|
2021-04-23 07:06:43 +00:00
|
|
|
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker system prune -af"
|
2021-04-19 07:51:22 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
wait
|