build(coolify): rename compose file

This commit is contained in:
2026-06-29 00:00:22 +07:00
parent 66004685c6
commit 35be2c0acb
7 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ RUN go mod download
COPY . .
# The deploy-notify commit SHA comes from the SOURCE_COMMIT runtime env that
# Coolify injects into the container (see docker-compose.yml), not from a build
# Coolify injects into the container (see compose.yml), not from a build
# arg — Coolify does not pass build args here. The binary is built plain.
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w" \
+1 -1
View File
@@ -30,7 +30,7 @@ internal/cron/ in-process cron scheduler (replaces EventBridge)
internal/modules/ Module framework, registry, dispatchers, modules
internal/storage/ typed DocStore[T] (Provider + Typed); mongodb runtime + memory (tests). Values persist as flattened native BSON root documents
internal/ai/ Gemini client (used by twentyq)
docker-compose.yml Coolify self-host stack (single bot service)
compose.yml Coolify self-host stack (single bot service)
docs/deploy-coolify-selfhosted.md Self-host onboarding + cutover runbook
docs/aws-decommission-runbook.md AWS teardown (post-cutover)
template.yaml, aws/ Retired AWS SAM IaC + setup (kept for history)
View File
+2 -2
View File
@@ -78,7 +78,7 @@ SSM/AWS lookup that fails with no AWS creds and bricks startup), `KV_PROVIDER`,
## 2. Coolify
1. New resource → from this Git repo (Docker Compose), or a prebuilt image.
The committed [`docker-compose.yml`](../docker-compose.yml) defines the single
The committed [`compose.yml`](../compose.yml) defines the single
`bot` service.
2. Set the env vars above in Coolify.
3. **No public domain / port** is needed — polling is outbound-only. Do not
@@ -91,7 +91,7 @@ SSM/AWS lookup that fails with no AWS creds and bricks startup), `KV_PROVIDER`,
5. **deploynotify commit SHA:** `SOURCE_COMMIT` is a Coolify predefined
variable. For Docker Compose, Coolify passes predefined vars via `--env-file`
for interpolation only, so the value reaches the container **only because
`docker-compose.yml` references it** (`SOURCE_COMMIT: ${SOURCE_COMMIT:-}`).
`compose.yml` references it** (`SOURCE_COMMIT: ${SOURCE_COMMIT:-}`).
The bot reads it at startup and DMs the owner on every boot; outside Coolify
(local `docker compose up`) it is unset and the DM shows `unknown`. The
"Include Source Commit in Build" Coolify setting affects build args only and
+1 -1
View File
@@ -105,7 +105,7 @@ func Build(enabled []string, factories map[string]Factory, provider storage.Prov
}
// Empty/unset MODULES means "load every registered module" — the documented
// contract (.env.example, docker-compose.yml, deploy docs). Expand to the
// contract (.env.example, compose.yml, deploy docs). Expand to the
// full catalog in sorted order so the load order (and thus CommandHook
// registration order) is deterministic across restarts.
if len(enabled) == 0 {
@@ -38,7 +38,7 @@ Long polling is the key self-host simplification: the bot opens an OUTBOUND conn
### Container + Coolify
The existing `Dockerfile` (golang:1.25-alpine builder → distroless static nonroot, `ENTRYPOINT ["/server"]`, `EXPOSE 8080`) builds with `-ldflags="-s -w"` only — it does **not** inject `gitSHA`. Only the Makefile injects it (`Makefile:13`). `deploynotify` runs unconditionally at startup (`main.go:148`) and stays silent when `gitSHA` is empty (`main.go:40-41`), so as-is the "new version" owner DM is **silently dead on self-host** — a behavior regression from Lambda. Required (not optional): add `ARG GIT_SHA` + `-ldflags "-s -w -X main.gitSHA=$GIT_SHA"` to the Dockerfile and pass `--build-arg GIT_SHA=$(git rev-parse --short HEAD)` (Coolify exposes the commit SHA as a build var). If deploynotify parity is explicitly unwanted, instead document in acceptance criteria that the feature is disabled on self-host — do not leave it as undocumented breakage.
`docker-compose.yml` (committed; Coolify consumes it):
`compose.yml` (committed; Coolify consumes it):
```yaml
services:
bot:
@@ -77,7 +77,7 @@ Secrets: because `*_PARAMETER_NAME` env vars are NOT set, `cmd/server` reads `TE
- Delete: `internal/telegram/webhook.go` + `internal/telegram/webhook_test.go`.
- Modify: `internal/server/router.go` — remove the `/webhook` route; keep `/` health (and `/cron`, unused/unexposed).
- Modify: `internal/telegram/client.go` — update the "configured for webhook mode" doc to polling; keep `WithSkipGetMe`, re-evaluate `WithNotAsyncHandlers`.
- Create: `docker-compose.yml` — bot service as above.
- Create: `compose.yml` — bot service as above.
- Create: `.env.example` — every env var with placeholder values + comments; real `.env` gitignored.
- Modify: `.gitignore` — ensure `.env` ignored (verify; add if missing).
- Modify (optional): `Dockerfile``ARG GIT_SHA` + `-ldflags "-X main.gitSHA=$GIT_SHA"` for deploynotify parity.
@@ -90,7 +90,7 @@ Secrets: because `*_PARAMETER_NAME` env vars are NOT set, `cmd/server` reads `TE
## Implementation Steps
1. Write `docker-compose.yml` + `.env.example`; verify `.env` gitignored.
1. Write `compose.yml` + `.env.example`; verify `.env` gitignored.
2. Decide healthcheck approach (Coolify HTTP monitor preferred); implement `-healthcheck` flag only if needed.
1b. Switch `cmd/server/main.go` to `b.Start(rootCtx)`; delete the webhook handler, `/webhook` route, and `WebhookSecret` config + fatal.
3. Local validation: `MONGO_URL=… MONGO_DATABASE=… docker compose up --build`; confirm boot logs show `storage backend backend=mongodb database=…` (NO connection string), `internal cron scheduler started`, and the polling loop started (getUpdates); `curl localhost:8080/` returns `miti99bot ok`. (Requires the bot's webhook to be unset — see Phase 4 / `deleteWebhook`, else getUpdates 409s.)
@@ -4,7 +4,7 @@ Reviewer: code-reviewer | Date: 2026-06-28 | Branch: `feature/selfhosted`
Plan: `plans/260627-1849-selfhost-coolify-mongodb/`
## Scope
- New: `internal/storage/mongodb_{client,kv,provider}.go` (+tests), `internal/cron/scheduler.go` (+test), `cmd/migrate-dynamo-to-mongo/` (+test), `docker-compose.yml`, `.env.example`, 2 docs.
- New: `internal/storage/mongodb_{client,kv,provider}.go` (+tests), `internal/cron/scheduler.go` (+test), `cmd/migrate-dynamo-to-mongo/` (+test), `compose.yml`, `.env.example`, 2 docs.
- Modified: `cmd/server/main.go`, `internal/server/router.go`, `internal/telegram/client.go`, `internal/modules/lolschedule/cron.go`, `internal/modules/module.go`, `internal/modules/stock/{stock,handlers}.go`, `Dockerfile`, `Makefile`, `go.mod/go.sum`, `aws/telegram-commands.json`.
- Deleted: `internal/telegram/webhook.go`(+test), `internal/modules/stock/income_events.go`(+test).
- Build/vet: `go vet ./...` clean (re-run). Author reports full `go test ./...` + integration suites pass.