You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add MongoDB to the local development environment as a containerized service named learn-dev-mongo in docker-compose.yaml, so the application can persist document-oriented data alongside PostgreSQL.
Rationale
The platform already uses PostgreSQL for relational data (users, roles, audit logs). MongoDB is being introduced to store document-oriented data such as course content (lessons, exercises, rich markdown blocks), submissions, or activity logs, where a flexible schema better fits the use case than a relational model.
This work also contributes to DWWM Competence 1: Installer et configurer son environnement de travail, specifically the criterion "Les conteneurs implémentent les services requis pour l'environnement de développement".
Scope
Add a learn-dev-mongo service to docker-compose.yaml.
Pin an explicit MongoDB image version.
Persist data in a named Docker volume.
Wire credentials through environment variables loaded from .env.
Add a healthcheck.
Update README.md with usage instructions.
Target Architecture
flowchart LR
App[Spring Boot App] -->|JDBC| PG[(learn-dev-postgres)]
App -->|Mongo Driver| MG[(learn-dev-mongo)]
PG --- VP[(postgres_data volume)]
MG --- VM[(mongo data volume)]
Loading
Service Specification
The new service must satisfy the following:
Service name: learn-dev-mongo
Container name: learn-dev-mongo
Image: mongo:8.0 (latest stable major; pin to the minor version, not latest)
MongoDB 8.x ships official linux/arm64 images, so the service runs natively on the MacBook Pro M1. No platform: override is required. If a regression appears, fall back to platform: linux/amd64 as a temporary workaround and document the reason.
Tasks
Update docker-compose.yaml with the learn-dev-mongo service, mongo_data volume, and learn-dev-net network.
Create docker/mongo/init/ directory with a placeholder .gitkeep.
Add MongoDB variables to .env.example.
Verify that .env is in .gitignore.
Add a README.md section "Running MongoDB locally" covering start, stop, logs, shell access, and reset.
Add a make target or shell alias (optional) such as mongo-shell for docker exec -it learn-dev-mongo mongosh.
Validate that docker compose up -d learn-dev-mongo brings the service to a healthy state.
Connect from the host with mongosh to confirm credentials work.
Acceptance Criteria
The issue is considered done when all of the following are true:
Running docker compose up -d learn-dev-mongo from a clean checkout starts the service successfully.
docker compose ps reports the service as healthy within 30 seconds.
A mongosh session from the host authenticates using the credentials in .env.
Stopping and restarting the container preserves data via the mongo_data volume.
No credentials are committed to the repository.
README.md documents the start, stop, and reset procedures.
Security Considerations
Authentication is enabled by default through MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD.
Secrets are loaded from .env and must remain git-ignored.
The repository only ships .env.example.
Add a follow-up issue to track integration with 1Password CLI for local secret management.
Definition of Done
Code merged to dev via a pull request that:
Includes an updated README.md and .env.example.
Links back to this issue with Closes #<issue-number>.
Update Dossier ProfessionnelCompétence 1: Installer et configurer son environnement de travail en fonction du projet web ou web mobile
Goal
Add MongoDB to the local development environment as a containerized service named
learn-dev-mongoindocker-compose.yaml, so the application can persist document-oriented data alongside PostgreSQL.Rationale
The platform already uses PostgreSQL for relational data (users, roles, audit logs). MongoDB is being introduced to store document-oriented data such as course content (lessons, exercises, rich markdown blocks), submissions, or activity logs, where a flexible schema better fits the use case than a relational model.
This work also contributes to DWWM Competence 1: Installer et configurer son environnement de travail, specifically the criterion "Les conteneurs implémentent les services requis pour l'environnement de développement".
Scope
learn-dev-mongoservice todocker-compose.yaml..env.README.mdwith usage instructions.Target Architecture
flowchart LR App[Spring Boot App] -->|JDBC| PG[(learn-dev-postgres)] App -->|Mongo Driver| MG[(learn-dev-mongo)] PG --- VP[(postgres_data volume)] MG --- VM[(mongo data volume)]Service Specification
The new service must satisfy the following:
learn-dev-mongolearn-dev-mongomongo:8.0(latest stable major; pin to the minor version, notlatest)unless-stopped27017mapped to container27017mongo_datamounted at/data/db./docker/mongo/init:/docker-entrypoint-initdb.d:rolearn-dev-netnetwork with the rest of the stack.env(never hard-coded)mongoshpingAdd a service to
docker-compose.yamlEnvironment Variables
Add the following entries to
.env.example(committed) and.env(git-ignored):Apple Silicon Note
MongoDB 8.x ships official
linux/arm64images, so the service runs natively on the MacBook Pro M1. Noplatform:override is required. If a regression appears, fall back toplatform: linux/amd64as a temporary workaround and document the reason.Tasks
docker-compose.yamlwith thelearn-dev-mongoservice,mongo_datavolume, andlearn-dev-netnetwork.docker/mongo/init/directory with a placeholder.gitkeep..env.example..envis in.gitignore.README.mdsection "Running MongoDB locally" covering start, stop, logs, shell access, and reset.maketarget or shell alias (optional) such asmongo-shellfordocker exec -it learn-dev-mongo mongosh.docker compose up -d learn-dev-mongobrings the service to ahealthystate.mongoshto confirm credentials work.Acceptance Criteria
The issue is considered done when all of the following are true:
docker compose up -d learn-dev-mongofrom a clean checkout starts the service successfully.docker compose psreports the service ashealthywithin 30 seconds.mongoshsession from the host authenticates using the credentials in.env.mongo_datavolume.README.mddocuments the start, stop, and reset procedures.Security Considerations
MONGO_INITDB_ROOT_USERNAMEandMONGO_INITDB_ROOT_PASSWORD..envand must remain git-ignored.The repository only ships
.env.example.Definition of Done
Code merged to
devvia a pull request that:README.mdand.env.example.Closes #<issue-number>.Compétence 1:Installer et configurer son environnement de travail en fonction du projet web ou web mobileResources
References
Thanks to my 🤖-C-budy for the write-up and the advices.