MongoDB Deployment with `nifectl`
This section explains how to deploy a MongoDB database using the nifectl CLI.
Initialize the MongoDB Application#
Use the nifectl init command to register your MongoDB application and generate the required nife.toml file.
Explanation of Flags#
--name: A unique name for your application.--builtin=mongo: Specifies the use of MongoDB as the runtime.--org: The organization name that will own the app.--volume-size: Size of the persistent volume in GB.--volume-path: Filesystem path inside the container (/data/dbfor MongoDB).--portand--external: Internal and external port (default MongoDB port is 27017).--request-*and--limit-*: Resource configuration for CPU and memory.--replica: Number of instances (replicas) to be deployed.--routing-policy: Defines how traffic is routed (e.g., Latency, Geolocation).
Deploy the MongoDB Application#
Once the application is initialized, deploy it with the required environment variables using the following command:
- Replace
your-usernameandyour-passwordwith secure credentials of your choice. MONGO_INITDB_ROOT_USERNAMEandMONGO_INITDB_ROOT_PASSWORDare required to initialize the MongoDB root user.