Install and start the server only together with the web app
./install builds the web app and the server before replacing either, and fails without Docker or on a failed build, leaving the old pair in place. The supervisor and start refuse to run the server when the web app is not installed.
This commit is contained in:
+12
-1
@@ -176,7 +176,17 @@ def service_command(config, arguments):
|
||||
print("Supervisor:", "active" if active.returncode == 0 else "inactive")
|
||||
|
||||
|
||||
def require_web_app(config):
|
||||
"""The server never runs without its web app: both or neither."""
|
||||
web = config.get("web") or {}
|
||||
root = Path(web["root"]) if web.get("root") else None
|
||||
if root is None or not (root / "index.html").is_file():
|
||||
raise RuntimeError("The web app is not installed" + (f" in {root}" if root else "")
|
||||
+ "; refusing to start the server without it. Run ./install.")
|
||||
|
||||
|
||||
def start(config):
|
||||
require_web_app(config)
|
||||
root = Path(config["prefix"])
|
||||
if registration(config):
|
||||
if platform.system() == "Darwin":
|
||||
@@ -301,7 +311,7 @@ def report(config):
|
||||
print(f" {'Web':<10} {address} (password in {web['auth_file']})")
|
||||
root = Path(web["root"]) if web.get("root") else None
|
||||
built = root is not None and (root / "index.html").is_file()
|
||||
print(f" {'Web app':<10} {'installed' if built else 'not built; run ./install --web'}")
|
||||
print(f" {'Web app':<10} {'installed' if built else 'MISSING; the server will not start until ./install builds it'}")
|
||||
updates = Path(web["updates"]) if web.get("updates") else None
|
||||
apk = updates is not None and (updates / "pipelines.apk").is_file()
|
||||
print(f" {'Phone app':<10} " + (f"{updates / 'pipelines.apk'} (Settings → Check for updates)"
|
||||
@@ -379,6 +389,7 @@ def supervise(config):
|
||||
signal.signal(signal.SIGTERM, stopping)
|
||||
signal.signal(signal.SIGINT, stopping)
|
||||
try:
|
||||
require_web_app(config)
|
||||
if ntfy_mode(config) == "native":
|
||||
ntfy_child = ntfy_start(config)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user