From d44931269ef3b819363bea3135ef0057e5056ec4 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Sun, 16 Aug 2026 13:00:28 +0100 Subject: [PATCH] Pelican/pterodactyl deploy support: run.py, requirements.txt, SERVER_PORT, ready marker --- requirements.txt | 4 ++++ rotatyvote/__main__.py | 3 ++- rotatyvote/config.py | 3 ++- run.py | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 requirements.txt create mode 100644 run.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cb9c5e5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +starlette>=1.0 +uvicorn>=0.35 +websockets>=14 +segno>=1.6 diff --git a/rotatyvote/__main__.py b/rotatyvote/__main__.py index f5c2c8b..eaab275 100644 --- a/rotatyvote/__main__.py +++ b/rotatyvote/__main__.py @@ -16,7 +16,8 @@ def lan_ip(): def main(): scheme = "https" if config.TLS_CERT else "http" - print(f"RotatyVote -> {scheme}://localhost:{config.PORT} (LAN: {scheme}://{lan_ip()}:{config.PORT})") + # "RUNNING" is the ready marker the pelican python egg waits for + print(f"RotatyVote RUNNING on {scheme}://localhost:{config.PORT} (LAN: {scheme}://{lan_ip()}:{config.PORT})", flush=True) if config.PUBLIC_URL: print(f"QR codes encode {config.PUBLIC_URL}") elif scheme == "http": diff --git a/rotatyvote/config.py b/rotatyvote/config.py index 484b448..8005350 100644 --- a/rotatyvote/config.py +++ b/rotatyvote/config.py @@ -1,7 +1,8 @@ import os HOST = os.environ.get("HOST", "0.0.0.0") -PORT = int(os.environ.get("PORT", "8000")) +# SERVER_PORT is what pterodactyl/pelican hands to the container +PORT = int(os.environ.get("PORT") or os.environ.get("SERVER_PORT") or "8000") # url encoded in the QR codes, eg https://vote.example.org # when empty the projector's own origin is used PUBLIC_URL = os.environ.get("PUBLIC_URL", "").rstrip("/") diff --git a/run.py b/run.py new file mode 100644 index 0000000..8dbe033 --- /dev/null +++ b/run.py @@ -0,0 +1,3 @@ +from rotatyvote.__main__ import main + +main()