Dmitry Beresnev commited on
Commit
a7746cb
·
1 Parent(s): 718b531

add openclaw launch in dockerfile, etc

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. app.py +10 -3
Dockerfile CHANGED
@@ -31,9 +31,10 @@ ENV VAULT_PATH=/app/vault
31
  ENV OPENCLAW_HOME=/app/.openclaw
32
  ENV OPENCLAW_STATE_DIR=/app/.openclaw/state
33
  ENV OPENCLAW_CONFIG_PATH=/app/openclaw.json
 
34
 
35
  RUN mkdir -p /app/vault /app/.openclaw/state
36
 
37
  EXPOSE 7860
38
 
39
- CMD ["uv", "run", "streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]
 
31
  ENV OPENCLAW_HOME=/app/.openclaw
32
  ENV OPENCLAW_STATE_DIR=/app/.openclaw/state
33
  ENV OPENCLAW_CONFIG_PATH=/app/openclaw.json
34
+ ENV AUTO_START_GATEWAY=0
35
 
36
  RUN mkdir -p /app/vault /app/.openclaw/state
37
 
38
  EXPOSE 7860
39
 
40
+ CMD ["sh", "-c", "${OPENCLAW_BIN} gateway --port ${OPENCLAW_PORT} > /tmp/openclaw-gateway.log 2>&1 & exec uv run streamlit run app.py --server.address=0.0.0.0 --server.port=7860"]
app.py CHANGED
@@ -44,6 +44,7 @@ def init_state() -> None:
44
  st.session_state.setdefault("gateway_logs", [])
45
  st.session_state.setdefault("config_editor_text", load_config_text())
46
  st.session_state.setdefault("auto_started", False)
 
47
  st.session_state.setdefault("backtest_result", None)
48
  st.session_state.setdefault("backtest_data", None)
49
  st.session_state.setdefault("backtest_params", None)
@@ -246,9 +247,15 @@ st.caption("Manage gateway runtime, config, environment, and test calls from one
246
  init_state()
247
  pull_logs()
248
 
249
- if os.getenv("AUTO_START_GATEWAY", "1") == "1" and not st.session_state["auto_started"]:
250
- start_gateway()
251
- st.session_state["auto_started"] = True
 
 
 
 
 
 
252
 
253
  status_col, action_col = st.columns([2, 3])
254
  with status_col:
 
44
  st.session_state.setdefault("gateway_logs", [])
45
  st.session_state.setdefault("config_editor_text", load_config_text())
46
  st.session_state.setdefault("auto_started", False)
47
+ st.session_state.setdefault("auto_start_attempted", False)
48
  st.session_state.setdefault("backtest_result", None)
49
  st.session_state.setdefault("backtest_data", None)
50
  st.session_state.setdefault("backtest_params", None)
 
247
  init_state()
248
  pull_logs()
249
 
250
+ if (
251
+ os.getenv("AUTO_START_GATEWAY", "1") == "1"
252
+ and not st.session_state["auto_start_attempted"]
253
+ ):
254
+ ok, msg = start_gateway()
255
+ st.session_state["auto_start_attempted"] = True
256
+ st.session_state["auto_started"] = ok
257
+ if not ok:
258
+ st.warning(f"Auto-start failed: {msg}")
259
 
260
  status_col, action_col = st.columns([2, 3])
261
  with status_col: