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.

Mongodb Addon Env

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.

Connect:

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

Compass Mongodb General

Direct Connection

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

Compass Mongodb Auth

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

Compass Mongodb Ssh Tunnel

You can now view the database:

Compass Mongodb Collections

Studio 3T

Studio 3T is a GUI client for MongoDB.

Connect:

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

Studio3t Mongodb Server

Studio3t Mongodb Auth

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

Studio3t Mongodb Ssh Tunnel

You can now view the database:

Studio3t Mongodb Collections