MongoDB¶
Deploying a DBMS¶
To deploy MongoDB, you will need to complete the following steps:
1. Create an application with a suitable tariff.¶
Attention
Stable work is possible at tariffs not lower than “Initial”.
2. At the «Data Upload» stage, select «Via Git»¶
3. At the «Configuration» stage, select «db» and «mongodb» and click «Finish»¶
Important
Stable operation with MongoDB has been tested only with versions 5.0 and 6.0
When deployed, the Docker image mongo:${meta.toolchain.version}
is used. The meta.toolchain.version
parameter is optional. If not specified, the latest mongo:latest
image will be used.
Since the value of the meta.toolchain.version
parameter is a mongo image tag, you can use an arbitrary tag from docker hub as its value.
4. Specify the required environment parameters.¶
In the «Variables» section of the project, you must set the following environment variables:
To add a username, you must click on the «Create Variable» button. In the «Name» field, enter
MONGO_INITDB_ROOT_USERNAME
, and in the Value field, enter the desired user name.To add a password and store it securely, you need to click on the “Create secret” button. In the «Name» field, enter
MONGO_INITDB_ROOT_PASSWORD
, and in the Value field, enter the desired password.
Important
Come up with a sufficiently complex password for the database so that attackers cannot gain access to it.
If necessary, you can set other parameters supported by the image. More information about these parameters can be found on the image page.
Connecting to the database¶
Attention
Connecting to the database is only possible from other projects created in Amverum.
To connect to the database, you must use the 27017
port and internal domain name specified on the «Info» page in the format:
amverum-<username>-run-<transliterated-project-name>
Deploying mongo-express¶
The procedure is the same as deploying the DBMS itself:
1. Create an application with a suitable tariff.¶
Attention
For mongo-express to work, you need a container with a tariff of at least “Initial”.
2. At the “Data Upload” stage, select “Via Git”¶
3. At the «Configuration» stage, select «db» and «mongo-express» and click «Finish»¶
When deploying, the Docker image mongo-express:${meta.toolchain.version}
is used.
To connect to MongoDB version 5 or 6, use version 1 or latest.
4. Specify the required environment parameters.¶
In the «Variables» section of the project, you must set the following environment variables:
Variable
ME_CONFIG_BASICAUTH_USERNAME
- mongo-express administrator usernameSecret
ME_CONFIG_BASICAUTH_PASSWORD
- password for accessing mongo-express (has nothing to do with the database password)ME_CONFIG_MONGODB_AUTH_USERNAME
- mongodb user name (what was specified in theMONGO_INITDB_ROOT_USERNAME
variable)Secret
ME_CONFIG_MONGODB_AUTH_PASSWORD
- password for accessing mongodb (what was specified in the secretMONGO_INITDB_ROOT_PASSWORD
)Variable
ME_CONFIG_MONGODB_SERVER
- internal domain name of the project with mongodb
5. On the «Configuration» page of the application, click the «Build» button¶
If the configuration is empty, you must select “db” and “mongo-express” again and click “apply”, and then “build”.
6. In the «Settings» section of the application, activate free domain name or add your own.¶
Cunning
To save on consuming a project with mongo-express, we recommend pausing it after finishing work.