Skip to content

Commit fa1e6ef

Browse files
authored
Merge pull request #241 from DefangLabs/lio/mongo
MongoDB docs
2 parents 4125c61 + cbb60cc commit fa1e6ef

File tree

5 files changed

+66
-12
lines changed

5 files changed

+66
-12
lines changed

docs/concepts/compose.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ Here are a list of service-level properties of the [Compose specification](https
8585
Service-level means inside your `service`. A service-level property called `build` would look like:
8686
```yaml
8787
service:
88-
build: ...
88+
build:
8989
```
9090

9191
Note that in your Compose file, you will need a top-level property called `services` to contain all of your services. For example:
9292
```yaml
9393
services:
9494
service:
95-
build: ...
95+
build:
9696
```
9797
:::
9898

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Managed MongoDB
3+
description: Defang can help you provision managed MongoDB instances.
4+
sidebar_position: 3000
5+
---
6+
7+
# Managed MongoDB
8+
9+
:::info
10+
This feature was introduced in Defang v1.2.0 released on June 3, 2025. [Upgrade to the latest version](https://docs.defang.io/docs/cli/defang_upgrade)
11+
:::
12+
13+
Managed MongoDB is a service that allows you to store and retrieve large amounts of data in a document-oriented format. MongoDB is ideal for storing unstructured data like JSON documents, making it a popular choice for modern applications.
14+
15+
## Current Support
16+
17+
| Provider | Managed MongoDB |
18+
| --- | --- |
19+
| [Playground](/docs/providers/playground#managed-services) | ⚠️ Unmanaged |
20+
| [AWS](/docs/providers/aws#managed-storage) | ✅ DocumentDB |
21+
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) | ⚠️ Unmanaged |
22+
| [GCP](/docs/providers/gcp#future-improvements) | ⚠️ Unmanaged |
23+
24+
## How to use Managed MongoDB
25+
26+
To use managed MongoDB, in your `compose.yaml` file, use the `x-defang-mongodb` extension to define your MongoDB service. Adding the extension will tell Defang to provision a managed instance, rather than running MongoDB as a container.
27+
28+
### Required Configuration
29+
30+
When using managed MongoDB, you **must** set a username and password for the database. By default, these are read from the `MONGO_INITDB_ROOT_USERNAME` and `MONGO_INITDB_ROOT_PASSWORD` config variables, conform [the official MongoDB container image](https://hub.docker.com/_/mongo). These can be set using the `defang config set MONGO_INITDB_ROOT_USERNAME` and `defang config set MONGO_INITDB_ROOT_PASSWORD` commands. If you do not provide these values, the deployment will fail.
31+
32+
### Example
33+
34+
```yaml
35+
services:
36+
app:
37+
# [...]
38+
environment:
39+
MONGO_URI: mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@db:27017/
40+
depends_on:
41+
- db
42+
43+
db:
44+
image: mongo:5
45+
x-defang-mongodb: true
46+
```
47+
48+
:::warning[Version]
49+
AWS DocumentDB is compatible with MongoDB 3.6, 4.0, and 5.0. The `mongo:5` image is compatible with DocumentDB 5.0, so we recommend using this version for your MongoDB service. Deployment will fail for versions higher than 5.
50+
:::

docs/concepts/managed-storage/managed-postgres.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Postgres, or PostgreSQL, is a powerful open-source relational database system kn
1212

1313
| Provider | Managed Postgres |
1414
| --- | --- |
15-
| [Playground](/docs/providers/playground#managed-services) | |
16-
| [AWS](/docs/providers/aws#managed-storage) ||
17-
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) | |
18-
| [GCP](/docs/providers/gcp#managed-storage) ||
15+
| [Playground](/docs/providers/playground#managed-services) | ⚠️ Unmanaged |
16+
| [AWS](/docs/providers/aws#managed-storage) |RDS Postgres |
17+
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) | ⚠️ Unmanaged |
18+
| [GCP](/docs/providers/gcp#managed-storage) |Cloud SQL Postgres |
1919

2020
## How to use Managed Postgres
2121

@@ -84,7 +84,7 @@ When a project is deployed to a [production environment](/docs/concepts/deployme
8484

8585
The AWS Console can be used to restore a snapshot into a new instance of Postgres. This feature is not yet supported in GCP.
8686

87-
{/*
87+
{/*
8888
### Major Version Updating of Engine
8989
9090
To update the database engine you can update the image to a later version in your Compose file and apply it via ```defang compose up --provider=aws```. In the example below, we change from Postgres 15 to 16.
@@ -101,5 +101,5 @@ to
101101
```
102102
database:
103103
image: postgres:16
104-
```
104+
```
105105
*/}

docs/concepts/managed-storage/managed-redis.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Redis is an in-memory data structure store widely used for caching, real-time an
1212

1313
| Provider | Managed Redis |
1414
| --- | --- |
15-
| [Playground](/docs/providers/playground#managed-services) | |
16-
| [AWS](/docs/providers/aws#managed-storage) ||
17-
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) | |
18-
| [GCP](/docs/providers/gcp#managed-services) ||
15+
| [Playground](/docs/providers/playground#managed-services) | ⚠️ Unmanaged |
16+
| [AWS](/docs/providers/aws#managed-storage) |Elasticache |
17+
| [DigitalOcean](/docs/providers/digitalocean#future-improvements) | ⚠️ Unmanaged |
18+
| [GCP](/docs/providers/gcp#managed-services) |Memorystore |
1919

2020
## How to use Managed Redis
2121

docs/providers/aws/aws.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ Defang offers integration with managed, cloud-native large language model servic
7878

7979
When using [Managed LLMs](/docs/concepts/managed-llms/managed-language-models.md), the Defang CLI provisions an ElastiCache Redis cluster in your account.
8080

81+
### Managed MongoDB
82+
83+
Defang will provision a DocumentDB instance for services that use the `x-defang-mongodb` service extension. This allows you to use MongoDB as a managed service, rather than running it as a container.
84+
8185
### Managed Resources
8286

8387
Defang will create and manage the following resources in your AWS account from its bootstrap CloudFormation template:

0 commit comments

Comments
 (0)