These docs cover apps running on Galaxy Metal and Web Apps. If your app runs on Galaxy Legacy, visit the legacy docs.
Galaxy

Migrate to Galaxy MongoDB

Use a Docker image to move your MongoDB database to Galaxy with minimal downtime.

Moving your existing MongoDB database to Galaxy doesn't have to be painful. Galaxy provides a Docker image that handles the data transfer for you, so you can focus on getting your app running instead of wrestling with migration scripts.

What you'll need:

  • Docker installed on your machine
  • Source and target MongoDB URIs ready and tested
  • IP whitelist configured on MongoDB Atlas if that's your current host

Not for Sharded Clusters

This migration method doesn't support MongoDB Sharded Clusters. If you're running a sharded cluster, contact the Galaxy team for help.


Run the Migration

Get Your MongoDB URIs

You'll need two connection strings: one for the source and one for the destination.

Your source URI comes from your current MongoDB provider (for example, MongoDB Atlas) and looks like:

    mongodb+srv://<username>:<password>@<source-cluster>

Your target URI comes from the Galaxy Database team. Find it in the Credentials section of your database in the Galaxy dashboard. It looks like:

    mongodb://<username>:<password>@<destination-host>:<port>

Run the Docker Container

With both URIs ready, run the migration container:

    docker run --rm \
      -e SOURCE_URI="" \
      -e TARGET_URI="" \
      -e DB_NAME="example_source_db_name" \
      meteor/galaxy-mongodb-migrate:202506181938

Replace SOURCE_URI, TARGET_URI, and DB_NAME with your actual values.

Here's a complete example:

    docker run --rm \
      -e SOURCE_URI="mongodb+srv://username:password@source-cluster.mongodb.net" \
      -e TARGET_URI="mongodb://username:password@destination-host-01.mongodb.net:27017,destination-host-02.mongodb.net:27017,destination-host-03.mongodb.net:27017/admin?replicaSet=replicaSetName" \
      -e DB_NAME="example_source_db_name" \
      meteor/galaxy-mongodb-migrate:202506181938

SSL Configuration

If your Galaxy Database has SSL enabled, the connection string needs a couple of specific adjustments to work correctly.

Three things to keep in mind:

  • Always include authSource=admin in your target URI. Without it, MongoDB tries to authenticate against the wrong database and the connection fails.
  • Omit ssl=true from the connection string unless you're also providing a certificate file.
  • If ssl=true is required, download the SSL certificate from the Galaxy Database dashboard and provide it through the appropriate parameter.
    docker run --rm \
      -e SOURCE_URI="mongodb+srv://username:password@source-cluster.mongodb.net" \
      -e TARGET_URI="mongodb://username:password@destination-host-01.mongodb.net:27017,destination-host-02.mongodb.net:27017,destination-host-03.mongodb.net:27017/admin?authSource=admin&replicaSet=replicaSetName" \
      -e DB_NAME="example_source_db_name" \
      meteor/galaxy-mongodb-migrate:202506181938

Download the SSL certificate from your Galaxy Database dashboard first, then mount it into the container:

    docker run --rm \
      -v /path/to/ssl-cert.pem:/ssl-cert.pem \
      -e SOURCE_URI="mongodb+srv://username:password@source-cluster.mongodb.net" \
      -e TARGET_URI="mongodb://username:password@destination-host-01.mongodb.net:27017,destination-host-02.mongodb.net:27017,destination-host-03.mongodb.net:27017/admin?authSource=admin&ssl=true&sslCAFile=/ssl-cert.pem&replicaSet=replicaSetName" \
      -e DB_NAME="example_source_db_name" \
      meteor/galaxy-mongodb-migrate:202506181938

Post-Migration: Create a Dedicated User

Once your data is in Galaxy, create a new database user scoped specifically to your migrated database. This is better security practice than connecting with your admin credentials.

Complete the Migration First

Make sure all data has been successfully transferred to Galaxy before creating any new users.

Connect to Your Database

Connect to your Galaxy Database using MongoDB Compass or another client. Use the admin credentials from your Galaxy dashboard.

Select the Migrated Database

Switch to the database you just migrated:

    use example_db_name

Create the New User

Create a user with readWrite access to that specific database:

    db.createUser({
      user: "newuser",
      pwd: "<new-secure-password>",
      roles: ["readWrite"]
    })

Replace <new-secure-password> with a strong, unique password.

Verify the User

Confirm the user was created successfully:

    db.getUsers()

Update Your App's Connection String

Use the new user credentials in your app's MONGO_URL:

    mongodb://newuser:pass@destination-host-01.mongodb.net:27017,destination-host-02.mongodb.net:27017,destination-host-03.mongodb.net:27017/example_db_name?replicaSet=NameOfYourReplicaSet&readPreference=secondary

Update this value in your app's Variables section in the Galaxy dashboard.

Principle of Least Privilege

Giving your app user only readWrite on its own database limits the blast radius if credentials are ever compromised. Don't connect production apps with admin credentials.


Security Considerations

A few practices to keep in mind after migration:

  • Use secure passwords for all database users.
  • Assign only the permissions each user actually needs.
  • Review user privileges regularly and remove access that's no longer needed.

System Users

Galaxy automatically creates several users in your MongoDB cluster for internal operations. Don't delete them or your database management will break.

admin@admin: Initial user with administrative privileges.

galaxyadmin@admin: Technical user required for automation.

galaxybackup@admin: Designated user for performing backups.

galaxymonitor@admin: Used for monitoring.


Troubleshooting

If the migration fails or the connection is refused:

  • Check that your connection strings are correct and that the credentials have the necessary permissions.
  • Review the Docker container logs for specific error messages.

Common Questions


Need Help with Your Migration?

For zero-downtime migrations or anything more complex, reach out at support@meteor.com. The Galaxy team can walk you through the process.

What's Next?