6 Commits

Author SHA1 Message Date
81845f4b72 and then it hit me
Some checks failed
Build and Push Docker Image / build (push) Failing after 6s
2025-10-23 12:35:33 -07:00
e0f8fa47b9 im at a loss 2025-10-23 12:35:31 -07:00
c40db791f4 lets see if it reads the vars 2025-10-23 12:35:31 -07:00
a6a459dcd9 layering issues 2025-10-23 12:35:08 -07:00
416d2ab3e5 wrong directory being made 2025-10-23 12:30:51 -07:00
8bc1ae86e7 first commit of bot config 2025-10-23 12:28:07 -07:00
5 changed files with 64 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
# Use LinuxServer.io Duplicati base
FROM linuxserver/duplicati:2.1.0
# Install Docker CLI, bash, python3, btrfs support and all the app directories
@@ -27,7 +26,6 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/bin /config /etc/services.d/backupbot
# Copy the backup script
COPY backup.sh /usr/local/bin/backup.sh
RUN chmod +x /usr/local/bin/backup.sh
@@ -43,6 +41,7 @@ RUN chmod +x /etc/services.d/backupbot/run
# Copy web frontend
COPY web /app
RUN chmod +x /app/cgi-bin/backupbot.cgi
# Expose web frontend port
EXPOSE 8080

8
backupbot.env Normal file
View File

@@ -0,0 +1,8 @@
TZ=America/Los_Angeles
BACKUP_DIR=/backups/postgres
LOG_FILE=/config/log/pgbackup.log
MAX_RETRIES=3
GOTIFY_URL=http://gotify.example.com
GOTIFY_TOKEN=your_gotify_token_here
BACKUP_HOUR=03
BACKUP_MINUTE=00

View File

@@ -17,7 +17,6 @@ services:
- /srv/backups:/backups:rshared
# Docker socket to list containers
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 8200:8200
- 8201:8080

View File

@@ -12,6 +12,11 @@ else
source /config/backupbot.conf
set +a
fi
# Initialize default web interface if missing
if [ ! -d /config/web ]; then
echo "[INFO] Populating /config/web from defaults..."
cp -r /defaults/web /config/
fi
# Start Python HTTP server for web config in background
cd /app

50
web/backupbot.cgi Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python3
import cgi
import cgitb
import os
import json
cgitb.enable()
print("Content-Type: application/json\n")
ENV_FILE = "/config/web/backupbot.env"
def read_env():
env = {}
if os.path.exists(ENV_FILE):
with open(ENV_FILE) as f:
for line in f:
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, val = line.split("=", 1)
key = key.strip()
val = val.strip().split("#")[0].strip() # strip inline comments
env[key] = val
return env
def write_env(env):
with open(ENV_FILE, "w") as f:
for key, val in env.items():
f.write(f"{key}={val}\n")
form = cgi.FieldStorage()
action = form.getvalue("action")
if action == "get":
env = read_env()
print(json.dumps(env))
elif action == "set":
try:
raw = os.environ.get("CONTENT_LENGTH")
length = int(raw) if raw else 0
data = json.loads(os.read(0, length))
write_env(data)
print(json.dumps({"status": "ok", "message": "Configuration saved."}))
except Exception as e:
print(json.dumps({"status": "error", "message": str(e)}))
else:
print(json.dumps({"status": "error", "message": "Invalid action"}))