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.

feat(deploy): start from the pinned GHCR release image (0.3.1) (#96)

cocofhu798d00658b6b
diff --git a/.env.example b/.env.example
index 935270dd..a6ea9efd 100644
--- a/.env.example
+++ b/.env.example
@@ -1,4 +1,8 @@
-# Run bash scripts/configure.sh to generate unique local database/session secrets.
+# ./start.sh (or bash scripts/configure.sh) generates .env with unique local database/session secrets.
+# Platform image: empty uses the GHCR release pinned in compose.yaml. Prefer an @sha256: digest when overriding.
+LOOPFORGE_IMAGE=
+# Source build of this checkout (./start.sh dev writes this line; ./start.sh release removes it):
+# COMPOSE_FILE=compose.yaml:compose.dev.yaml
AGENTFLOW_HTTP_PORT=8090
AGENTFLOW_MYSQL_DSN=loopforge:REPLACE_ME@tcp(127.0.0.1:33315)/loopforge
AGENTFLOW_SESSION_SECRET=REPLACE_WITH_64_RANDOM_HEX_CHARACTERS
diff --git a/.github/workflows/platform.yml b/.github/workflows/platform.yml
index aaa7c870..42d2db98 100644
--- a/.github/workflows/platform.yml
+++ b/.github/workflows/platform.yml
@@ -116,6 +116,8 @@ jobs:
if-no-files-found: ignore
first-run:
# The path a new user takes: one-command install, then accounts created in the browser.
+ # Pulls the GHCR release pinned in compose.yaml; release.yml smoke-tests each newly published image.
+ # A pin bumped ahead of its tag has no image yet, so that commit is checked from source.
runs-on: ubuntu-latest
timeout-minutes: 30
env:
@@ -131,7 +133,15 @@ jobs:
working-directory: e2e
- run: npx playwright install --with-deps chromium
working-directory: e2e
- - run: bash scripts/install.sh
+ - name: Install the pinned release, or build it while that release is not published yet
+ run: |
+ pinned=$(sed -n 's/^ *image: \${LOOPFORGE_IMAGE:-\(.*\)}$/\1/p' compose.yaml)
+ if docker manifest inspect "$pinned" > /dev/null 2>&1; then
+ ./start.sh -d
+ else
+ echo "::notice::$pinned is not published yet; building this checkout"
+ ./start.sh dev
+ fi
- name: Generate test passwords
run: |
mkdir -p .local
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d6382d9e..9c48bb07 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -57,6 +57,10 @@ jobs:
exit 1
fi
version="${TAG#v}"
+ if [[ "$(grep -cF "/loopforge:${version}}" compose.yaml)" != 2 ]]; then
+ echo "compose.yaml must pin loopforge:${version} (platform image and AGENTFLOW_ISOLATED_IMAGE) before tagging ${TAG}" >&2
+ exit 1
+ fi
image="ghcr.io/${GITHUB_REPOSITORY,,}"
prerelease=false
[[ "${version}" == *-* ]] && prerelease=true
@@ -87,6 +91,7 @@ jobs:
type=raw,value=latest,enable=${{ steps.release.outputs.prerelease == 'false' }}
- uses: docker/build-push-action@v6
+ id: push
with:
context: .
push: true
@@ -95,6 +100,16 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
+ - name: Smoke-test the published image by digest
+ env:
+ LOOPFORGE_IMAGE: ${{ steps.release.outputs.image }}@${{ steps.push.outputs.digest }}
+ run: |
+ ./start.sh -d
+ curl -fsS http://127.0.0.1:8090/api/health
+
+ - if: failure()
+ run: docker compose logs platform | tail -200
+
- name: Create or update GitHub Release
shell: bash
env:
@@ -110,10 +125,10 @@ jobs:
\`\`\`bash
git clone --branch ${TAG} https://github.com/${GITHUB_REPOSITORY}.git
cd ${GITHUB_REPOSITORY#*/}
- LOOPFORGE_IMAGE=${IMAGE}:${VERSION} LOOPFORGE_PUBLIC_URL=https://loopforge.example.com bash scripts/install.sh
+ LOOPFORGE_PUBLIC_URL=https://loopforge.example.com ./start.sh
\`\`\`
- Platform image: \`${IMAGE}:${VERSION}\`. Existing installations: update \`LOOPFORGE_IMAGE\` in \`.env\`, re-run \`bash scripts/install.sh\`, and apply the new files under \`migrations/\` listed in [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG}/CHANGELOG.md).
+ 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).
EOF
)"
if gh release view "${TAG}" >/dev/null 2>&1; then
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3cf23786..fcddb5b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
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.
+## 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.
+- Build a checkout explicitly with `./start.sh dev` (`compose.dev.yaml`, local `loopforge-platform:local` tag); `./start.sh release` switches back to the published image.
+- Releases require `compose.yaml` to pin the tagged version and smoke-test the pushed image digest before creating the GitHub Release.
+
+Existing source-built installations switch to the published image on the next `./start.sh`; no migrations are required. The image is published for linux/amd64; use `./start.sh dev` on other architectures.
+
## 0.3.0 — platform edition
- Add the self-hosted platform implementation, including Main Bot workspace editing, durable workspace checkpoints, idle reclamation, and task-group SOP completion/reopening.
diff --git a/README.md b/README.md
index 2e0febbf..493d4cdd 100644
--- a/README.md
+++ b/README.md
@@ -72,9 +72,11 @@ Requires **Git, curl, Docker (with Compose)** and **Python 3**. On a fresh Ubunt
```bash
git clone https://github.com/Tencent/LoopForge.git
cd LoopForge
-bash scripts/install.sh
+./start.sh
```
+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.
### Try it without an API key
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 6ea74598..7bb331c1 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -72,9 +72,11 @@ https://github.com/user-attachments/assets/10b8ae2e-d7e7-4b78-8876-c45818d4a08f
```bash
git clone https://github.com/Tencent/LoopForge.git
cd LoopForge
-bash scripts/install.sh
+./start.sh
```
+默认直接拉取 `compose.yaml` 中 pin 的 GHCR 发布镜像,不在本地构建。用 `./start.sh logs`、`stop`、`restart`、`pull` 管理服务;需要从源码构建时用 `./start.sh dev`。
+
打开安装脚本输出的访问链接创建账号,第一个账号自动成为管理员。云端部署可在首次执行前设置 `LOOPFORGE_PUBLIC_URL=https://你的域名`,并放通安全组端口或配置 HTTPS 反向代理;管理员账号创建前,建议只允许你的 IP 访问。首页的「快速接入」会带你配置模型凭据、绑定仓库并选好默认 SOP。
### 免 API Key 体验
diff --git a/compose.dev.yaml b/compose.dev.yaml
new file mode 100644
index 00000000..236cbf27
--- /dev/null
+++ b/compose.dev.yaml
@@ -0,0 +1,12 @@
+# Source build of this checkout, layered on compose.yaml:
+# ./start.sh dev or docker compose -f compose.yaml -f compose.dev.yaml --profile platform up --build
+# The fixed local tag keeps source builds from overwriting the pinned GHCR image.
+services:
+ platform:
+ image: loopforge-platform:local
+ build:
+ context: .
+ args:
+ LOOPFORGE_BUILD_JOBS: ${LOOPFORGE_BUILD_JOBS:-}
+ environment:
+ AGENTFLOW_ISOLATED_IMAGE: loopforge-platform:local
diff --git a/compose.yaml b/compose.yaml
index cb14a07a..fa1824bb 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -19,11 +19,9 @@ services:
retries: 60
platform:
profiles: [platform]
- image: ${LOOPFORGE_IMAGE:-loopforge-platform:local}
- build:
- context: .
- args:
- LOOPFORGE_BUILD_JOBS: ${LOOPFORGE_BUILD_JOBS:-}
+ # Published release stack: never builds. Bump the pinned tag (here and in
+ # 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"
environment:
@@ -42,7 +40,7 @@ services:
AGENTFLOW_PLATFORM_MCP_URL: ${AGENTFLOW_PLATFORM_MCP_URL:-http://platform:8080}
AGENTFLOW_DOCKER_NETWORK: ${COMPOSE_PROJECT_NAME:-loopforge}_default
AGENTFLOW_LOCAL_SANDBOX: docker
- AGENTFLOW_ISOLATED_IMAGE: ${LOOPFORGE_IMAGE:-loopforge-platform:local}
+ AGENTFLOW_ISOLATED_IMAGE: ${LOOPFORGE_IMAGE:-ghcr.io/tencent/loopforge:0.3.1}
HOME: ${LOOPFORGE_DATA_DIR:?Run scripts/configure.sh first}/home
AGENTFLOW_RUNNER_BINARY: /app/bin/agentflow-runner-{os}-{arch}
AGENTFLOW_GATE_MCP_BINARY: /app/bin/agentflow-gate-mcp-{os}-{arch}
diff --git a/docs/deployment.md b/docs/deployment.md
index c22bdcfb..cd2d57a6 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -22,21 +22,24 @@ Use `AGENTFLOW_MYSQL_DSN` for your own MySQL deployment. A fresh account command
## Container installation
```bash
-bash scripts/install.sh
+./start.sh # install or start in the background (runs scripts/install.sh)
+./start.sh logs # follow platform logs
+./start.sh stop # stop; ./start.sh down removes containers but keeps data volumes
+./start.sh restart # restart the platform container
+./start.sh pull # refresh images and recreate changed containers
+./start.sh dev # build this checkout instead (compose.dev.yaml)
+./start.sh release # switch a source build back to the published image
```
-The installer checks Docker, Compose and Python (and offers to install Docker when it is missing; set `LOOPFORGE_YES=1` to accept without prompting), generates `.env` with unique secrets, builds and starts the containers, installs the observability columns and applies `migrations/seed/*.sql`. It is safe to re-run. Set `AGENTFLOW_HTTP_PORT` or `LOOPFORGE_MYSQL_PORT` in the environment before the first run (or edit `.env` later) when the default ports are taken.
+The installer checks Docker, Compose and Python (and offers to install Docker when it is missing; set `LOOPFORGE_YES=1` to accept without prompting), generates `.env` with unique secrets, pulls and starts the containers, installs the observability columns and applies `migrations/seed/*.sql`. It is safe to re-run. Set `AGENTFLOW_HTTP_PORT` or `LOOPFORGE_MYSQL_PORT` in the environment before the first run (or edit `.env` later) when the default ports are taken.
Run it as the installation owner, including an ordinary Linux user. If that user cannot access Docker directly, the installer validates sudo and uses `sudo -n docker` consistently for Compose, schema installation and seeds. Before each operation it checks whether sudo credentials expired during a long build, prompting again in a terminal or failing with instructions in unattended mode. It does not require adding the user to the Docker group or logging out. For unattended installations run `sudo -v` first; `LOOPFORGE_YES=1` accepts installation prompts but does not bypass operating-system permissions. Without sudo or Docker access it fails immediately with instructions. Rootless Docker uses its active context's Unix socket; remote Docker contexts need a separately configured deployment because sandbox workspaces are local bind mounts.
-Source builds reuse npm, Go module and Go compiler caches. For the fastest first installation, check out a release tag and use its published image:
+`compose.yaml` is the published-image stack and never builds: `./start.sh`, `scripts/install.sh` and a plain `docker compose --profile platform up` all pull the GHCR release pinned there (currently `ghcr.io/tencent/loopforge:0.3.1`). The pin matches the checkout's migrations and seeds, so check out a release tag when you install. Set `LOOPFORGE_IMAGE` (for example to an `@sha256:` digest) only to override it; a value saved in `.env` takes precedence over later pin changes.
-```bash
-LOOPFORGE_IMAGE=ghcr.io/tencent/loopforge:0.3.0 \
-LOOPFORGE_PUBLIC_URL=https://loopforge.example.com bash scripts/install.sh
-```
+`./start.sh dev` (or `LOOPFORGE_BUILD_FROM_SOURCE=1 bash scripts/install.sh`) builds this checkout as `loopforge-platform:local` from `compose.dev.yaml`. It saves `COMPOSE_FILE=compose.yaml:compose.dev.yaml` in `.env`, so later runs and plain `docker compose` commands keep using the source build until `./start.sh release`. Source builds reuse npm, Go module and Go compiler caches.
-Pushing a `vX.Y.Z` tag on `main` runs the `release` workflow once the `platform` workflow has passed on that commit. It publishes `ghcr.io/<owner>/loopforge` as `X.Y.Z`, `X.Y`, `latest` and `sha-<commit>`, and creates the GitHub Release. Forks publish under their own owner; set the GHCR package visibility/access for your team before distributing the image. Images are pulled only when missing by default; use an immutable tag/digest, or set `LOOPFORGE_PULL_POLICY=always` when updating a mutable tag. Without `LOOPFORGE_IMAGE`, the installer builds this checkout. Existing `.env` values take precedence; change the saved image or URL there when updating an installation. Compose waits for the API's health check with a bounded timeout before installing schema extensions and seeds.
+Pushing a `vX.Y.Z` tag on `main` runs the `release` workflow once the `platform` workflow has passed on that commit. The tagged `compose.yaml` must already pin `loopforge:X.Y.Z`. It publishes `ghcr.io/<owner>/loopforge` as `X.Y.Z`, `X.Y`, `latest` and `sha-<commit>`, smoke-tests the pushed digest with `./start.sh`, and creates the GitHub Release. Forks publish under their own owner; set the GHCR package visibility/access for your team before distributing the image. Images are pulled only when missing by default; use an immutable tag/digest, or set `LOOPFORGE_PULL_POLICY=always` when updating a mutable tag. Existing `.env` values take precedence; change the saved image or URL there when updating an installation. Compose waits for the API's health check with a bounded timeout before installing schema extensions and seeds.
Open the platform and create the first account in the browser; it receives platform administration. Until that account exists the login page only offers this setup step.
diff --git a/scripts/install.sh b/scripts/install.sh
index a2628909..3ef614ca 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
-# One-command container installation. Installs Docker when it is missing
-# (Linux, or macOS with Homebrew) and needs Python 3. Re-running is safe:
-# secrets, data and catalog edits are kept.
+# One-command container installation from the published GHCR image pinned in
+# compose.yaml (LOOPFORGE_BUILD_FROM_SOURCE=1 builds this checkout instead).
+# Installs Docker when it is missing (Linux, or macOS with Homebrew) and needs
+# Python 3. Re-running is safe: secrets, data and catalog edits are kept.
set -euo pipefail
cd "$(dirname "$0")/.."
@@ -96,8 +97,20 @@ if ! docker_access compose ps --status running --services 2>/dev/null | grep -qx
fi
fi
-if [[ -n "${LOOPFORGE_IMAGE:-}" ]]; then
- step 'Pulling the prebuilt LoopForge image'
+dev_compose=compose.yaml:compose.dev.yaml
+if [[ "${LOOPFORGE_BUILD_FROM_SOURCE:-0}" == 1 && "${COMPOSE_FILE:-}" != "$dev_compose" ]]; then
+ # Persisted because sudo-run Compose only reads .env; later plain compose commands keep the source stack.
+ python3 - "$dev_compose" <<'PY'
+import pathlib,re,sys
+p=pathlib.Path('.env')
+text=re.sub(r'(?m)^COMPOSE_FILE=.*\n?','',p.read_text())
+p.write_text(text.rstrip('\n')+'\nCOMPOSE_FILE='+sys.argv[1]+'\n')
+PY
+ export COMPOSE_FILE="$dev_compose"
+fi
+
+if [[ "${COMPOSE_FILE:-}" != "$dev_compose" ]]; then
+ step "Pulling the published LoopForge image ${LOOPFORGE_IMAGE:-pinned in compose.yaml}"
docker_access compose --profile platform pull --policy "${LOOPFORGE_PULL_POLICY:-missing}" platform mysql
docker_access compose --profile platform up -d --no-build --wait --wait-timeout 180
else
@@ -123,4 +136,4 @@ else
fi
printf ' Open “一键体验” on the home page to run a real SOP without an API key.\n'
printf ' Default sandboxes reuse the installed runtime image; no second CLI image build is needed.\n'
-printf ' Stop: docker compose --profile platform stop · Logs: docker compose logs -f platform\n'
+printf ' Stop: ./start.sh stop · Logs: ./start.sh logs · Update images: ./start.sh pull\n'
diff --git a/scripts/test-container.sh b/scripts/test-container.sh
index c3a3e6bc..8ba8af9b 100755
--- a/scripts/test-container.sh
+++ b/scripts/test-container.sh
@@ -21,10 +21,12 @@ if [[ -n "${LOOPFORGE_CONTAINER_TEST_IMAGE:-}" ]]; then
python3 - <<'PY_IMAGE'
import json,os,pathlib
p=pathlib.Path(os.environ['TASK_DIR'])/'image.json'
-p.write_text(json.dumps({'services':{'platform':{'image':os.environ['LOOPFORGE_CONTAINER_TEST_IMAGE']}}}))
+image=os.environ['LOOPFORGE_CONTAINER_TEST_IMAGE']
+p.write_text(json.dumps({'services':{'platform':{'image':image,'environment':{'AGENTFLOW_ISOLATED_IMAGE':image}}}}))
PY_IMAGE
fi
COMPOSE=(docker compose -f "$ROOT_DIR/compose.yaml")
+if [[ "${LOOPFORGE_CONTAINER_SKIP_BUILD:-0}" != '1' ]]; then COMPOSE+=(-f "$ROOT_DIR/compose.dev.yaml"); fi
if [[ -f "$TASK_DIR/image.json" ]]; then COMPOSE+=(-f "$TASK_DIR/image.json"); fi
COMPOSE+=( --env-file "$TASK_DIR/install.env" --project-name "$TASK_PROJECT")
cleanup() {
diff --git a/scripts/test-install.py b/scripts/test-install.py
index 1d41b854..e6a0c820 100644
--- a/scripts/test-install.py
+++ b/scripts/test-install.py
@@ -26,6 +26,7 @@ class InstallerTests(unittest.TestCase):
(self.root / 'migrations/seed').mkdir(parents=True)
for name in ('install.sh', 'configure.sh', 'docker-access.sh', 'install-address.py', 'install-observability-schema.sh'):
shutil.copyfile(ROOT / 'scripts' / name, self.root / 'scripts' / name)
+ shutil.copyfile(ROOT / 'start.sh', self.root / 'start.sh')
(self.root / 'migrations/seed/001_test.sql').write_text('SELECT 1;\n')
(self.root / 'mock').mkdir()
self.executable('docker', '''#!/usr/bin/env bash
@@ -52,7 +53,7 @@ export MOCK_PRIVILEGED=1
exec "$@"
''')
self.environ = dict(os.environ, PATH=str(self.root / 'mock') + ':' + os.environ['PATH'], MOCK_LOG=str(self.root / 'docker.log'), AGENTFLOW_HTTP_PORT='18765', LOOPFORGE_PUBLIC_URL='https://team.example.test', LOOPFORGE_BIND='0.0.0.0')
- for name in ('LOOPFORGE_DOCKER_USE_SUDO', 'LOOPFORGE_DATA_DIR', 'LOOPFORGE_IMAGE', 'MOCK_USER', 'MOCK_DIRECT', 'MOCK_SUDO_DENIED'):
+ for name in ('LOOPFORGE_DOCKER_USE_SUDO', 'LOOPFORGE_DATA_DIR', 'LOOPFORGE_IMAGE', 'COMPOSE_FILE', 'LOOPFORGE_BUILD_FROM_SOURCE', 'MOCK_USER', 'MOCK_DIRECT', 'MOCK_SUDO_DENIED'):
self.environ.pop(name, None)
def executable(self, name, contents):
@@ -94,11 +95,43 @@ exec "$@"
self.assertFalse((self.root / '.env').exists())
def test_expired_sudo_after_build_has_actionable_error(self):
- result = self.install(MOCK_USER='1000', MOCK_EXPIRE_AFTER_BUILD='1', MOCK_SUDO_EXPIRED_FILE=str(self.root / 'sudo-expired'))
+ result = self.install(MOCK_USER='1000', LOOPFORGE_BUILD_FROM_SOURCE='1', MOCK_EXPIRE_AFTER_BUILD='1', MOCK_SUDO_EXPIRED_FILE=str(self.root / 'sudo-expired'))
self.assertNotEqual(result.returncode, 0)
self.assertIn('sudo -v', result.stderr)
self.assertNotIn('up -d --no-build', (self.root / 'docker.log').read_text())
+ def test_default_install_pulls_pinned_release(self):
+ self.assert_success(self.install())
+ log = (self.root / 'docker.log').read_text()
+ self.assertIn('pull --policy missing platform mysql', log)
+ self.assertNotIn('build platform', log)
+ self.assertIn("LOOPFORGE_IMAGE=''", (self.root / '.env').read_text())
+
+ def test_source_build_persists_dev_compose_file(self):
+ self.assert_success(self.install(LOOPFORGE_BUILD_FROM_SOURCE='1'))
+ self.assertIn('build platform', (self.root / 'docker.log').read_text())
+ config = (self.root / '.env').read_text()
+ self.assertEqual(config.count('COMPOSE_FILE='), 1)
+ self.assertIn('COMPOSE_FILE=compose.yaml:compose.dev.yaml', config)
+ (self.root / 'docker.log').unlink()
+ self.assert_success(self.install())
+ self.assertIn('build platform', (self.root / 'docker.log').read_text())
+
+ def test_start_switches_source_build_back_to_release(self):
+ self.assert_success(self.install(LOOPFORGE_BUILD_FROM_SOURCE='1'))
+ (self.root / 'docker.log').unlink()
+ result = subprocess.run(['bash', 'start.sh', 'release'], cwd=self.root, env=self.environ, text=True, capture_output=True, stdin=subprocess.DEVNULL, timeout=15)
+ self.assert_success(result)
+ self.assertNotIn('COMPOSE_FILE=', (self.root / '.env').read_text())
+ log = (self.root / 'docker.log').read_text()
+ self.assertIn('pull --policy missing platform mysql', log)
+ self.assertNotIn('build platform', log)
+
+ def test_start_refuses_local_build(self):
+ result = subprocess.run(['bash', 'start.sh', 'build'], cwd=self.root, env=self.environ, text=True, capture_output=True, stdin=subprocess.DEVNULL, timeout=15)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn('./start.sh dev', result.stderr)
+
def test_prebuilt_image_skips_build(self):
self.assert_success(self.install(LOOPFORGE_IMAGE='registry.example.test/loopforge:tested'))
log = (self.root / 'docker.log').read_text()
@@ -109,17 +142,17 @@ exec "$@"
def test_invalid_public_url_fails_before_build(self):
result = self.install(LOOPFORGE_PUBLIC_URL='javascript:alert(1)')
self.assertNotEqual(result.returncode, 0)
- self.assertNotIn('build platform', (self.root / 'docker.log').read_text())
+ self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
def test_invalid_public_port_fails_before_build(self):
result = self.install(LOOPFORGE_PUBLIC_URL='https://team.example.test:invalid')
self.assertNotEqual(result.returncode, 0)
- self.assertNotIn('build platform', (self.root / 'docker.log').read_text())
+ self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
def test_public_url_with_unsupported_subpath_fails_before_build(self):
result = self.install(LOOPFORGE_PUBLIC_URL='https://team.example.test/loopforge')
self.assertNotEqual(result.returncode, 0)
- self.assertNotIn('build platform', (self.root / 'docker.log').read_text())
+ self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
def test_configuration_quotes_paths_without_shell_execution(self):
data = str(self.root / 'spaces $(touch should-not-exist)')
@@ -175,14 +208,14 @@ exec "$@"
with self.subTest(url=url):
result = self.install(LOOPFORGE_PUBLIC_URL=url)
self.assertNotEqual(result.returncode, 0)
- self.assertNotIn('build platform', (self.root / 'docker.log').read_text())
+ 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('build platform', (self.root / 'docker.log').read_text())
+ self.assertNotIn('up -d', (self.root / 'docker.log').read_text())
class AddressTests(unittest.TestCase):
diff --git a/start.sh b/start.sh
new file mode 100755
index 00000000..f8d4e7c6
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+# Start LoopForge from the published GHCR image pinned in compose.yaml
+# (default), or build this checkout for development.
+#
+# Usage:
+# ./start.sh install/start in the background (same as -d)
+# ./start.sh -d install/start in the background
+# ./start.sh logs follow platform logs
+# ./start.sh stop stop containers, keep them and their data
+# ./start.sh down remove containers, keep data volumes
+# ./start.sh restart restart the platform container
+# ./start.sh pull refresh images and recreate changed containers
+# ./start.sh dev build this checkout (compose.dev.yaml) and start it
+# ./start.sh release switch a source-built installation back to GHCR
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+source scripts/docker-access.sh
+
+compose() {
+ [[ -f .env ]] || docker_access_fail 'Not installed yet. Run ./start.sh first.'
+ select_docker_access || docker_access_fail 'Docker is not running, or this user cannot access it.'
+ docker_access compose --profile platform "$@"
+}
+
+cmd="${1:--d}"
+shift || true
+case "$cmd" in
+ up|-d|detach) bash scripts/install.sh ;;
+ dev) LOOPFORGE_BUILD_FROM_SOURCE=1 bash scripts/install.sh ;;
+ release)
+ [[ -f .env ]] && python3 - <<'PY'
+import pathlib,re
+p=pathlib.Path('.env')
+p.write_text(re.sub(r'(?m)^COMPOSE_FILE=.*\n?','',p.read_text()))
+PY
+ COMPOSE_FILE=compose.yaml bash scripts/install.sh
+ ;;
+ pull)
+ compose pull --ignore-buildable --policy always
+ compose up -d --no-build --wait --wait-timeout 180
+ ;;
+ logs) compose logs -f "${@:-platform}" ;;
+ stop) compose stop ;;
+ down) compose down --remove-orphans ;;
+ restart) compose restart platform ;;
+ build)
+ echo 'The default start uses the published GHCR image (no local build).' >&2
+ echo 'For a source build: ./start.sh dev' >&2
+ exit 1
+ ;;
+ *)
+ echo "unknown: $cmd" >&2
+ echo 'usage: ./start.sh [-d|logs|stop|down|restart|pull|dev|release]' >&2
+ exit 1
+ ;;
+esac