Galaxy makes it simple to deploy, scale, and monitor your Meteor application. This guide provides detailed step by step instructions for deploying your application to Galaxy.
This guide will cover:
- Setting up MongoDB
- Specifying Meteor application settings
- Setting the hostname
- Using the Meteor CLI tool to deploy the application
- Configuring domains and SSL Encryption for the application
Sign up for GalaxyYou will need a Galaxy account that your Meteor Development Account has deploy authorization to use. Sign up here for a new Galaxy Account. Once you have created your account, sign in to Galaxy. Depending on the region you want to deploy your apps to, go to the URL and sign in with your username and password. For US East, use https://galaxy.meteor.com/. For EU West, use https://eu-west-1.galaxy.meteor.com/. For Asia-Pacific, use https://ap-southeast-2.galaxy.meteor.com/. The region you deploy to will affect the URL of your dashboard. If your username is devname, you’ll see your US East apps at https://galaxy.meteor.com/devname, your EU West apps at https://eu-west-1.galaxy.meteor.com/devname, and your Asia-Pacific apps at https://ap-southeast-2.galaxy.meteor.com/devname.
Configure your MongoDB database
If your Meteor application has a package that requires Mongo, then you’ll need a Mongo database configured for your application. If you want to use a hosted database provider, we recommend that you provision it from one of these providers: mLab, compose or MongoDB Atlas.
For optimum performance, we recommend that you setup a database in the same AWS region as your app deployment.
Configure a free Sandbox MongoDB database
mLab offers a free sandbox MongoDB database. The sandbox is a single node database that is good for non-production workloads.
This sub-section will walk through creating a new sandbox database.
Create an account on mLab. Within your mLab account, go to https://mlab.com/create and select the Sandbox option in the Single-node plan.
Provide a name for the database and create the deployment.
The newly created database will be listed in your account. Select the database.
Create a database user that will be used by your Meteor application to access the database. Do not select the option ‘Read-only’ for the user.
Note the MongoDB URI shown on the database page. You will use this URI with the username and password later to configure the connection to the database.
Create a settings file for Galaxy
Create a Meteor settings file that will define the set of configurations needed for your application to deploy and run on Galaxy. At a minimum, the settings file needs to contain the connection URL to the MongoDB database.
In your application directory, create a file named settings.json. Put the Mongo URI in the file, using this format:
For a detailed example of the settings.json file, see Environment Variables.
Select a hostname
Choose a hostname that the public can use to access your application. You can use a custom domain or you can use the included *.meteorapp.com domain.
If you are using the included domain, use
If you have a custom domain name, then you need to point your DNS (in your registrar’s dashboard) to galaxy-ingress.meteor.com. More instructions on DNS configuration can be found here.
Deploy your application to Galaxy
Use the Meteor CLI tool to deploy the application to Galaxy. Make sure that you are signed into an authorized Meteor Developer Account that has permission to deploy to Galaxy. Use the CLI command
meteor whoami to verify which Meteor Developer Account you are signed into.
The value of DEPLOY_HOSTNAME will depend on which region you are deploying to:
To deploy to US East: DEPLOY_HOSTNAME=galaxy.meteor.com
To deploy to EU West: DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com
To deploy to Asia-Pacific: DEPLOY_HOSTNAME=ap-southeast-2.galaxy.meteor.com
Mac and Linux
On the command line, within your application’s directory, type:
DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy [hostname] --settings path-to-settings.json
hostnameis the fully qualified domain name where you’re planning to host your application (for example, ‘www.facebook.com').
path-to-settings.jsonis the path to your settings file (for example, ‘./settings.json’).
If you are using Windows, the commands to deploy are slightly different. You need to set the environment variable first, then run the deployment command second (the syntax is the same as everything you’d write for meteor deploy). The commands will look like this:
Specify an account to deploy
Galaxy utilizes the following policy to select the account to deploy your application to:
- If an application with the specified hostname already exists in an account, Galaxy deploys to the same account.
- If it is a new application, Galaxy chooses the individual user account if it exists.
- If it is a new application, and individual user account does not exist, Galaxy chooses the first Galaxy organization account that you are a member of.
If you are a member of two or more accounts, you can specify an owner username (available in Meteor 1.3) with
DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy [hostname] --settings path-to-settings.json --owner [username]
username is the Galaxy account username the application should deploy into. You need to have deploy privileges to the account. Note: this only applies for new applications, as any subsequent deploys will already be attached to an account and re-use the same account.
Using a deployment token
Galaxy can also accept deployment tokens, which are good for 90 days. You can pass
METEOR_SESSION_FILE=token.json before meteor login to generate a login session token so you don’t have to share your login credentials with third-party service providers. This solution is recommended for continuous integration service providers.
You can use a deployment token as an alternative to typing in your username and password. You’ll need to specify it both when running
meteor login on your machine to generate the file, and when actually running
meteor deploy in CI. Please note that your organization choice does not affect your deployment token.
Configure your application
The first thing you should do is verify that the deployment was successful. Check to see if the application is accessible by navigating to its URL. Then check the application logs in Galaxy at
galaxy.meteor.com/app/<app_name>/logs to see if there are any errors that are affecting the deployment.
Once your application is successfully deployed, head on over to your Galaxy dashboard to configure your application by adding a custom domain name and enabling SSL encryption.
Add a domain in your application’s settings and point your DNS to:
galaxy-ingress.meteor.comfor applications in the US East region.
eu-west-1.galaxy-ingress.meteor.comfor applications in the EU West region.
ap-southeast-2.galaxy-ingress.meteor.comfor applications in the Asia-Pacific region.
If you are deploying to a root domain (for example mydomain.com), then follow the advanced instructions here.