openclaw: add gateway as separate host-network container
Gateway runs in its own node:22-alpine container with host networking, installs openclaw@latest on first boot (persisted to /var/openclaw/gateway). Control center also switches to host networking so ws://127.0.0.1:18789 reaches the gateway's loopback. UI_BIND_ADDRESS locked to 127.0.0.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
45d673c292
commit
64672a1cde
2 changed files with 30 additions and 6 deletions
|
|
@ -2,23 +2,46 @@
|
||||||
{
|
{
|
||||||
project.name = "openclaw";
|
project.name = "openclaw";
|
||||||
|
|
||||||
networks.openclaw.external = false;
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
gateway = {
|
||||||
|
service = {
|
||||||
|
image = "node:22-alpine";
|
||||||
|
container_name = "openclaw-gateway";
|
||||||
|
restart = "unless-stopped";
|
||||||
|
network_mode = "host";
|
||||||
|
volumes = [
|
||||||
|
"/var/openclaw/gateway:/app"
|
||||||
|
"/root/.openclaw:/root/.openclaw"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
OPENCLAW_HOME = "/root/.openclaw";
|
||||||
|
};
|
||||||
|
command = [
|
||||||
|
"sh" "-c"
|
||||||
|
''
|
||||||
|
set -e
|
||||||
|
if [ ! -f /app/node_modules/.bin/openclaw ]; then
|
||||||
|
cd /app && npm install openclaw@latest
|
||||||
|
fi
|
||||||
|
exec /app/node_modules/.bin/openclaw gateway --port 18789
|
||||||
|
''
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
app = {
|
app = {
|
||||||
service = {
|
service = {
|
||||||
image = "node:lts-alpine";
|
image = "node:22-alpine";
|
||||||
container_name = "openclaw";
|
container_name = "openclaw";
|
||||||
restart = "unless-stopped";
|
restart = "unless-stopped";
|
||||||
networks = [ "openclaw" ];
|
network_mode = "host";
|
||||||
volumes = [
|
volumes = [
|
||||||
"/var/openclaw/app:/app"
|
"/var/openclaw/app:/app"
|
||||||
"/root/.openclaw:/root/.openclaw:ro"
|
"/root/.openclaw:/root/.openclaw:ro"
|
||||||
];
|
];
|
||||||
ports = [ "127.0.0.1:4310:4310" ];
|
|
||||||
environment = {
|
environment = {
|
||||||
PORT = "4310";
|
PORT = "4310";
|
||||||
UI_BIND_ADDRESS = "0.0.0.0";
|
UI_BIND_ADDRESS = "127.0.0.1";
|
||||||
OPENCLAW_HOME = "/root/.openclaw";
|
OPENCLAW_HOME = "/root/.openclaw";
|
||||||
};
|
};
|
||||||
command = [
|
command = [
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ in {
|
||||||
"d /var/paperless/postgres 0755 root root"
|
"d /var/paperless/postgres 0755 root root"
|
||||||
"d /var/paperless/redis 0755 root root"
|
"d /var/paperless/redis 0755 root root"
|
||||||
"d /var/openclaw/app 0755 root root"
|
"d /var/openclaw/app 0755 root root"
|
||||||
|
"d /var/openclaw/gateway 0755 root root"
|
||||||
"d /var/riverside/files 0755 root root"
|
"d /var/riverside/files 0755 root root"
|
||||||
"d /var/riverside/postgres 0755 root root"
|
"d /var/riverside/postgres 0755 root root"
|
||||||
"d /var/lib/gitea-runner/ubuntu 0755 gitea-runner gitea-runner"
|
"d /var/lib/gitea-runner/ubuntu 0755 gitea-runner gitea-runner"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue