Skip to content

feat(infra): add docker-compose support and configure testcontainers#23

Open
nakberli841-bot wants to merge 10 commits into
mainfrom
feature/4-docker-compose-setup
Open

feat(infra): add docker-compose support and configure testcontainers#23
nakberli841-bot wants to merge 10 commits into
mainfrom
feature/4-docker-compose-setup

Conversation

@nakberli841-bot

Copy link
Copy Markdown
Contributor

What does this change?

This PR sets up the Docker development environment and integrates Testcontainers to ensure robust integration testing.

  • Docker Compose: Added docker-compose.yml for Postgres and Redis.
  • Backend Configuration: Configured API and Worker modules to use these services.
  • Integration Testing: Implemented AbstractIntegrationTest with @ServiceConnection for automated container management.
  • Documentation: Added setup instructions to README.md.

Related issue

Closes #4

Area

  • Frontend (apps/web)
  • Backend
  • Docs
  • Other

Screenshots

N/A

Checklist

  • I ran bun run typecheck && bun run build in apps/web (for frontend changes)
  • I bumped the version if this is a meaningful change
  • Commits are small and focused, with no AI attribution lines
  • I updated docs or AGENTS.md if behavior or structure changed

- Add Postgres and Redis configurations to the application.yml files in the api and worker modules.
- Remove autoconfigure excludes from the application.yml files.
…and worker

- Add spring-boot-testcontainers and testcontainers dependencies to both modules
- Implement AbstractIntegrationTest base class for automatic Postgres and Redis setup
- Update existing tests to extend AbstractIntegrationTest for isolated test environments
- Ensure Flyway and datasource connectivity via @Serviceconnection in integration tests

@martian56 martian56 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I verified this end to end on my machine: docker compose up brings postgres:16 and redis:7 online, docker compose ps shows both running, and the api and worker jars built from this branch boot against the stack and report UP on their health endpoints. All four checkboxes on #4 hold up, and @Serviceconnection is the right modern way to hook Testcontainers into the tests. Good PR.

Cleanup before merge:

  • There is a junk empty file at backend/docker, looks like a shell redirect accident. Remove it, and add a git status skim to your pre-push routine. This is the second PR in a row to ship one of these, and I will be grumpier about the third.
  • Coordinate with Arzu: this PR and #21 both rewrite the api application.yml and the api test setup. The plan from my #21 review is that her PR drops its api changes and this one owns the api and worker wiring, so expect a small rebase depending on which lands first. Talk to each other.
  • The rest is inline: a version pin that should not exist, health indicator flags that are now wrong, a volume the database needs, and a README paragraph that oversells what compose runs.

One for the future rather than this PR: AbstractIntegrationTest is duplicated identically in api and worker. Fine for two apps, but if a third consumer appears we hoist it into a shared test fixture instead of copying again.

Comment thread backend/apps/api/build.gradle.kts Outdated
Comment thread backend/apps/api/src/main/resources/application.yml Outdated
Comment thread backend/apps/worker/src/main/resources/application.yml Outdated
Comment thread backend/compose.yaml Outdated
Comment thread backend/compose.yaml Outdated
Comment thread backend/README.md Outdated
@nakberli841-bot nakberli841-bot marked this pull request as draft June 13, 2026 10:18
@nakberli841-bot nakberli841-bot marked this pull request as ready for review June 13, 2026 10:19
@nakberli841-bot nakberli841-bot marked this pull request as draft June 13, 2026 10:19
- Add named volume for database persistence to prevent data loss.
- Add pg_isready healthcheck for service readiness.
- Sync postgres image tag to 16-alpine for consistency with integration tests.
…connectivity

- Setup .env and .env.example for centralized config
- Updated .gitignore to exclude sensitive .env file
- Refactored docker-compose and application.yml files to use environment
  variables for DB and Redis connections
@nakberli841-bot nakberli841-bot marked this pull request as ready for review June 13, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Backend service or library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local dev stack with Docker Compose

2 participants