Dmitry Beresnev commited on
Commit
969d174
·
1 Parent(s): 4795024

fix multiservice conf

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. app.py +22 -12
  3. supervisord.conf +3 -2
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
 
1
+ FROM python:3.13-slim
2
 
3
  WORKDIR /app
4
 
app.py CHANGED
@@ -31,6 +31,7 @@ OPENCLAW_STANDARD_UI_URL = os.getenv(
31
  OPENCLAW_STANDARD_UI_PUBLIC_URL = os.getenv("OPENCLAW_STANDARD_UI_PUBLIC_URL", "/openclaw/")
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")
@@ -57,7 +58,8 @@ def init_state() -> None:
57
  st.session_state.setdefault("backtest_data", None)
58
  st.session_state.setdefault("backtest_params", None)
59
  st.session_state.setdefault("backtest_error", "")
60
- st.session_state.setdefault("gateway_boot_log_offset", 0)
 
61
 
62
 
63
  def load_config_text() -> str:
@@ -108,17 +110,25 @@ def pull_logs() -> None:
108
 
109
 
110
  def pull_boot_logs() -> None:
111
- if not GATEWAY_BOOT_LOG_PATH.exists():
112
- return
113
- try:
114
- with GATEWAY_BOOT_LOG_PATH.open("r", encoding="utf-8", errors="ignore") as fh:
115
- fh.seek(st.session_state["gateway_boot_log_offset"])
116
- new_content = fh.read()
117
- st.session_state["gateway_boot_log_offset"] = fh.tell()
118
- except Exception:
119
- return
120
- if new_content:
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:
 
31
  OPENCLAW_STANDARD_UI_PUBLIC_URL = os.getenv("OPENCLAW_STANDARD_UI_PUBLIC_URL", "/openclaw/")
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
+ GATEWAY_ERR_LOG_PATH = Path(os.getenv("OPENCLAW_GATEWAY_ERR_LOG_PATH", "/tmp/openclaw-gateway.err.log"))
35
  EXTERNAL_GATEWAY_MANAGED = os.getenv("EXTERNAL_GATEWAY_MANAGED", "0") == "1"
36
  SUPERVISOR_LOG_PATH = Path("/tmp/supervisord.log")
37
  STREAMLIT_ERR_LOG_PATH = Path("/tmp/streamlit.err.log")
 
58
  st.session_state.setdefault("backtest_data", None)
59
  st.session_state.setdefault("backtest_params", None)
60
  st.session_state.setdefault("backtest_error", "")
61
+ st.session_state.setdefault("gateway_boot_log_offset_out", 0)
62
+ st.session_state.setdefault("gateway_boot_log_offset_err", 0)
63
 
64
 
65
  def load_config_text() -> str:
 
110
 
111
 
112
  def pull_boot_logs() -> None:
113
+ merged_new_lines = []
114
+ sources = [
115
+ (GATEWAY_BOOT_LOG_PATH, "gateway_boot_log_offset_out"),
116
+ (GATEWAY_ERR_LOG_PATH, "gateway_boot_log_offset_err"),
117
+ ]
118
+ for path, offset_key in sources:
119
+ if not path.exists():
120
+ continue
121
+ try:
122
+ with path.open("r", encoding="utf-8", errors="ignore") as fh:
123
+ fh.seek(st.session_state[offset_key])
124
+ new_content = fh.read()
125
+ st.session_state[offset_key] = fh.tell()
126
+ except Exception:
127
+ continue
128
+ if new_content:
129
+ merged_new_lines.extend([ln for ln in new_content.splitlines() if ln.strip()])
130
+ if merged_new_lines:
131
+ append_logs(merged_new_lines)
132
 
133
 
134
  def tail_text_file(path: Path, max_lines: int = 40) -> str:
supervisord.conf CHANGED
@@ -2,11 +2,12 @@
2
  nodaemon=true
3
  logfile=/tmp/supervisord.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
11
  stderr_logfile=/tmp/openclaw-gateway.err.log
12
  environment=HOME="/root"
 
2
  nodaemon=true
3
  logfile=/tmp/supervisord.log
4
  pidfile=/tmp/supervisord.pid
5
+ user=root
6
 
7
  [program:openclaw]
8
+ command=/bin/sh -lc "openclaw gateway run --port 18789 --bind loopback --allow-unconfigured --dev --force --verbose"
9
  autorestart=true
10
+ startsecs=5
11
  stdout_logfile=/tmp/openclaw-gateway.log
12
  stderr_logfile=/tmp/openclaw-gateway.err.log
13
  environment=HOME="/root"