Skip to main content

Connect to MongoDB Addon

Overview

Apps on Cloudron use an internal MongoDB addon. Access the database from inside the server via an SSH tunnel for security.

This guide explains how to connect to the MongoDB addon from your local machine.

Database credentials

Get the database credentials:

  1. Open the Web terminal of an app.
  2. Run env | grep CLOUDRON_MONGODB.
  3. Note the credentials. Each app has its own separate database and credentials.

Internal IP Address

The internal IP address of the MongoDB server is 172.18.30.3.

DB Clients

CLI

Connect via MongoDB Shell:

  1. Open a Web Terminal.
  2. Click the MongoDB button at the top to paste the connection command.
  3. Press Enter to execute the command.

MongoDB Compass

MongoDB Compass is a GUI for visualizing schemas, monitoring performance, and querying data.

To connect:

  1. Create a new connection and click Advanced Connection Options.
  2. Fill in the server and authentication options from the credentials above:
Direct Connection

Check the Direct Connection checkbox. Compass cannot connect without this setting.

  1. Configure the SSH tunnel by clicking the Proxy/SSH tab:

You can now view the database:

Studio 3T

Studio 3T is a GUI client for MongoDB.

To connect:

  1. Create a new MongoDB connection via File -> Connect.
  2. Select manual entry and fill in the credentials from above:
  1. Configure the SSH tunnel by clicking the SSH tab:

You can now view the database: