refactor: deploy.sh goes, each task runs through its own tool, and the Mongo backup is a compose service
Summary
deploy.sh was 410 lines and 10 commands, and eight of them only wrapped a compose, uv or npm call that those tools run with their own flags. Two names for every task, plus a production-only piece: the nightly Mongo backup ran from a host cron that no local stack ever ran.
Changes
deploy.sh goes. The stack runs with docker compose and its profiles, pre-commit run --all-files runs the lint and type checks (bandit added with CI's command), and the spec export moves to backend/scripts/export_openapi.py. CI picks the test config with BACKEND_CONFIG=config.test.toml in .env instead of copying it over config.toml.
The backup is now the mongo-backup service on the mongo image: mongodump into the mongo_backups volume at start and every 24 hours, 14 days kept, the same locally and in production. The old 5G free-space check goes with the script. I tried nfrastack/db-backup 5.0.5 first, but its own restore can't parse its MongoDB dumps.
[!WARNING]
After the release, production's /etc/cron.d/integr8scode-backup still calls deploy.sh and has to be removed.
Type of Change
- Bug fix (non-breaking change that fixes an issue)
- New feature (non-breaking change that adds functionality)
- Breaking change (fix or feature that would cause existing functionality to change)
- Documentation update
- Refactoring (no functional changes)
- CI/CD or tooling changes
Test Plan
- Backend unit tests pass (
cd backend && uv run pytest tests/unit) - Frontend unit tests pass (
cd frontend && npm run test) - Backend E2E tests pass (
docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e') - Frontend E2E tests pass (
cd frontend && npm run test:e2e) - API spec and client regenerated if routes or schemas changed (
uv run python -m scripts.export_openapiin backend/, thennpm run generate:apiin frontend/), never edited by hand - Manual testing performed
Validation: the export writes the committed spec byte for byte. Locally a document with a 64-bit integer, a date and a unique index survived dump, drop and restore; mongo-backup idles at 16 MiB. mkdocs build --strict, actionlint, the backend pre-commit hooks and docker compose config with BACKEND_CONFIG pass.
Checklist
- My code follows the project's style guidelines
- I have run
pre-commit run --all-filesand all checks pass - I have added tests that prove my fix/feature works
- I have updated documentation if needed
- My changes don't introduce new warnings
Summary by cubic
Removes deploy.sh (410 lines, 10 commands), whose subcommands each only wrapped a compose, uv, or npm call, and runs every task through the tool that owns it: docker compose with its profiles for the stack, pre-commit run --all-files for the lint and type checks (bandit added to match CI), and backend/scripts/export_openapi.py for the API spec export. The nightly Mongo backup, previously a production-only host cron, becomes the mongo-backup compose service: it dumps from the mongo image into the mongo_backups volume at startup and every 24 hours, keeps 14 days, and runs the same locally and in production. CI selects the test config via BACKEND_CONFIG=config.test.toml in .env instead of copying it over config.toml.
Migration
- Production's
/etc/cron.d/integr8scode-backupstill callsdeploy.shand must be removed after the release. - The old backup script's 5 GB free-space check is gone.