From d26843a0d12d7badb716e1b73e7c2dcde426ef90 Mon Sep 17 00:00:00 2001 From: orohi Date: Tue, 28 Jul 2026 12:15:00 +0300 Subject: [PATCH] Release v2.6.0: stable Dokploy/Docker deployment bundle. Co-authored-by: Cursor --- .env.example | 13 ++++++-- README.md | 57 ++++++++++++++++++++++++------------ app.py | 2 +- scripts/docker-entrypoint.sh | 38 ------------------------ 4 files changed, 50 insertions(+), 60 deletions(-) delete mode 100644 scripts/docker-entrypoint.sh diff --git a/.env.example b/.env.example index 7053f84..7646a6e 100644 --- a/.env.example +++ b/.env.example @@ -2,11 +2,18 @@ APP_PORT=5000 SECRET_KEY=change-me-to-a-long-random-string -# PostgreSQL (used by docker-compose) +# PostgreSQL (docker-compose — same password for db + panel via DATABASE_URL) POSTGRES_USER=amnezia -POSTGRES_PASSWORD=amnezia +POSTGRES_PASSWORD=change-me-strong-password POSTGRES_DB=amnezia_panel POSTGRES_PORT=5432 +# Set once before first deploy. Changing POSTGRES_PASSWORD later requires resetting +# the amnezia_pgdata volume or the panel cannot connect (Postgres keeps the old password). + # Full DSN (override if panel runs outside compose) -# DATABASE_URL=postgresql://amnezia:amnezia@db:5432/amnezia_panel +# DATABASE_URL=postgresql://amnezia:change-me-strong-password@db:5432/amnezia_panel + +# Dokploy / reverse proxy (optional — set in compose for Docker) +# PANEL_IN_DOCKER=1 +# PANEL_BEHIND_PROXY=1 diff --git a/README.md b/README.md index 482d8b6..0141445 100644 --- a/README.md +++ b/README.md @@ -194,38 +194,53 @@ docker compose up -d --build Panel: `http://localhost:5000` (or `APP_PORT` from `.env`). -### Dokploy +### Dokploy (recommended) The compose file connects the panel to Dokploy's Traefik network (`dokploy-network`) and exposes the app on **container port 5000** (not 80). 1. Deploy as **Docker Compose** from this repo (Dokploy creates `dokploy-network` automatically). -2. In Dokploy → your app → **Domains**: +2. In Dokploy → your app → **Environment** (set **before first deploy**): + - `SECRET_KEY` — long random string + - `POSTGRES_PASSWORD` — strong password (same value is used for `db` and `amnezia_panel`) +3. In Dokploy → **Domains**: - **Service**: `amnezia_panel` (not `db`) - **Container port**: `5000` - **Path**: `/` -3. Set env vars in Dokploy: `SECRET_KEY` (long random string), strong `POSTGRES_PASSWORD`. -4. Redeploy after changing domains or env. +4. **Deploy / Rebuild** (not Restart) after code or env changes. -**Postgres `password authentication failed`:** the database volume keeps the password from the **first** deploy. If you later change `POSTGRES_PASSWORD` in Dokploy, Postgres ignores the new value but the panel uses it in `DATABASE_URL`. Fix: either restore the original password in Dokploy env, or reset the DB volume (wipes panel DB data): +**Verify on the server** (replace `PROJECT` and path with yours): ```bash -docker compose -p home-vpn-g6rfpd down -docker volume rm home-vpn-g6rfpd_amnezia_pgdata -docker compose -p home-vpn-g6rfpd up -d --build -``` +COMPOSE_DIR=/etc/dokploy/compose/home-vpn-g6rfpd/code +PROJECT=home-vpn-g6rfpd -If the domain shows **404 page not found** (plain text, Go-style), Traefik has no route to a healthy backend. After redeploying **v2.5.8+**, on the server run: +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml exec amnezia_panel \ + curl -fsS http://127.0.0.1:5000/health +# → {"status":"ok","version":"v2.6.0"} -```bash -# 1) Panel must answer HTTP inside the container -docker compose -p home-vpn-g6rfpd exec amnezia_panel curl -fsS http://127.0.0.1:5000/health - -# 2) Panel container must be on dokploy-network (required for Traefik) -docker inspect "$(docker compose -p home-vpn-g6rfpd ps -q amnezia_panel)" \ +docker inspect ${PROJECT}-amnezia_panel-1 \ --format '{{range $k,$v := .NetworkSettings.Networks}}{{$k}} {{end}}' +# must include: dokploy-network ``` -You should see `dokploy-network` in the network list. If it is missing, Dokploy cannot route the domain — redeploy with the latest `docker-compose.yml` or run `docker network connect dokploy-network ` and redeploy Traefik. +**Full redeploy after git update:** + +```bash +cd $COMPOSE_DIR && git pull origin main +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml down +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml build --no-cache amnezia_panel +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml up -d --force-recreate +``` + +**Postgres `password authentication failed`:** the volume keeps the password from the **first** deploy. If you change `POSTGRES_PASSWORD` in Dokploy later, reset the DB volume (wipes panel DB data): + +```bash +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml down +docker volume rm ${PROJECT}_amnezia_pgdata +docker compose -p $PROJECT -f $COMPOSE_DIR/docker-compose.yml up -d --build +``` + +**Domain shows `404 page not found` (plain text):** Traefik has no route to the panel — check Domains (service `amnezia_panel`, port `5000`) and that the container is on `dokploy-network` (see verify commands above). | File | Purpose | | --- | --- | @@ -262,12 +277,18 @@ GitHub Actions workflows in `.github/workflows/`: ## 📋 Fix / changelog (this fork) +### v2.6.0 — stable Dokploy / Docker release +* **Dokploy-ready compose** — `dokploy-network`, Traefik labels, port **5000**, no fixed `container_name`. +* **Docker startup** — `uvicorn` with proxy headers; SSL inside container disabled when `PANEL_IN_DOCKER` / `PANEL_BEHIND_PROXY`. +* **Postgres healthcheck** — verifies password (catches `POSTGRES_PASSWORD` vs volume mismatch). +* **Rollback move-connections** — removed server-to-server config move (v2.5.4); restored `ToggleConnectionRequest` (fixes crash loop on deploy). +* **Docs** — full Dokploy deploy/redeploy/password-reset guide in README. + ### v2.5.11 * **Postgres healthcheck** — verifies DB password (surfaces `POSTGRES_PASSWORD` / volume mismatch before panel starts). ### v2.5.10 * **Docker startup** — run `uvicorn` directly in `CMD` (no shell entrypoint); rebuild required after deploy. -* **Postgres healthcheck** — verifies password, not only `pg_isready` (catches `POSTGRES_PASSWORD` mismatch with existing volume). ### v2.5.9 * **Remove move connections between servers** — feature rolled back; fixes startup crash (`ToggleConnectionRequest` was missing after v2.5.4). diff --git a/app.py b/app.py index 1ee6fca..1822115 100644 --- a/app.py +++ b/app.py @@ -103,7 +103,7 @@ else: application_path = os.path.dirname(__file__) DATA_FILE = os.path.join(application_path, 'data.json') # legacy JSON; used only for one-shot import / export -CURRENT_VERSION = "v2.5.11" +CURRENT_VERSION = "v2.6.0" RELEASES_REPO_URL = repo_url() RELEASES_API_LATEST = api_latest_url() BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin')) diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh deleted file mode 100644 index 55264f4..0000000 --- a/scripts/docker-entrypoint.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -set -e - -PORT="${PORT:-${APP_PORT:-5000}}" - -echo "Waiting for PostgreSQL at ${DATABASE_URL%%@*}@…" -python3 - <<'PY' -import os -import sys -import time - -url = os.environ.get("DATABASE_URL", "").strip() -if not url: - print("DATABASE_URL is not set", file=sys.stderr) - sys.exit(1) - -import psycopg - -deadline = time.time() + 120 -last_err = None -while time.time() < deadline: - try: - with psycopg.connect(url, connect_timeout=5): - break - except Exception as exc: - last_err = exc - time.sleep(2) -else: - print(f"PostgreSQL not ready: {last_err}", file=sys.stderr) - sys.exit(1) -PY - -echo "Starting Amnezia Web Panel on 0.0.0.0:${PORT}" -exec uvicorn app:app \ - --host 0.0.0.0 \ - --port "${PORT}" \ - --proxy-headers \ - --forwarded-allow-ips='*'