How to deploy with Meteor on Galaxy and Compose.io in 5 steps

Nauan
2 min readOct 12, 2020

Galaxy is a host made specially for Meteor applications, that’s why It has many advantages to the platform. Compose.io is for the database and has many utilities to make easy to use with MongoDB, which is one of the most used non-relational databases with Meteor. That all said, It’s clear why It’s interesting to use Galaxy and Compose.io to deploy Meteor projects.

Let’s do It:

1. Compose.io — Create deployment

These are the initial configurations that Compose.io calls Deployment where multiple databases are grouped. It’s obligatory to create a deployment so we can create our database later.

2. Compose.io — Create database

No explanation needed :)

3. Compose.io — Create users for the database

See that besides user primary that will be used for common database operations, there is the user readoplog. That one is necessary for the oplog and is more restricted than user primary. (More about oplog)

  • Click on the database you created
  • Click on “Users”, on the menu
  • Click on “Add User”
  • Add these users with these configurations:

username: primary | role: dbOwner

username: readoplog | role: readOnlyoplog, access

4. Compose.io — Get info on Replica Set

  • Click on “Admin”, on the menu
  • Copy the code from “Replica Set URI”
  • Go to file settings.json on your application and change the constants MONGO_URL and MONGO_OPLOG_URL with the copied content.

Here is a example of a settings.json:

{
"galaxy.meteor.com": {
"env": {
"ROOT_URL": "PROJECT_URL",
"MONGO_URL": "mongodb://primary:USER_PRIMARY_PASSWORD@candidate.54.mongolayer.com:11079,candidate.33.mongolayer.com:11189/PROJECT_NAME?replicaSet=set-5733cbfc9ef94cbc21000c5e",
"MONGO_OPLOG_URL": "mongodb://readoplog:USER_READOPLOG_PASSWORD@candidate.33.mongolayer.com:11189/local?authSource=PROJECT_NAME"
}
}
}

5. Galaxy — Make the deploy!

After all that configuration on compose.io, you just need to execute:

DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy PROJECT_URL— settings settings.json

For automated deploys, for instance, on a server with continuous integration, It’s necessary to configure a authentication file.

That’s really simple, just execute the following command:

METEOR_SESSION_FILE=deployment_token.json meteor login

--

--

Nauan

Games, music, TV shows & movies are what I like. Sometimes writing about games here or maybe some tech stuff.