How I Migrated Off Meteor’s Free Hosting Plan

Over Thanksgiving I put some time into prototyping a small web application that I had been wanting to make for a few years, choosing the technology stack of Meteor & React as a way to become more familiar with both. There is a simple todo tutorial using that stack that served as my baseline, and after completing that a couple days of development got me to a point I could test with some family members to check the site’s usefulness.

Fast forward a few weeks; the free hosting that Meteor provides (and I had been using) has been running into some hiccups with availability, spurring me into looking to migrate the site onto something more reliable for the time being. Without any real background in Meteor, MongoDB, or web hosting outside of Heroku, I spent some time trying to identify how to quickly accomplish this task via my preferred way: searching the internet for blog posts.

I found some helpful tutorials which I’ll mention below in hopes of aggregating information into a post that can serve as more of an “end to end” guide that I couldn’t locate myself.

For full disclosure, I was also looking for a way to host the site roughly for free for the rest of the month, but I wanted a reasonable costing solution going forward if I wanted to continue to run the site. That being said, learning something new is always a motivator, so what I chose below isn’t necessarily my recommendation for someone looking for cheap personal SaaS services.

Finding a New Hosting Provider

The first thing I ended up doing was taking a look at the hosting providers that support Meteor explicitly, which led me to Modulus as a step up from Meteor’s free hosting but without the high cost of Meteor’s Galaxy hosting platform.

While doing some Googling, I came across this interesting Medium post called Taking Meteor Apps Into Production with Modulus, Compose, and Codeship. I had cross paths with Codeship at an interview a few years ago and thought it was pretty cool, so I figured it would be fun to set up one of their free plans (however unnecessary that was for a 1 person prototype). I wasn’t particularly sold yet on paying for a separate MongoDB host in Compose, but I figured I’d give it a shot for a free month as the administration tools are quite rich.

The Medium post mentioned above did a pretty good job of walking through setting up the services necessary to get the web application up and running, although some of the screenshots and information were outdated (e.g. there is no longer a free Compose plan that I could find). However, between that information and another Modulus tutorial on meteortips.com I was able to stand the site up.

I’d be remiss to not include the official Modulus documentation for setting up a project on their site, which is available here.

Migrating the Existing Database

This part seemed like it would be relatively easy; MongoDB has some commands that allow export and import. I came across this blog post titled Export a MongoDB Database Hosted on Meteor.com to a Different Host, which seemed exactly what I wanted to do, and was a little more helpful to me as a novice than the Compose documentation.

At first I tried to just use the Modulus MongoDB offering for my database, however I experienced issues (probably self-inflicted) trying to restore the data dump to it, receiving the vague “auth failed” response even though my credentials seemed correct. At that point, I decided to actually try out Compose – which worked right away.

I did run into the error referenced in that blog post and had to individually restore collections, however I had an extremely basic model with 2 collections so it wasn’t a big deal.

Updating the Domain DNS records

While I was alright with giving out the Meteor free host generated *.meteor.com URL to family as it was pretty easy to remember, Modulus gave me a much more…unique URL for my project. They also allow you to set up a custom *.mod.bz domain in the Administration settings, but that seemed less memorable for my wife, so I went ahead and pointed a domain registered with Namecheap at it.

This documentation was pretty useful on setting that up (albeit a bit overwhelming for a personal project). The gist of it is that you need to update your Custom Domain on Modulus’ Administration setting for your project with *.yoursitename.com (assuming you are interested in mapping all subdomains and the root to your custom URL).

I went with the lazy (and repeatedly discouraged in the documentation) route of using CNAME instead of A records for my root domain because my attempts to use the A records weren’t taking effect as quickly as I would have liked (either that, or I configured incorrectly). Noting that the documentation’s screenshots are a bit outdated with regards to how Namecheap is set up today, I ended up having to set up a CNAME with a 301 Redirect in the actual Advanced DNS Panel.

Summary

I haven’t written up anything about Meteor yet, but the concept behind it is very interesting to me as the data between client and server is meant to be kept in sync without having to write (too much) code to push live updates to the browser. As I primarily work on the Salesforce platform the potential for crossover seems rather limited today, but for fun projects the ability to spin up something with so much infrastructure baked in makes creating small “hack” projects a delight.

My use of React was much more limited; conceptually I followed the framework’s paradigms but I barely scratched the surface of its usefulness.

Note: The prototype is a social group sharing site that isn’t built for more than 1 group, hence the lack of link or screenshots.