
MongoDB
Document-oriented NoSQL database for modern applications
Deploy MongoDB in 3 Steps
Connect Your VPS
Add your server credentials to Server Compass
Select MongoDB
Choose from our template library
Deploy & Configure
Fill in settings and click Deploy
DIY MongoDB Deployment
Learn how to self-host MongoDB with this hands-on deployment guide.
Access Your VPS via Terminal
Open a terminal session and log into your VPS. Replace the placeholder with your actual IP.
# Connect via SSH
ssh root@your-vps-ip
# Alternative with key file
ssh -i /path/to/key root@your-vps-ipFirst time? Make sure Docker is installed on your VPS. Run: curl -fsSL https://get.docker.com | sh
Set Up Project Folder
Create a workspace for your deployment files.
# Create and navigate to project directory
mkdir -p ~/apps/mongodb
cd ~/apps/mongodbCreate the Compose File
Configure your containers with this Docker Compose setup:
services:
mongodb:
image: mongo:7
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=<your-mongo-password>
- MONGO_INITDB_DATABASE=app
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
restart: unless-stopped
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 30s
timeout: 10s
retries: 5
volumes:
mongodb_data:
mongodb_config:
PORTHost port to expose(default: 27017)MONGO_USERRoot username(default: admin)MONGO_PASSWORDRoot passwordMONGO_DATABASEInitial database name(default: app)Deploy Your Stack
Spin up the containers and verify the deployment.
# Start all services
docker compose up -d
# List running containers
docker compose ps
# Watch the logs
docker compose logs -fUpdate Firewall Settings
Allow incoming traffic on the application port.
# Allow the application port through firewall
sudo ufw allow 27017/tcp
sudo ufw reload
# Access your app at:
# http://your-server-ip:27017Skip the terminal. Use Server Compass instead.
Let Server Compass handle the complexity. Deploy MongoDB with a simple, intuitive interface.
- Beautiful interface
- One-click deploys
- Let's Encrypt SSL
- Zero downtime
- Container monitoring
- Easy rollbacks
After Deployment
After deploying MongoDB with Server Compass, complete these steps to finish setup
Test database connection using mongosh
Create additional databases and users for your applications
Set up monitoring and alerts
Configure backup schedules for the data volume
Consider upgrading to replica set for production (see MongoDB Replica Set template)
Need help? Check out our documentation for detailed guides.
MongoDB FAQ
Common questions about self-hosting MongoDB
How do I deploy MongoDB with Server Compass?
Simply download Server Compass, connect to your VPS, and select MongoDB from the templates list. Fill in the required configuration and click Deploy. The entire process takes under 3 minutes.
What are the system requirements for MongoDB?
MongoDB requires a minimum of 512MB RAM. We recommend a VPS with at least 1024MB RAM for optimal performance. Any modern Linux server with Docker support will work.
Can I migrate my existing MongoDB data?
Yes! Server Compass provides volume mapping that allows you to import existing data. You can also use standard MongoDB backup and restore procedures.
How do I update MongoDB to the latest version?
Server Compass makes updates easy. Simply click the Update button in your deployment dashboard, and the latest MongoDB image will be pulled and deployed with zero downtime.
Is MongoDB free to self-host?
MongoDB is open-source software. You only pay for your VPS hosting (typically $5-20/month) and optionally Server Compass ($29 one-time). No subscription fees or per-seat pricing.
Ready to Self-Host MongoDB?
Download Server Compass and deploy MongoDB to your VPS in under 3 minutes. No Docker expertise required.
Download Server Compass



