Dmitry Beresnev commited on
Commit
4795024
·
1 Parent(s): 66a2fe2

fix multiservice configuration

Browse files
Files changed (4) hide show
  1. Caddyfile +2 -2
  2. Dockerfile +1 -0
  3. app.py +26 -0
  4. supervisord.conf +1 -1
Caddyfile CHANGED
@@ -1,7 +1,7 @@
1
- :{$PORT}
2
 
3
  handle_path /openclaw/* {
4
- reverse_proxy 127.0.0.1:{$OPENCLAW_PORT}
5
  }
6
 
7
  handle {
 
1
+ :7860
2
 
3
  handle_path /openclaw/* {
4
+ reverse_proxy 127.0.0.1:18789
5
  }
6
 
7
  handle {
Dockerfile CHANGED
@@ -35,6 +35,7 @@ ENV OPENCLAW_STATE_DIR=/app/.openclaw/state
35
  ENV AUTO_START_GATEWAY=0
36
  ENV EXTERNAL_GATEWAY_MANAGED=1
37
  ENV OPENCLAW_STANDARD_UI_PUBLIC_URL=/openclaw/
 
38
 
39
  RUN mkdir -p /app/vault /app/.openclaw/state
40
 
 
35
  ENV AUTO_START_GATEWAY=0
36
  ENV EXTERNAL_GATEWAY_MANAGED=1
37
  ENV OPENCLAW_STANDARD_UI_PUBLIC_URL=/openclaw/
38
+ ENV OPENCLAW_GATEWAY_LOG_PATH=/tmp/openclaw-gateway.log
39
 
40
  RUN mkdir -p /app/vault /app/.openclaw/state
41
 
app.py CHANGED
@@ -32,6 +32,9 @@ OPENCLAW_STANDARD_UI_PUBLIC_URL = os.getenv("OPENCLAW_STANDARD_UI_PUBLIC_URL", "
32
  OPENCLAW_GATEWAY_TOKEN = os.getenv("OPENCLAW_GATEWAY_TOKEN", "")
33
  GATEWAY_BOOT_LOG_PATH = Path(os.getenv("OPENCLAW_GATEWAY_LOG_PATH", "/tmp/openclaw-gateway.log"))
34
  EXTERNAL_GATEWAY_MANAGED = os.getenv("EXTERNAL_GATEWAY_MANAGED", "0") == "1"
 
 
 
35
 
36
 
37
  def resolve_openclaw_bin() -> str | None:
@@ -118,6 +121,16 @@ def pull_boot_logs() -> None:
118
  append_logs([ln for ln in new_content.splitlines() if ln.strip()])
119
 
120
 
 
 
 
 
 
 
 
 
 
 
121
  def start_gateway() -> tuple[bool, str]:
122
  if EXTERNAL_GATEWAY_MANAGED:
123
  return True, "Gateway is managed by supervisor from Docker startup."
@@ -458,6 +471,19 @@ with logs_col:
458
  st.subheader("Gateway Logs")
459
  st.code("\n".join(st.session_state["gateway_logs"][-LOG_MAX_LINES:]) or "No logs yet.")
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  st.divider()
462
  st.subheader("Backtesting Lab")
463
  st.caption(
 
32
  OPENCLAW_GATEWAY_TOKEN = os.getenv("OPENCLAW_GATEWAY_TOKEN", "")
33
  GATEWAY_BOOT_LOG_PATH = Path(os.getenv("OPENCLAW_GATEWAY_LOG_PATH", "/tmp/openclaw-gateway.log"))
34
  EXTERNAL_GATEWAY_MANAGED = os.getenv("EXTERNAL_GATEWAY_MANAGED", "0") == "1"
35
+ SUPERVISOR_LOG_PATH = Path("/tmp/supervisord.log")
36
+ STREAMLIT_ERR_LOG_PATH = Path("/tmp/streamlit.err.log")
37
+ CADDY_ERR_LOG_PATH = Path("/tmp/caddy.err.log")
38
 
39
 
40
  def resolve_openclaw_bin() -> str | None:
 
121
  append_logs([ln for ln in new_content.splitlines() if ln.strip()])
122
 
123
 
124
+ def tail_text_file(path: Path, max_lines: int = 40) -> str:
125
+ if not path.exists():
126
+ return f"{path} not found."
127
+ try:
128
+ lines = path.read_text(encoding="utf-8", errors="ignore").splitlines()
129
+ except Exception as exc:
130
+ return f"Failed to read {path}: {exc}"
131
+ return "\n".join(lines[-max_lines:]) if lines else "(empty)"
132
+
133
+
134
  def start_gateway() -> tuple[bool, str]:
135
  if EXTERNAL_GATEWAY_MANAGED:
136
  return True, "Gateway is managed by supervisor from Docker startup."
 
471
  st.subheader("Gateway Logs")
472
  st.code("\n".join(st.session_state["gateway_logs"][-LOG_MAX_LINES:]) or "No logs yet.")
473
 
474
+ st.expander("Service Diagnostics (Supervisor/Caddy/Streamlit)").code(
475
+ "\n\n".join(
476
+ [
477
+ "=== supervisord.log ===",
478
+ tail_text_file(SUPERVISOR_LOG_PATH),
479
+ "=== caddy.err.log ===",
480
+ tail_text_file(CADDY_ERR_LOG_PATH),
481
+ "=== streamlit.err.log ===",
482
+ tail_text_file(STREAMLIT_ERR_LOG_PATH),
483
+ ]
484
+ )
485
+ )
486
+
487
  st.divider()
488
  st.subheader("Backtesting Lab")
489
  st.caption(
supervisord.conf CHANGED
@@ -4,7 +4,7 @@ logfile=/tmp/supervisord.log
4
  pidfile=/tmp/supervisord.pid
5
 
6
  [program:openclaw]
7
- command=/bin/sh -lc "%(ENV_OPENCLAW_BIN)s gateway run --port %(ENV_OPENCLAW_PORT)s --allow-unconfigured"
8
  autorestart=true
9
  startsecs=2
10
  stdout_logfile=/tmp/openclaw-gateway.log
 
4
  pidfile=/tmp/supervisord.pid
5
 
6
  [program:openclaw]
7
+ command=/bin/sh -lc "openclaw gateway run --port 18789 --allow-unconfigured"
8
  autorestart=true
9
  startsecs=2
10
  stdout_logfile=/tmp/openclaw-gateway.log