MongoDB
This guide explains how to install and configure a MongoDB database server to use as a database host in the Calagopus Panel. Once set up, your users will be able to create MongoDB databases for their game servers directly from the panel.
INFO
The panel connects using a connection string and a privileged account to provision databases and users on demand. Each game server then receives its own isolated credentials.
WARNING
MongoDB starts without authentication enabled by default. This guide creates a superuser first and then enables authentication. Don't skip this step.
Installation
Pick how you want to run it:
Create a directory for the service and enter it:
sudo mkdir mongodb && cd mongodbCreate a compose.yaml with sudo nano compose.yaml and the following content. Authentication is intentionally disabled at first so you can create the initial superuser:
services:
mongodb:
image: mongo:8
restart: unless-stopped
volumes:
- ./data:/data/db
ports:
- '0.0.0.0:27017:27017'Start the service and open a mongosh shell inside the container:
sudo docker compose up -d
sudo docker compose exec mongodb mongoshCreate the Superuser
DANGER
This account can connect from any IP address. Use a long, randomly generated password; a weak password on an exposed port is a serious security risk.
use admin
db.createUser({
user: "calagopus",
pwd: "<strong-password>",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "dbAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" }
]
})Exit the shell:
exit;Enable Authentication
Update your compose.yaml to pass the --auth flag. The ports entry already handles exposure, so this is the only change you need:
services:
mongodb:
image: mongo:8
restart: unless-stopped
command: ['--auth']
volumes:
- ./data:/data/db
ports:
- '0.0.0.0:27017:27017'Restart the service and verify that authentication is working:
sudo docker compose up -d
sudo docker compose exec mongodb mongosh --username calagopus --password --authenticationDatabase adminAdding the Host to the Panel
The panel uses a connection string to connect to MongoDB.
- Go to Admin → Database Hosts → Create.
- Select MongoDB as the database type.
- Enter the connection string:
mongodb://calagopus:<strong-password>@<host>:27017/?authSource=adminReplace <strong-password> with the password you set and <host> with the IP address or hostname of the database server.

- Click Save. You will be able to verify the connection afterwards.
Making the Database Host Show Up for Users
By default, new database hosts are not visible to any client API endpoints. To fix this, add the database host to the Locations Database Host List.
- Go to Admin → Locations and click on the location you want to add the database host to.
- Click the Database Hosts tab at the top.
- Click Add and select the database host you just created from the dropdown, then submit.

INFO
For further reference on MongoDB configuration and user management, see the official MongoDB documentation.