Skip to content

Add Docker Compose for local MongoDB development#16

Open
GouravRusiya30 wants to merge 1 commit into
masterfrom
codex/start-implementation-of-first-issue
Open

Add Docker Compose for local MongoDB development#16
GouravRusiya30 wants to merge 1 commit into
masterfrom
codex/start-implementation-of-first-issue

Conversation

@GouravRusiya30

Copy link
Copy Markdown
Owner

Motivation

  • Provide an easy, reproducible local MongoDB for contributors to run the API without manual MongoDB installation.
  • Make the default local MONGODB_URI work out-of-the-box with a documented Docker Compose setup.

Description

  • Add docker-compose.yml that runs mongo:7, maps 27017:27017, persists data to a named mongodb_data volume, and includes a mongosh ping healthcheck.
  • Update README.md to recommend Docker/Docker Compose for local development and show docker compose up -d mongodb to start MongoDB.
  • Add instructions to the README.md for running the application locally with ./gradlew bootRun and for stopping/removing the Compose resources with docker compose down and docker compose down -v, and note the default MONGODB_URI=mongodb://localhost:27017/rest_tutorial works with the Compose service.

Testing

  • Attempted to run the project test suite with ./gradlew test, but it was blocked because the environment could not download the Gradle distribution from services.gradle.org (network unreachable).
  • Attempted to validate the Compose file with docker compose config, but it was blocked because the Docker CLI is not installed in the execution environment.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e43bf84e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docker-compose.yml
container_name: springboot-restapi-mongodb
restart: unless-stopped
ports:
- "27017:27017"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind MongoDB to localhost only

For local development on a host where Docker-published ports are reachable from other machines, this exposes the unauthenticated MongoDB instance beyond the developer's machine. The README describes the service as being on localhost:27017, but Docker's port-publishing docs say mappings without a host address publish to all host addresses (0.0.0.0 and [::]); use 127.0.0.1:27017:27017 to keep this dev database local.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant