# Meteor Tutorial: Deploy to Galaxy + mLab

Step 1: Configure your MongoDB instance

Galaxy makes it simple to deploy, scale, and monitor your Meteor app. It is built using the latest Docker and AWS cloud infrastructure. Learn more about Galaxy hosting here: https://www.meteor.com/hosting

This tutorial assumes that you already have a Meteor developer account and a Galaxy hosting account. If you have a Galaxy account, please login to the zone (US-EAST-1 or EU-WEST-1) your account is hosted on.

Galaxy does not provide a MongoDB cluster. So we will be using mLab for this tutorial. If you don't already have an mLab account sign up for one here: https://mlab.com/home (it also has a free 500mb tier to get you started).

If you already have a MongoDB instance feel free to skip to the next section.

Once you have signed up, you'll be greeted by a dashboard were you will be able to create your database.

Click the "Create new" button.

Then you'll be greeted by a "Create new deployment" page where you can choose your cloud provider, the region the Database is hosted on and a plan.


After that, create a database by giving it a unique name and then click "Create new MongoDB deployment" as shown in the image below:


Then click on the newly created database link. You'll be greeted by a dashboard screen. The notice on the top shows 2 different ways to connect to your database. One via the shell in your terminal and the other via a driver. Note down the second URI (it looks something like this: mongodb://<dbuser>:<dbpassword>@ds123456.mlab.com:12345/rubix-todolist) as we will be using it for configuring our Meteor app before deploying to Galaxy.


In the same database dashboard screen click the Users tab and create a new user by clicking the "Add database user" button. Assign a password to this user and keep a note of it.


Navigate back to the Collections tab and create a new collection by clicking the "Add collection" button and name your collection: todos




Step 2: Deploy to Galaxy

Open your terminal and navigate to your meteor-todolist directory. Create a new file called settings.json in the root of your meteor-todolist directory. Paste the following code into the settings file:


{
  "galaxy.meteor.com": {
    "env": {
      "MONGO_URL": "<MONGODB_URI>"
    }
  }
}

Replace <MONGODB_URI> with the URI you noted down earlier. Then replace <dbuser> with your username and <dbpassword> with your password.


Once you have done that, just run the following command to deploy to Galaxy:


$ DEPLOY_HOSTNAME=[zone].galaxy-deploy.meteor.com meteor deploy [hostname] --settings ./settings.json

Where [zone] is where you have created your Galaxy account (US-EAST-1/EU-WEST-1) and [hostname] is the full qualified domain name where you're planning to host your application. If you have any doubts refer to the official tutorial here: http://galaxy-guide.meteor.com/deploy-quickstart.html#deploy-app


Now you would have to configure your DNS settings with your DNS provider for your [hostname] to resolve to your newly deployed Meteor app. More details on how to do that is available here: http://galaxy-guide.meteor.com/dns.html.

Once you have configured your DNS you should be able to navigate to your [hostname] and see the site loaded successfully.

If you have any issues with regards to deployment don't hesitate to contact us at support@sketchpixy.com.