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()