Skip to content

Add mongo service to Docker Compose#26

Merged
ebouchut merged 5 commits into
devfrom
feat-add-mongo-service-to-docker-compose
May 28, 2026
Merged

Add mongo service to Docker Compose#26
ebouchut merged 5 commits into
devfrom
feat-add-mongo-service-to-docker-compose

Conversation

@ebouchut
Copy link
Copy Markdown
Owner

  • Add MongoDB service (mongo) to docker-compose
  • Add MongoDB environment variables
  • Rename existing db service to postgres
  • Add bridge network and named mongo_data volume to persist MongoDB data
  • Update docs with how to use Docker Compose to run the app, start/stop/remove Postgres and MongoDB

- Rename the `db` service to `postgres`.
- Add `mongo` service to docker-compose 
    - Add a bridge network and a named `mongo_data` volume to
Mongo data.
- Add Mongo-specific environment variables to `.env.example`:
Copilot AI review requested due to automatic review settings May 28, 2026 09:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the local Docker Compose development setup to include a MongoDB service alongside Postgres, and updates application/config/docs so the app can connect to MongoDB via environment variables.

Changes:

  • Add a mongo service (with healthcheck, init dir, and persistent volume) and rename the existing db service to postgres in docker-compose.yaml.
  • Introduce MongoDB environment variables in .env.example and wire MongoDB connection settings into Spring Boot config.
  • Expand README instructions for cloning, configuring .env, and managing Postgres/MongoDB via Docker Compose.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/main/resources/application.yaml Adds spring.data.mongodb.uri configuration using environment variables.
docker-compose.yaml Renames Postgres service and introduces a MongoDB service, network, and volume.
.env.example Adds MongoDB-related environment variables and updates comments/instructions.
README.md Replaces placeholder install section with Docker Compose usage and DB lifecycle commands.
docker/mongo/init/.gitkeep Adds init directory placeholder for MongoDB entrypoint scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/resources/application.yaml
Comment thread src/main/resources/application.yaml
Comment thread docker-compose.yaml Outdated
Comment thread docker-compose.yaml
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread .env.example Outdated
@ebouchut ebouchut self-assigned this May 28, 2026
@ebouchut ebouchut added documentation Improvements or additions to documentation enhancement New feature or request database dependencies infrastructure labels May 28, 2026
@ebouchut ebouchut added this to the End of coding phase milestone May 28, 2026
ebouchut added 3 commits May 28, 2026 12:50
- Update sections about how to run the app and start all the
services/container
- Add sections about how to start / stop / remove the Postgres database
- Make postgres and mongo use network net (learn-dev-net)
- Rename postgres volume to pg_data (was pgdata)
- Fix mongo mapping to always explicit use host:port form
- Ensure mongo init DB uses LEARNDEV_MONGO_DB_NAME (renamed variable)
@ebouchut ebouchut force-pushed the feat-add-mongo-service-to-docker-compose branch from 7e0f4ed to fe31c91 Compare May 28, 2026 14:28
Copilot AI review requested due to automatic review settings May 28, 2026 14:31
@ebouchut ebouchut merged commit 181ad26 into dev May 28, 2026
1 of 2 checks passed
@ebouchut ebouchut deleted the feat-add-mongo-service-to-docker-compose branch May 28, 2026 14:33
@ebouchut
Copy link
Copy Markdown
Owner Author

Closes #25

@ebouchut ebouchut linked an issue May 28, 2026 that may be closed by this pull request
17 tasks
@ebouchut ebouchut mentioned this pull request May 28, 2026
17 tasks
@ebouchut ebouchut review requested due to automatic review settings May 28, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database dependencies documentation Improvements or additions to documentation enhancement New feature or request infrastructure

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Run MongoDB with Docker Compose

2 participants