Improve chaotic-management container
This commit is contained in:
parent
4476f94602
commit
8f000cebfd
|
@ -31,7 +31,21 @@ services:
|
|||
container_name: chaotic-management
|
||||
restart: ${RESTART:-unless-stopped}
|
||||
image: nginx
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; sleep 10; while :; do curl -X POST -H \"X-API-Key: ${SYNCTHING_API_KEY:-XYZ}\" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra; sleep 1h & wait $${!}; done;'"
|
||||
volumes:
|
||||
- './data:/data'
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
trap exit TERM;
|
||||
sleep 10;
|
||||
while :; do
|
||||
apikey="$(grep -oPm 1 '(?<=\<apikey\>).*(?=\</apikey\>)' /data/syncthing/config.xml)"
|
||||
curl -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra;
|
||||
sed -i -r '/<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY"/! s|(^ *<device .*id="[^"]+".*skipIntroductionRemovals="false".*introducedBy=")(">)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' /data/syncthing/config.xml
|
||||
sleep 1h &
|
||||
wait $${!};
|
||||
done;
|
||||
|
||||
cloudflared:
|
||||
image: erisamoe/cloudflared:latest
|
||||
|
@ -41,4 +55,4 @@ services:
|
|||
- './data/cloudflared/etc:/etc/cloudflared'
|
||||
- './data/cloudflared/home:/root'
|
||||
- './preset/passwd:/etc/passwd'
|
||||
restart: ${RESTART:-unless-stopped}
|
||||
restart: ${RESTART:-unless-stopped}
|
||||
|
|
|
@ -40,7 +40,21 @@ services:
|
|||
container_name: chaotic-management
|
||||
restart: ${RESTART:-unless-stopped}
|
||||
image: nginx
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; sleep 10; while :; do curl -X POST -H \"X-API-Key: ${SYNCTHING_API_KEY:-XYZ}\" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra; sleep 1h & wait $${!}; done;'"
|
||||
volumes:
|
||||
- './data:/data'
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
trap exit TERM;
|
||||
sleep 10;
|
||||
while :; do
|
||||
apikey="$(grep -oPm 1 '(?<=\<apikey\>).*(?=\</apikey\>)' /data/syncthing/config.xml)"
|
||||
curl -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra;
|
||||
sed -i -r '/<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY"/! s|(^ *<device .*id="[^"]+".*skipIntroductionRemovals="false".*introducedBy=")(">)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' /data/syncthing/config.xml
|
||||
sleep 1h &
|
||||
wait $${!};
|
||||
done;
|
||||
|
||||
certbot:
|
||||
image: certbot/certbot:${LETSENCRYPT_TAG:-latest}
|
||||
|
|
8
run
8
run
|
@ -25,11 +25,6 @@ fi
|
|||
|
||||
source .env
|
||||
|
||||
if [[ ! -v SYNCTHING_API_KEY ]]; then
|
||||
SYNCTHING_API_KEY="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 32)"
|
||||
echo "SYNCTHING_API_KEY=$SYNCTHING_API_KEY" >> ./.env
|
||||
fi
|
||||
|
||||
if [ "$USE_TUNNELS" != "true" ]; then
|
||||
if [ ! -e ./data/letsencrypt/etc/renewal/chaotic.conf ]; then
|
||||
docker run -p 80:80 -p 443:443 --rm -v "$PWD/data/letsencrypt/etc:/etc/letsencrypt" -v "$PWD/data/letsencrypt/var:/var/lib/letsencrypt" certbot/certbot:${LETSENCRYPT_TAG:-latest} certonly --standalone --non-interactive --agree-tos --cert-name chaotic -n -m "$EMAIL" -d "$DOMAIN_NAME"
|
||||
|
@ -58,9 +53,6 @@ if [ ! -e ./data/syncthing/config.xml ]; then
|
|||
chown -R 1000:1000 ./data/syncthing
|
||||
fi
|
||||
|
||||
sed -i -r '/<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY"/! s|(^ *<device .*id="[^"]+".*skipIntroductionRemovals="false".*introducedBy=")(">)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' ./data/syncthing/config.xml
|
||||
sed -i -r "s|(<apikey>).*(</apikey>)|\1$SYNCTHING_API_KEY\2|" ./data/syncthing/config.xml
|
||||
|
||||
if [ "$USE_TUNNELS" != "true" ]; then
|
||||
docker-compose -f docker-compose.yml up ${COMPOSEFLAGS-"-d"}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue