Add standalone mode for sx-web.org deployment

- SX_STANDALONE=true env var: no OAuth, no root header, no cross-service
  fragments. Same image runs in both rose-ash cooperative and standalone.
- Factory: added no_oauth parameter to create_base_app()
- Standalone layout defcomps skip ~root-header-auto/~root-mobile-auto
- Fixed Dockerfile: was missing sx/sx/ component directory copy
- CI: deploys sx-web swarm stack on main branch when sx changes
- Stack config at ~/sx-web/ (Caddy → sx_docs, Redis)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 16:39:21 +00:00
parent 5fff83ae79
commit 0f4520d987
6 changed files with 100 additions and 8 deletions

View File

@@ -1,10 +1,12 @@
from __future__ import annotations
import os
import path_setup # noqa: F401
from shared.infrastructure.factory import create_base_app
from bp import register_pages
from services import register_domain_services
SX_STANDALONE = os.getenv("SX_STANDALONE") == "true"
async def sx_docs_context() -> dict:
"""SX docs app context processor — fetches cross-service fragments."""
@@ -39,11 +41,29 @@ async def sx_docs_context() -> dict:
return ctx
async def sx_standalone_context() -> dict:
"""Minimal context for standalone mode — no cross-service fragments."""
from shared.infrastructure.context import base_context
ctx = await base_context()
ctx["menu_items"] = []
ctx["cart_mini"] = ""
ctx["auth_menu"] = ""
ctx["nav_tree"] = ""
return ctx
def create_app() -> "Quart":
from shared.infrastructure.factory import create_base_app
extra_kw = {}
if SX_STANDALONE:
extra_kw["no_oauth"] = True
app = create_base_app(
"sx",
context_fn=sx_docs_context,
context_fn=sx_standalone_context if SX_STANDALONE else sx_docs_context,
domain_services_fn=register_domain_services,
**extra_kw,
)
from sxc.pages import setup_sx_pages