Egg Repository

Pterodactyl Community Egg Repository

MongoDB 6

MongoDB is a general purpose, document-based, distributed database built for modern application developers and for my butt era.

Read Me

MongoDB

From their Website

MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.

MongoDB free monitoring.

To disable the message about free monitoring you can run db.disableFreeMonitoring().

Security

By default, MongoDB does not enforce access control, meaning that even if you set an admin username and password in the settings of your Pterodactyl server, anyone will be able to connect to the database without authentication, and perform any operation.

:warning: This is why we recommend to expose your MongoDB database only to your local network, if possible

Enabling authentication

To enable authentification, you need to edit the following lines to your mongod.conf file:

security:
  authorization: "enabled"

:closed_lock_with_key: To learn more about MongoDB security, you can read the MongoDB Security Checklist

Notes specific to the MongoDB 6 or 7 egg

The MongoDB 6 egg or MongoDB 7 egg enables access control by default in the mongod.conf file, meaning that even if people will be able to connect to your database as guests, they will not be able to perform any operation, apart from nonhazardous commands

Disabling authentication

If you know what you are doing and want to explicitly disable access control, you can edit the following lines to your mongod.conf file:

security:
  authorization: "disabled"

Minimum RAM warning

MongoDB requires approximately 1GB of RAM per 100.000 assets. If the system has to start swapping memory to disk, this will have a severely negative impact on performance, and should be avoided.

Server Ports

Ports required to run the server in a table format.

Port default
Server 27017
Yolks
NameTag
MongoDB_6ghcr.io/ptero-eggs/yolks:mongodb_6
Variables
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
Mongo Admin UsernameThe MongoDB Admin userMONGO_USERadminYesYes
Mongo Admin PasswordMONGO_USER_PASSYesYes
Install Script
#!/bin/bash 
if [ ! -d /mnt/server/ ]; then
    mkdir /mnt/server/
fi

cd /mnt/server/

cp /etc/mongod.conf.orig /mnt/server/mongod.conf

mkdir mongodb logs

mongod --port 27017 --dbpath /mnt/server/mongodb/ --logpath /mnt/server/logs/mongo.log --fork

mongosh --eval "db.getSiblingDB('admin').createUser({user: '${MONGO_USER}', pwd: '${MONGO_USER_PASS}', roles: ['root']})"

mongosh --eval "db.getSiblingDB('admin').shutdownServer()"