Auto reset local changes, add update script
This commit is contained in:
parent
43c3d64438
commit
4476f94602
|
@ -27,6 +27,12 @@ services:
|
||||||
- 21027:21027/udp
|
- 21027:21027/udp
|
||||||
restart: ${RESTART:-unless-stopped}
|
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:
|
cloudflared:
|
||||||
image: erisamoe/cloudflared:latest
|
image: erisamoe/cloudflared:latest
|
||||||
container_name: cloudflared
|
container_name: cloudflared
|
||||||
|
|
|
@ -36,6 +36,12 @@ services:
|
||||||
- 21027:21027/udp
|
- 21027:21027/udp
|
||||||
restart: ${RESTART:-unless-stopped}
|
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:
|
certbot:
|
||||||
image: certbot/certbot:${LETSENCRYPT_TAG:-latest}
|
image: certbot/certbot:${LETSENCRYPT_TAG:-latest}
|
||||||
container_name: certbot
|
container_name: certbot
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
<configuration version="35">
|
<configuration version="35">
|
||||||
<folder id="jhcrt-m2dra" label="Chaotic AUR Repository" path="/repo" type="receiveonly" rescanIntervalS="3600" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="true" autoNormalize="true">
|
<folder id="jhcrt-m2dra" label="Chaotic AUR Repository" path="/repo" type="receiveonly" rescanIntervalS="3600" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="true" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY" introducedBy="">
|
<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY" introducedBy=""></device>
|
||||||
<encryptionPassword></encryptionPassword>
|
|
||||||
</device>
|
|
||||||
<order>oldestFirst</order>
|
<order>oldestFirst</order>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY" name="builds.garudalinux.org" compression="metadata" introducer="true" skipIntroductionRemovals="false" introducedBy="">
|
<device id="ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY" name="builds.garudalinux.org" compression="metadata" introducer="true" skipIntroductionRemovals="false" introducedBy="">
|
||||||
|
<address>tcp://builds.garudalinux.org</address>
|
||||||
<address>dynamic</address>
|
<address>dynamic</address>
|
||||||
<paused>false</paused>
|
<paused>false</paused>
|
||||||
<autoAcceptFolders>false</autoAcceptFolders>
|
|
||||||
<maxSendKbps>0</maxSendKbps>
|
|
||||||
<maxRecvKbps>0</maxRecvKbps>
|
|
||||||
<maxRequestKiB>0</maxRequestKiB>
|
|
||||||
<untrusted>false</untrusted>
|
|
||||||
<remoteGUIPort>0</remoteGUIPort>
|
|
||||||
</device>
|
</device>
|
||||||
<gui enabled="true" tls="false" debugging="false">
|
<gui enabled="true" tls="false" debugging="false">
|
||||||
<address>127.0.0.1:8384</address>
|
<address>127.0.0.1:8384</address>
|
||||||
|
<apikey></apikey>
|
||||||
</gui>
|
</gui>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
10
run
10
run
|
@ -25,6 +25,11 @@ fi
|
||||||
|
|
||||||
source .env
|
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 [ "$USE_TUNNELS" != "true" ]; then
|
||||||
if [ ! -e ./data/letsencrypt/etc/renewal/chaotic.conf ]; 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"
|
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
|
chown -R 1000:1000 ./data/syncthing
|
||||||
fi
|
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
|
if [ "$USE_TUNNELS" != "true" ]; then
|
||||||
docker-compose -f docker-compose.yml pull
|
|
||||||
docker-compose -f docker-compose.yml up ${COMPOSEFLAGS-"-d"}
|
docker-compose -f docker-compose.yml up ${COMPOSEFLAGS-"-d"}
|
||||||
else
|
else
|
||||||
docker-compose -f docker-compose-tunnels.yml pull
|
|
||||||
docker-compose -f docker-compose-tunnels.yml up ${COMPOSEFLAGS-"-d"}
|
docker-compose -f docker-compose-tunnels.yml up ${COMPOSEFLAGS-"-d"}
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue