Skip to main content
MongoDB’s document-based architecture makes it perfect for applications that handle unstructured data, from content management systems to IoT platforms. When you need to deploy a MongoDB database with zero downtime and minimal setup, Clouddley takes care of the heavy lifting for you on DigitalOcean Droplets. This tutorial walks you through deploying a MongoDB database using Clouddley. You’ll have a production-ready MongoDB database running in minutes.

Prerequisites

To follow this tutorial, you will need:

Create a DigitalOcean droplet

For this tutorial, we will use doctl, the official DigitalOcean CLI, to create a Droplet. Make sure you have the DigitalOcean CLI (doctl) installed. Before you begin, ensure you have your DigitalOcean API token ready.
  • Authenticate with your DigitalOcean account by running the following command in your terminal:
doctl auth init
  • Enter your API token when prompted. This will allow doctl to interact with your DigitalOcean account.
  • Before creating your Droplet, make sure you have your vpc_uuid and SSH key added to your DigitalOcean account.
Open your terminal and run the command:
doctl compute vpc list
This will display all your VPCs along with their UUIDs. Choose the one you want to use for your Droplet.
Open your terminal and run the command:
doctl compute ssh-key list
If you do not have a previously created one, follow the steps below.Step 1: To generate an SSH key, run the command:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Press Enter to accept the default file location and choose a passphrase if you want one.Step 2: To add your SSH key to digitalocean, run:
doctl compute ssh-key create "my-key-name" --public-key-file ~/.ssh/id_rsa.pub
Replace my-key-name with a name you’ll recognize.
  • Now, create a new Droplet using the following command:
doctl compute droplet create db-droplet \
  --image ubuntu-24-10-x64 \
  --size s-1vcpu-1gb \
  --ssh-keys your_ssh_key_id \
  --region nyc1 \
  --vpc-uuid your_vpc_uuid
Make sure you replace your_vpc_uuid and your_ssh_key_id with your actual values. The SSH key added here allows Clouddley to securely connect to your Droplet during deployments.
You will see the output below Creating a droplet in DigitalOcean You’ve created a droplet named db-droplet with Ubuntu 24.10 x64 image in the nyc1 region.
  • To confirm your Droplet was created successfully, run the command:
doctl compute droplet list
You should see your newly created Droplet in the list. Listing all droplets in DigitalOcean Make sure to note the IP address of your Droplet, as you will need it later.

Deploy

Now that you have your Droplet set up, it’s time to deploy a MongoDB database using Clouddley. Step 1: Access Databases
  • Log in to your Clouddley account.
  • Navigate to the Databases on the left sidebar.
  • Click on Deploy Database

Accessing Databases


Step 2: Configure your virtual machine(VM)
  • In the choose or add server dropdown, select your VM if it’s listed. If not, select + Add Virtual Machine and enter your droplet’s IP address as the VM host, along with the VM User and SSH port.
  • After adding the details, verify the connection with the Clouddley CLI (recommended) or SSH.
  • Open your local machine’s command line, then connect to the remote VM you want to configure with Clouddley. Use this command to SSH into your DigitalOcean Droplet:
ssh root@<your-instance-ip>
  • Install Clouddley CLI by running the command:
curl -L https://raw.githubusercontent.com/clouddley/cli/main/install.sh | sh
  • To add the SSH public key, run the command:
clouddley add key
Using the CLI, you can deploy resources, manage configurations, and automate tasks efficiently.
  • Click Verify to check the connection.
  • Once verified, click on Next.

Configure virtual machine on Clouddley


Step 3: Configure your database name
  • Enter a name for your MongoDB database.
  • Click on Next to proceed.

Defining a unique name for the MongoDB database


Step 4: Select your database type and version
  • Choose MongoDB as your database type.
  • Select the version of MongoDB you want to deploy.
    Ensure you select a version that is compatible with your application requirements.
  • Enable delete protection to prevent accidental deletions.
  • Click on Deploy DB

Selecting the MongoDB database type and specifying the version


Step 5: Confirm deployment
  • Once your deployment is complete, you will see a confirmation message Deployed successfully!

MongoDB database successfully deployed

You can now connect your MongoDB database to your application.

Manage your database

The Database dashboard makes it easy to manage your MongoDB database on DigitalOcean. You can deploy, monitor, and maintain your database. Here’s what you can do:
  • View real-time logs to check performance and troubleshoot fast.
  • Reset passwords securely with built-in authentication and encryption.
  • Prevent accidental deletions with built-in delete protection.
  • Manage the database users and access control.

Database dashboard

Everything you need to manage your database is right where you need it.

Conclusion

You’ve successfully deployed MongoDB on a DigitalOcean Droplet using Clouddley. With a few simple steps, you removed the complexity of manual setup and enabled faster, more reliable provisioning. Got feedback or ideas to improve the experience? We’d love to hear from you. We can’t wait to see what you deploy next!

Getting started with Clouddley?

A backend infrastructure for your own compute. Run apps, databases, brokers, and AI workloads on your VMs, bare metal, or VPS.

Additional Resources