Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

fix(install): listen on 0.0.0.0 without requiring LOOPFORGE_PUBLIC_URL (#98)

cocofhu48193c6f4cbb
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9c48bb07..f3e4a3c2 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -125,7 +125,7 @@ jobs:
\`\`\`bash
git clone --branch ${TAG} https://github.com/${GITHUB_REPOSITORY}.git
cd ${GITHUB_REPOSITORY#*/}
- LOOPFORGE_PUBLIC_URL=https://loopforge.example.com ./start.sh
+ ./start.sh
\`\`\`
Platform image: \`${IMAGE}:${VERSION}\` (pinned in \`compose.yaml\`). Existing installations: check out \`${TAG}\`, run \`./start.sh\`, and apply the new files under \`migrations/\` listed in [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG}/CHANGELOG.md).
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcddb5b8..ea22e9e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
Platform releases use `vX.Y.Z` tags and publish `ghcr.io/tencent/loopforge`. LoopForge Local packages use `local-vX.Y.Z` tags and are published by manually running the `release-local` workflow.
+## Unreleased
+
+- Listen on `0.0.0.0` by default, including older installations without `LOOPFORGE_BIND`. The installer no longer asks for, or fails without, `LOOPFORGE_PUBLIC_URL`; it is optional and only changes the printed address.
+
## 0.3.1 — published-image startup
- Start from the published GHCR image pinned in `compose.yaml` instead of building locally: `./start.sh` (`logs`, `stop`, `down`, `restart`, `pull`) and a plain `docker compose --profile platform up` no longer build.
diff --git a/README.md b/README.md
index 493d4cdd..1210f37d 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ cd LoopForge
This pulls the GHCR release image pinned in `compose.yaml` without building locally. Use `./start.sh logs`, `stop`, `restart` or `pull` to manage it, and `./start.sh dev` to build the checkout from source.
-Open the URL printed by the installer and create your account; the first one becomes the administrator. For a cloud deployment, set `LOOPFORGE_PUBLIC_URL=https://your-domain` before the first run and allow the service port in your security group, or put an HTTPS reverse proxy in front. Restrict access to your own IP until the administrator account exists. The home page's quick-access guide walks you through adding a model key, connecting a repository and choosing an SOP.
+Open the URL printed by the installer and create your account; the first one becomes the administrator. The service listens on `0.0.0.0:8090` by default; on a cloud host open `http://<public IP>:8090` after allowing the port in your security group, or put an HTTPS reverse proxy in front. Restrict access to your own IP until the administrator account exists. The home page's quick-access guide walks you through adding a model key, connecting a repository and choosing an SOP.
### Try it without an API key
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 7bb331c1..d7452bb8 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -77,7 +77,7 @@ cd LoopForge
默认直接拉取 `compose.yaml` 中 pin 的 GHCR 发布镜像,不在本地构建。用 `./start.sh logs`、`stop`、`restart`、`pull` 管理服务;需要从源码构建时用 `./start.sh dev`。
-打开安装脚本输出的访问链接创建账号,第一个账号自动成为管理员。云端部署可在首次执行前设置 `LOOPFORGE_PUBLIC_URL=https://你的域名`,并放通安全组端口或配置 HTTPS 反向代理;管理员账号创建前,建议只允许你的 IP 访问。首页的「快速接入」会带你配置模型凭据、绑定仓库并选好默认 SOP。
+打开安装脚本输出的访问链接创建账号,第一个账号自动成为管理员。服务默认监听 `0.0.0.0:8090`,云主机放通安全组端口后访问 `http://公网IP:8090`,或配置 HTTPS 反向代理;管理员账号创建前,建议只允许你的 IP 访问。首页的「快速接入」会带你配置模型凭据、绑定仓库并选好默认 SOP。
### 免 API Key 体验
diff --git a/compose.yaml b/compose.yaml
index fa1824bb..229c9fea 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -23,7 +23,7 @@ services:
# AGENTFLOW_ISOLATED_IMAGE) with each release; source builds use compose.dev.yaml.
image: ${LOOPFORGE_IMAGE:-ghcr.io/tencent/loopforge:0.3.1}
ports:
- - "${LOOPFORGE_BIND:-127.0.0.1}:${AGENTFLOW_HTTP_PORT:-8090}:8080"
+ - "${LOOPFORGE_BIND:-0.0.0.0}:${AGENTFLOW_HTTP_PORT:-8090}:8080"
environment:
AGENTFLOW_HTTP_PORT: 8080
AGENTFLOW_MYSQL_DSN: loopforge:${LOOPFORGE_DB_PASSWORD}@tcp(mysql:3306)/loopforge
diff --git a/docs/deployment.md b/docs/deployment.md
index cd2d57a6..1e0030d5 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -45,7 +45,7 @@ Open the platform and create the first account in the browser; it receives platf
During initial setup, restrict the cloud security group or firewall to the operator's IP. Do not expose the first-account setup page to arbitrary Internet clients before the administrator account has been created.
-New installations save `LOOPFORGE_BIND=0.0.0.0` for team access. Set `LOOPFORGE_PUBLIC_URL` to the public IP/domain users actually visit; the installer prints that URL. Without one it prints detected host addresses, which may be private when a cloud NAT is in use, and explains how to configure the public URL. Allow the HTTP port in the cloud security group/firewall, or use an HTTPS reverse proxy. Existing `.env` files are preserved; older installations without a bind setting retain their loopback binding until explicitly changed. Local-only installations can set `LOOPFORGE_BIND=127.0.0.1`. Proxy WebSocket and streaming requests. Set `AGENTFLOW_SECURE_COOKIES=true` when HTTPS terminates at the proxy. Keep `AGENTFLOW_SESSION_SECRET` stable across API instances and restarts.
+The platform listens on `LOOPFORGE_BIND`, `0.0.0.0` by default, without prompting for an access URL. The installer prints detected host addresses, which may be private behind a cloud NAT; open the public IP instead. `LOOPFORGE_PUBLIC_URL` is optional and only changes the printed address. Allow the HTTP port in the cloud security group/firewall, or use an HTTPS reverse proxy. Existing `.env` files are preserved; older installations without a bind setting now also listen on `0.0.0.0`. Local-only installations can set `LOOPFORGE_BIND=127.0.0.1`. Proxy WebSocket and streaming requests. Set `AGENTFLOW_SECURE_COOKIES=true` when HTTPS terminates at the proxy. Keep `AGENTFLOW_SESSION_SECRET` stable across API instances and restarts.
### Docker sandboxes
diff --git a/scripts/install-address.py b/scripts/install-address.py
index 0262c59c..8c60042b 100644
--- a/scripts/install-address.py
+++ b/scripts/install-address.py
@@ -39,7 +39,7 @@ def access_addresses(port, environ=os.environ):
host = f'[{bind}]' if ':' in bind else bind
return [f'http://{host}:{port}'], 'Local access only. Set LOOPFORGE_BIND=0.0.0.0 and LOOPFORGE_PUBLIC_URL in .env for team access.'
if container_host():
- return [], 'Installation is inside a container. Its IP/port are not the host access address. Set LOOPFORGE_PUBLIC_URL to the host IP/domain and published port.'
+ return [], 'Installation is inside a container; open the host IP and published port.'
if bind not in ('0.0.0.0', '::', '[::]'):
hosts = [bind.strip('[]')]
else:
@@ -56,25 +56,12 @@ def access_addresses(port, environ=os.environ):
pass
hosts = list(dict.fromkeys(host for host in hosts if not ipaddress.ip_address(host).is_loopback and not ipaddress.ip_address(host).is_unspecified and not ipaddress.ip_address(host).is_link_local))
addresses = [f'http://[{host}]:{port}' if ':' in host else f'http://{host}:{port}' for host in hosts]
- return addresses, 'Cloud NAT public addresses cannot be inferred reliably. Set LOOPFORGE_PUBLIC_URL to your public IP/domain and allow the service port in the security group/firewall.'
+ return addresses, 'On cloud hosts behind NAT, open the public IP instead and allow the port in the security group/firewall.'
def prepare_address(port, environ=os.environ):
- addresses, note = access_addresses(port, environ)
+ access_addresses(port, environ)
public = environ.get('LOOPFORGE_PUBLIC_URL', '').rstrip('/')
- local = environ.get('LOOPFORGE_BIND') in ('127.0.0.1', 'localhost', '::1')
- if not public and not local:
- if sys.stdin.isatty() and environ.get('LOOPFORGE_YES') != '1':
- suggestion = addresses[0] if addresses else ''
- print('\nTeam access: use the IP/domain and port that teammates actually visit.')
- print('For cloud NAT, use the public IP/domain from your cloud console. For containers, use the host published port.')
- public = input(f'Team URL [{suggestion}]: ').strip() or suggestion
- elif addresses:
- # The first address is the one carrying the default route.
- public = addresses[0]
- if not public:
- raise ValueError('No host access URL can be inferred safely. Set LOOPFORGE_PUBLIC_URL=http://SERVER_IP:PUBLISHED_PORT and rerun; no images have been built. '+note)
- access_addresses(port, dict(environ, LOOPFORGE_PUBLIC_URL=public))
if public:
config = Path('.env')
lines = config.read_text().splitlines()
@@ -99,5 +86,5 @@ if __name__ == '__main__':
for address in addresses:
print(f' {"Access" if os.environ.get("LOOPFORGE_PUBLIC_URL") else "Server address (may be LAN-only)"}: {address}')
if not addresses:
- print(' Set LOOPFORGE_PUBLIC_URL in .env to your reachable server IP/domain.')
+ print(f' Listening on {os.environ.get("LOOPFORGE_BIND", "0.0.0.0")}:{sys.argv[1]}; open http://SERVER_IP:{sys.argv[1]}.')
print(f' {note}')
diff --git a/scripts/install.sh b/scripts/install.sh
index 3ef614ca..9493e54e 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -68,7 +68,7 @@ requested_public_url="${LOOPFORGE_PUBLIC_URL:-}"
bash scripts/configure.sh
[[ -r .env ]] || fail 'The existing .env is not readable by this user. Use the installation owner or ask an administrator to correct its ownership.'
set -a; source .env; set +a
-export LOOPFORGE_BIND="${LOOPFORGE_BIND:-127.0.0.1}"
+export LOOPFORGE_BIND="${LOOPFORGE_BIND:-0.0.0.0}"
if [[ -n "$requested_public_url" ]]; then export LOOPFORGE_PUBLIC_URL="$requested_public_url"; fi
python3 scripts/install-address.py --prepare "${AGENTFLOW_HTTP_PORT:-8090}"
set -a; source .env; set +a
diff --git a/scripts/test-install.py b/scripts/test-install.py
index e6a0c820..8b8d0647 100644
--- a/scripts/test-install.py
+++ b/scripts/test-install.py
@@ -160,40 +160,14 @@ exec "$@"
self.assertTrue(Path(data, 'home').is_dir())
self.assertFalse((self.root / 'should-not-exist').exists())
- def test_interactive_install_persists_team_url(self):
- master, slave = pty.openpty()
- process = subprocess.Popen(['bash', 'scripts/install.sh'], cwd=self.root,
- env=dict(self.environ, LOOPFORGE_PUBLIC_URL='', LOOPFORGE_YES='', MOCK_USER='1000', MOCK_DIRECT='1'),
- stdin=slave, stdout=slave, stderr=slave)
- os.close(slave)
- output, answered = b'', False
- try:
- deadline = time.monotonic() + 15
- while time.monotonic() < deadline:
- readable, _, _ = select.select([master], [], [], 0.2)
- if readable:
- try:
- chunk = os.read(master, 65536)
- except OSError:
- break
- if not chunk:
- break
- output += chunk
- if b'Team URL [' in output and not answered:
- os.write(master, b'https://team.example.test\n')
- answered = True
- elif process.poll() is not None:
- break
- process.wait(timeout=2)
- self.assertEqual(process.returncode, 0, output.decode())
- self.assertTrue(answered)
- self.assertIn(b'Access: https://team.example.test', output)
- self.assertIn('LOOPFORGE_PUBLIC_URL=https://team.example.test', (self.root / '.env').read_text())
- finally:
- if process.poll() is None:
- process.kill()
- process.wait()
- os.close(master)
+ def test_install_without_public_url_binds_all_interfaces_without_prompting(self):
+ self.environ.pop('LOOPFORGE_BIND')
+ result = self.install(LOOPFORGE_PUBLIC_URL='')
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertNotIn('Team URL', result.stdout)
+ config = (self.root / '.env').read_text()
+ self.assertIn('LOOPFORGE_BIND=0.0.0.0', config)
+ self.assertIn("LOOPFORGE_PUBLIC_URL=''", config)
def test_existing_empty_url_can_be_set_without_rotating_secrets(self):
self.assert_success(self.install())
@@ -210,14 +184,6 @@ exec "$@"
self.assertNotEqual(result.returncode, 0)
self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
- def test_unknown_container_url_fails_before_build(self):
- result = self.install(LOOPFORGE_PUBLIC_URL='', LOOPFORGE_YES='1')
- if address.container_host():
- self.assertNotEqual(result.returncode, 0)
- self.assertIn('LOOPFORGE_PUBLIC_URL', result.stderr)
- self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
-
-
class AddressTests(unittest.TestCase):
def test_public_url_and_loopback_proxy(self):
urls, note = address.access_addresses('8090', {'LOOPFORGE_BIND': '127.0.0.1', 'LOOPFORGE_PUBLIC_URL': 'https://team.example.test/'})