Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.mongo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
services:
mongo:
container_name: ddev-${DDEV_SITENAME}-mongo
image: ${MONGO_DOCKER_IMAGE:-mongo:5-focal}
image: ${MONGO_DOCKER_IMAGE:-mongo:latest}
volumes:
- type: "volume"
source: mongo
Expand Down
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: mongo
project_files:
- commands/mongo/mongosh
- commands/host/mongo-express
- web-build/Dockerfile.mongo
- config.mongo.yaml
- docker-compose.mongo.yaml
- docker-compose.mongo_norouter.yaml
Expand Down
8 changes: 8 additions & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ health_checks() {
assert_success
assert_output --partial '"ok":1'

# Check mongo CLI utils availability in the "web" container
run ddev exec "mongosh 'mongodb://db:db@mongo:27017/test?authSource=admin' --quiet --eval 'JSON.stringify(db.getUsers())'"
assert_success
assert_output --partial '"ok":1'
run ddev exec 'mongodump --version'
assert_success
assert_output --partial 'mongodump version:'

# Start mongo-express profile
DDEV_DEBUG=true run ddev mongo-express
assert_success
Expand Down
12 changes: 12 additions & 0 deletions web-build/Dockerfile.mongo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RUN \
LATEST_FULL_VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/mongo/tags/?page_size=100" | jq -r '.results[] | select(.name | test("^[0-9]+\\.[0-9]+$")) | .name' | sort -V | tail -1 || echo "7.0") && \
# Extract major version for GPG key (e.g., "7.2" -> "7.0")
MAJOR_VERSION=$(echo "$LATEST_FULL_VERSION" | cut -d. -f1) && \
GPG_VERSION="${MAJOR_VERSION}.0" && \
echo "Latest MongoDB version: $LATEST_FULL_VERSION, using GPG key for: $GPG_VERSION" && \
# Add MongoDB GPG key using major version
wget -qO - https://www.mongodb.org/static/pgp/server-${GPG_VERSION}.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-${GPG_VERSION}.gpg && \
# Add repository using the full version
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-${GPG_VERSION}.gpg ] http://repo.mongodb.org/apt/debian $(lsb_release -cs)/mongodb-org/${LATEST_FULL_VERSION} main" > /etc/apt/sources.list.d/mongodb-org-${LATEST_FULL_VERSION}.list && \
apt-get update && \
apt-get install -y mongodb-mongosh mongodb-database-tools
Loading