Compare commits

..

11 Commits

Author SHA1 Message Date
drunkendog 3957c8f617 Replace deprecated --prefix with --glob-archives 2023-08-24 18:26:58 +01:00
drunkendog b6f4f1ab47 Fix bug (replacements[0] should have been replacements[1]) 2023-08-24 18:18:29 +01:00
drunkendog 7f4ddba8bb Fix typo and spacing issue 2023-08-24 16:58:03 +01:00
drunkendog c04297a3be Update scripts/setup-template.py 2023-08-24 16:57:17 +01:00
drunkendog c5e32f8af4 Fix typo (incorrect image name) 2023-08-24 16:37:14 +01:00
drunkendog 88d2ca8c9a Add 'scripts/thelounge/launch-docker.sh' 2023-08-24 16:20:21 +01:00
drunkendog 3dfc9c0d1c Add 'scripts/thelounge/manifest.dat' 2023-08-24 16:15:28 +01:00
drunkendog ece934d473 Remove docker sdk dependency and add jq 2023-08-24 16:13:08 +01:00
drunkendog f70843990c Add docker relaunch convenience script 2023-08-24 16:12:45 +01:00
drunkendog 6da61a7be2 Add dependency (Python Docker SDK) 2023-08-24 15:49:53 +01:00
drunkendog 940a4edbf5 Rename setup script from main.sh 2023-08-24 15:49:09 +01:00
6 changed files with 49 additions and 3 deletions

View File

@ -39,7 +39,7 @@ info "Pruning repository"
/usr/local/bin/borg-linux64 prune \
--list \
--prefix '{hostname}-' \
--glob-archives '{hostname}-*' \
--show-rc \
--keep-daily 7 \
--keep-weekly 4 \

View File

@ -24,6 +24,13 @@ for directory in directories:
print(replacement[0].rstrip(), replacement[1].rstrip(), int(replacement[2].rstrip().rstrip("\n")))
current_setup_template = current_setup_template.replace(replacement[0].rstrip(), replacement[1].rstrip(), int(replacement[2].rstrip().rstrip("\n")))
if replacement[0] == "#service":
with open(f"{directory}/relaunch-docker.sh", "w") as f:
f.write(f"docker pull $(docker inspect {replacement[1]} | jq -r '.[0].Config.Image')\n")
f.write(f"docker stop {replacement[1]}\n")
f.write(f"docker rm {replacement[1]}\n")
f.write(f"sh launch-docker.sh\n")
if glob.glob(f"{directory}/parser.py"):
should_continue = input(f"Custom instructions found in {directory}, continue? (Y/N) ")
if should_continue == "Y":

View File

@ -1,13 +1,37 @@
#IMPORT
import os
import argparse
import warnings
#CACHE_FUNCTIONS
def get_cached_email() -> str:
with open("../email.cache", "r") as f:
email = f.read().strip()
return email
def cache_email(email: str) -> None:
try:
with open("../email.cache", "w") as f:
f.write(email)
except Exception as e:
warnings.warn(e, Warning)
#PARSE_ARGS
parser = argparse.ArgumentParser()
parser.add_argument("domain")
parser.add_argument("email")
parser.add_argument("email", default=None) # to not recache emails retreived from cache
parser.add_argument("cache_email", default=True)
args = parser.parse_args()
#CACHE
if args.cache_email is True and args.email is not None:
cache_email(args.email)
if args.email is None:
args.email = get_cached_email()
#QUICK_RECOVER
os.makedirs(os.path.dirname("/opt/quick-recover/"), exist_ok=True)
with open("/opt/quick-recover/#service.conf", "w") as f:

View File

@ -0,0 +1,6 @@
docker run -d --net main_subnet --ip 172.30.25.1 \
-e TZ=America/New_York \
-v /opt/thelounge/config:/config \
--name=thelounge \
--restart unless-stopped \
lscr.io/linuxserver/thelounge:latest

View File

@ -0,0 +1,9 @@
%
@ #ip_address
@ http://172.30.25.1:9000/
%
@ #service
@ thelounge
%
@ #ADDITIONAL_REPLACE
@ template = template.replace("proxy_set_header Host $host;", "proxy_set_header Host $host;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";")

View File

@ -5,7 +5,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get upgrade -y
apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup
apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq
rm -rf /etc/nginx/sites-available/default
rm -rf /etc/nginx/sites-enabled/default