Dmitry Beresnev commited on
Commit Β·
1c6354b
1
Parent(s): 844d8b8
add proxy, fix dockerfile
Browse files- Dockerfile +1 -1
- app.py +22 -8
Dockerfile
CHANGED
|
@@ -41,4 +41,4 @@ RUN mkdir -p /app/vault /app/.openclaw/state
|
|
| 41 |
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
-
CMD ["sh", "-c", "( ${OPENCLAW_BIN} gateway run --port ${OPENCLAW_PORT} --bind loopback --allow-unconfigured --dev --verbose || ${OPENCLAW_BIN} gateway --port ${OPENCLAW_PORT} --bind loopback --allow-unconfigured --dev --verbose ) > /tmp/openclaw-gateway.log 2> /tmp/openclaw-gateway.err.log & uv run streamlit run app.py --server.address=0.0.0.0 --server.port=8501 > /tmp/streamlit.log 2>&1 & exec caddy run --config /app/Caddyfile --adapter caddyfile"]
|
|
|
|
| 41 |
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
+
CMD ["sh", "-c", "( while true; do ${OPENCLAW_BIN} gateway run --port ${OPENCLAW_PORT} --bind loopback --allow-unconfigured --dev --verbose || ${OPENCLAW_BIN} gateway --port ${OPENCLAW_PORT} --bind loopback --allow-unconfigured --dev --verbose; echo \"[gateway] exited with $?; restarting in 2s\"; sleep 2; done ) > /tmp/openclaw-gateway.log 2> /tmp/openclaw-gateway.err.log & uv run streamlit run app.py --server.address=0.0.0.0 --server.port=8501 > /tmp/streamlit.log 2>&1 & exec caddy run --config /app/Caddyfile --adapter caddyfile"]
|
app.py
CHANGED
|
@@ -33,6 +33,7 @@ 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")
|
| 38 |
CADDY_ERR_LOG_PATH = Path("/tmp/caddy.err.log")
|
|
@@ -399,20 +400,33 @@ st.divider()
|
|
| 399 |
st.subheader("OpenClaw Standard UI")
|
| 400 |
std_ui_status_col, std_ui_embed_col = st.columns([1, 3])
|
| 401 |
with std_ui_status_col:
|
| 402 |
-
|
| 403 |
-
|
|
|
|
|
|
|
| 404 |
std_ui_url = with_token(OPENCLAW_STANDARD_UI_URL, OPENCLAW_GATEWAY_TOKEN)
|
| 405 |
try:
|
| 406 |
ui_resp = requests.get(std_ui_url, timeout=2, allow_redirects=True)
|
| 407 |
-
|
| 408 |
-
ui_ok = ui_resp.status_code < 500
|
| 409 |
if ui_resp.status_code in (401, 403):
|
| 410 |
-
|
| 411 |
else:
|
| 412 |
-
|
| 413 |
except Exception:
|
| 414 |
-
|
| 415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
st.caption(f"URL: {std_ui_url}")
|
| 417 |
if OPENCLAW_STANDARD_UI_PUBLIC_URL:
|
| 418 |
st.caption(f"Public URL: {OPENCLAW_STANDARD_UI_PUBLIC_URL}")
|
|
|
|
| 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 |
+
OPENCLAW_PROXY_LOCAL_URL = os.getenv("OPENCLAW_PROXY_LOCAL_URL", "http://127.0.0.1:7860/openclaw/")
|
| 37 |
SUPERVISOR_LOG_PATH = Path("/tmp/supervisord.log")
|
| 38 |
STREAMLIT_ERR_LOG_PATH = Path("/tmp/streamlit.err.log")
|
| 39 |
CADDY_ERR_LOG_PATH = Path("/tmp/caddy.err.log")
|
|
|
|
| 400 |
st.subheader("OpenClaw Standard UI")
|
| 401 |
std_ui_status_col, std_ui_embed_col = st.columns([1, 3])
|
| 402 |
with std_ui_status_col:
|
| 403 |
+
local_ok = False
|
| 404 |
+
proxy_ok = False
|
| 405 |
+
local_status = "Unavailable"
|
| 406 |
+
proxy_status = "Unavailable"
|
| 407 |
std_ui_url = with_token(OPENCLAW_STANDARD_UI_URL, OPENCLAW_GATEWAY_TOKEN)
|
| 408 |
try:
|
| 409 |
ui_resp = requests.get(std_ui_url, timeout=2, allow_redirects=True)
|
| 410 |
+
local_ok = ui_resp.status_code < 500
|
|
|
|
| 411 |
if ui_resp.status_code in (401, 403):
|
| 412 |
+
local_status = f"Available (auth required, HTTP {ui_resp.status_code})"
|
| 413 |
else:
|
| 414 |
+
local_status = "Available" if local_ok else f"HTTP {ui_resp.status_code}"
|
| 415 |
except Exception:
|
| 416 |
+
local_ok = False
|
| 417 |
+
|
| 418 |
+
try:
|
| 419 |
+
proxy_resp = requests.get(OPENCLAW_PROXY_LOCAL_URL, timeout=2, allow_redirects=True)
|
| 420 |
+
proxy_ok = proxy_resp.status_code < 500
|
| 421 |
+
proxy_status = "Available" if proxy_ok else f"HTTP {proxy_resp.status_code}"
|
| 422 |
+
except Exception:
|
| 423 |
+
proxy_ok = False
|
| 424 |
+
|
| 425 |
+
st.markdown(f"Gateway Local ({std_ui_url}): {'π’' if local_ok else 'π΄'} {local_status}")
|
| 426 |
+
st.markdown(
|
| 427 |
+
f"Gateway Via Proxy ({OPENCLAW_PROXY_LOCAL_URL}): "
|
| 428 |
+
f"{'π’' if proxy_ok else 'π΄'} {proxy_status}"
|
| 429 |
+
)
|
| 430 |
st.caption(f"URL: {std_ui_url}")
|
| 431 |
if OPENCLAW_STANDARD_UI_PUBLIC_URL:
|
| 432 |
st.caption(f"Public URL: {OPENCLAW_STANDARD_UI_PUBLIC_URL}")
|