diff --git a/docker-compose-tunnels.yml b/docker-compose-tunnels.yml index 93bb6a2..4fd0d75 100644 --- a/docker-compose-tunnels.yml +++ b/docker-compose-tunnels.yml @@ -27,6 +27,12 @@ services: - 21027:21027/udp restart: ${RESTART:-unless-stopped} + chaotic-management: + 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;'" + cloudflared: image: erisamoe/cloudflared:latest container_name: cloudflared diff --git a/docker-compose.yml b/docker-compose.yml index 1b0c7f6..296769f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,12 @@ services: - 21027:21027/udp restart: ${RESTART:-unless-stopped} + chaotic-management: + 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;'" + certbot: image: certbot/certbot:${LETSENCRYPT_TAG:-latest} container_name: certbot diff --git a/preset/syncthing-config.xml b/preset/syncthing-config.xml index 0cedfbd..d8a9290 100644 --- a/preset/syncthing-config.xml +++ b/preset/syncthing-config.xml @@ -1,22 +1,16 @@ basic - - - + oldestFirst +
tcp://builds.garudalinux.org
dynamic
false - false - 0 - 0 - 0 - false - 0
127.0.0.1:8384
+
diff --git a/run b/run index 7acfe11..589f956 100755 --- a/run +++ b/run @@ -25,6 +25,11 @@ fi source .env +if [[ ! -v SYNCTHING_API_KEY ]]; then + SYNCTHING_API_KEY="$(tr -dc A-Za-z0-9 > ./.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" @@ -53,10 +58,11 @@ if [ ! -e ./data/syncthing/config.xml ]; then chown -R 1000:1000 ./data/syncthing fi +sed -i -r '/)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' ./data/syncthing/config.xml +sed -i -r "s|().*()|\1$SYNCTHING_API_KEY\2|" ./data/syncthing/config.xml + if [ "$USE_TUNNELS" != "true" ]; then - docker-compose -f docker-compose.yml pull docker-compose -f docker-compose.yml up ${COMPOSEFLAGS-"-d"} else - docker-compose -f docker-compose-tunnels.yml pull docker-compose -f docker-compose-tunnels.yml up ${COMPOSEFLAGS-"-d"} fi diff --git a/update b/update new file mode 100755 index 0000000..8ba3b64 --- /dev/null +++ b/update @@ -0,0 +1,37 @@ +#!/bin/bash + +set -e + +if [[ $EUID -ne 0 ]]; then + echo Run as root! + exit 1 +fi + +./stop + +if [ ! -d "./.git" ]; then + if [ "$(git rev-parse --is-inside-work-tree)" == "true" ]; then + echo "Please run this script in the main directory" + exit 1 + fi + git init --initial-branch=main + git remote add origin https://github.com/chaotic-aur/docker-mirror + git fetch + git reset --hard origin/main +else + git pull || echo "Git pull failed, please fix the issue at hand." +fi + +if [ "$SELFUPDATE" != 1 ]; then + SELFUPDATE=1 ./update +fi + +source .env + +if [ "$USE_TUNNELS" != "true" ]; then + docker-compose -f docker-compose.yml pull +else + docker-compose -f docker-compose-tunnels.yml pull +fi + +./run