Skip to content

chore: infra, compose, makefile and env cleanup - #156

Open
Gautam7352 wants to merge 2 commits into
devfrom
pr/infra-compose-cleanup
Open

chore: infra, compose, makefile and env cleanup#156
Gautam7352 wants to merge 2 commits into
devfrom
pr/infra-compose-cleanup

Conversation

@Gautam7352

@Gautam7352 Gautam7352 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

What & Why

Housekeeping PR — no logic changes, no new features. Cleans up Docker Compose files, Makefile, environment config, and removes stale docs that were out of sync with the codebase.

The migration work introduced new conventions (hardcoded service hostnames in compose, new migrate/seed make targets, JWT_SECRET as a required env var). The infra files needed to reflect that before anything merges to dev.


How to check failure (what broke before this PR)

  • Running make dev would start the backend without JWT_SECRET set, causing silent auth failures at runtime
  • POSTGRES_HOST was an env var passed through compose — if it was missing or wrong in .env, the DB connection would fail with a confusing error instead of using the known container name
  • make dev-logs didn't follow logs (missing -f flag), so it would print once and exit
  • No make migrate or make seed targets existed — developers had to manually construct the go run commands
  • backend/.gitignore existed separately from the root .gitignore, causing confusion about what was actually ignored
  • Docs under docs/ were stale and contradicted the actual implementation

Changes

File What changed
compose.yml Hardcode POSTGRES_HOST=capuchin-db, add JWT_SECRET env var, remove depends_on (backend now handles retry itself)
compose-dev.yml Hardcode POSTGRES_HOST=capuchin-db, add JWT_SECRET env var, switch to named capuchin-dev-data volume to isolate dev data from prod backup
Makefile Add migrate, migrate-down, seed targets; add help target; fix dev-logs to use -f; add inline comments
.env.example Remove POSTGRES_HOST (now hardcoded in compose); add VITE_API_URL
.gitignore Add test.sh, .kiro/
backend/Dockerfile Build stage cleanup
backend/.dockerignore Minor cleanup
backend/.gitignore Deleted — unified into root .gitignore
backend/air.toml Remove deprecated build.bin warning
docs/backend_api.md Deleted — stale
docs/backend_architecture.md Deleted — stale
docs/backend_best_practices.md Deleted — stale
docs/backend_schema.md Deleted — stale
docs/readme.md Deleted — stale
readme.md Updated to reflect current project structure

How to verify

# 1. Dev stack starts cleanly
make dev

# 2. Logs follow (should not exit immediately)
make dev-logs

# 3. Backend is reachable
curl http://localhost:8080/health

# 7. Confirm dev data is isolated (capuchin-dev-data volume, not ./backup)
docker volume ls | grep capuchin-dev-data

- compose.yml: hardcode POSTGRES_HOST=capuchin-db, remove depends_on, add JWT_SECRET env
- compose-dev.yml: use named dev volume, hardcode POSTGRES_HOST, add JWT_SECRET env
- Makefile: add migrate/migrate-down/seed targets, help target, fix dev-logs to follow
- .env.example: remove POSTGRES_HOST (now hardcoded in compose), add VITE_API_URL
- .gitignore: add test.sh, .kiro
- backend/Dockerfile: build updates
- backend/.dockerignore: cleanup
- backend/.gitignore: removed (unified into root .gitignore)
- backend/air.toml: remove build.bin deprecation warning
- docs/: remove stale doc files
Comment thread .env.example
POSTGRES_HOST=capuchin-db
POSTGRES_PORT=5432
# Only needed when running the backend outside Docker (e.g. `go run` or `air` directly).
# In compose, the host is hardcoded to the postgres container name (capuchin-db).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not hardcoded, compose is using the network name which is capuchin-db else you won't be able to connect

Comment thread .env.example
@@ -1 +1 @@
VITE_API_URL=http://localhost:8080

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep react related env in frontend folder only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread .gitignore


# removing for now
.github/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github contains workflow folder, which are our github action files. Why are we ignoring them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's intentional, I don't want ci pipeline to be triggered yet, once migration implementation is merged then this can be removed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create the PR then, or use a feature called 'Draft PR'

Comment thread Makefile
cd backend && air

.PHONY: dev dev-logs dev-down prod logs down
# ── Database ──────────────────────────────────────────────────────────────────

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants