Skip to content

(bug) Self-hosting quick-start: documented sparse-checkout omits the DB-init SQL, so a fresh OSS deploy never creates its databases #4726

@mmabrouk

Description

@mmabrouk

When I follow the self-hosting Quick Start exactly, a brand-new OSS deploy comes up with no application databases, so migrations and the API fail. The documented clone never puts the Postgres init script on disk.

Reproduce

Run the quick-start verbatim (docs/docs/self-host/01-quick-start.mdx):

git clone --depth 1 --filter=blob:none --sparse https://github.com/Agenta-AI/agenta
cd agenta
git sparse-checkout set hosting/docker-compose
cp hosting/docker-compose/oss/env.oss.gh.example hosting/docker-compose/oss/.env.oss.gh
docker compose -f hosting/docker-compose/oss/docker-compose.gh.yml \
  --env-file hosting/docker-compose/oss/.env.oss.gh \
  --profile with-web --profile with-traefik up -d

What happens

docker-compose.gh.yml bind-mounts the DB bootstrap script that creates agenta_oss_core, agenta_oss_tracing, and agenta_oss_supertokens:

- ../../../api/oss/databases/postgres/init-db-oss.sql:/docker-entrypoint-initdb.d/init-db.sql

That source path lives in api/…, which is outside the hosting/docker-compose sparse-checkout cone, so it is never checked out. Docker then auto-creates an empty directory at that path and mounts it where the .sql file should be. The init script never runs, the agenta_oss_* databases are never created, and alembic / api fail to connect.

Verified by running the literal clone: after git sparse-checkout set hosting/docker-compose, api/oss/databases/postgres/init-db-oss.sql is absent, and docker compose config resolves the bind source to a non-existent path.

Scope

  • Reproduces on main and on release/v0.104.0 (v0.104.0). The release does not introduce it; it also does not fix it.
  • The EE self-host compose has the identical pattern (../../../api/ee/databases/postgres/init-db-ee.sql), so the EE path has the same gap.
  • A full-repo checkout (what production/CI uses) is unaffected, which is why this only bites doc-following self-hosters.

Decision needed (@jp-agenta — your call on approach)

Two ways to fix; pick one:

  • A. Docs-only (one line). Extend the sparse-checkout to include the init dir:
    git sparse-checkout set hosting/docker-compose api/oss/databases/postgres.
    Simple, but leaks an api/… path into a "grab the compose" step and (in cone mode) also pulls the migrations/ subtree, bloating the light clone. Breaks again if the init file moves.

  • B. Repo change, docs command unchanged (preferred). Move init-db-oss.sql into hosting/docker-compose/oss/ and switch the four OSS compose mounts to ./init-db-oss.sql; mirror for EE (hosting/docker-compose/ee/). The compose dir becomes self-contained, so the documented git sparse-checkout set hosting/docker-compose works verbatim for both editions. The only references to the file are the compose files and a design note (the Helm chart embeds its own copy), so it is safe to move.

Found while deploying PR #4717 (v0.104.0) from scratch for testing.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions