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
Copy file name to clipboardExpand all lines: docs/concepts/managed-storage/managed-mongodb.md
+26-4Lines changed: 26 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ sidebar_position: 3000
7
7
# Managed MongoDB
8
8
9
9
:::info
10
-
This feature was introduced in Defang v1.2.0 released on June 3, 2025. [Upgrade to the latest version](/docs/cli/defang_upgrade)
10
+
This feature was introduced in Defang v1.2.0 released on June 3, 2025 for AWS. [Upgrade to the latest version](/docs/cli/defang_upgrade)
11
11
:::
12
12
13
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.
@@ -19,17 +19,39 @@ Managed MongoDB is a service that allows you to store and retrieve large amounts
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
27
28
28
### Required Configuration
29
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.
30
+
### AWS
31
+
When using managed MongoDB on AWS, 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, following [the official MongoDB container image](https://hub.docker.com/_/mongo) convention.
31
32
32
-
### Example
33
+
You can set these using the following commands:
34
+
35
+
```bash
36
+
defang config set MONGO_INITDB_ROOT_USERNAME <your-username>
37
+
defang config set MONGO_INITDB_ROOT_PASSWORD <your-password>
38
+
```
39
+
40
+
If you do not provide these values, the deployment will fail.
41
+
42
+
### GCP
43
+
44
+
When using managed MongoDB on GCP, you **must** set a `MONGO_INITDB_DATABASE` environment variable with the name of the database to create.
45
+
46
+
```yaml
47
+
services:
48
+
db:
49
+
x-defang-mongodb: true
50
+
environment:
51
+
MONGO_INITDB_DATABASE: mydb
52
+
```
53
+
54
+
**Important:** It's recommended that you **DO NOT** set `MONGO_INITDB_ROOT_USERNAME` and `MONGO_INITDB_ROOT_PASSWORD` config variables when using GCP. This is because GCP Firestore does not create default user accounts when creating MongoDB databases, and setting these credentials may cause connection issues.### Example
Copy file name to clipboardExpand all lines: docs/concepts/managed-storage/managed-storage.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,4 +6,4 @@ sidebar_position: 000
6
6
7
7
# Managed Storage
8
8
9
-
Defang helps you provision the infrastructure you need to run your services. That infrastructure is designed to scale in and out without persistent storage, so you can build highly scalable services. But Defang can also help you provision managed services to store and persist your data, like [caches](./managed-redis.md), [databases](./managed-postgres.mdx), and [object storage](./managed-object-storage.md).
9
+
Defang helps you provision the infrastructure you need to run your services. That infrastructure is designed to scale in and out without persistent storage, so you can build highly scalable services. But Defang can also help you provision managed services to store and persist your data, like [caches](./managed-redis.md), [sql databases](./managed-postgres.mdx), [nosql databases](./managed-mongodb.md), and [object storage](./managed-object-storage.md).
0 commit comments