Best way to deploy meteor app in 2020?

I don’t know why deploy a meteor app is so hard.

First i met the problem with phusion passenger, the app auto restart and log out all users, then i tried to use Meteor-up but i realized that i can access to mongodb from outside server, using task like import or export a specific collection…etc.

I tried to install mongodb on Meteor-up in other to add it to MONGO_URL config but it’s not work.

I met this error when tried to start mongod service

Process: 26150 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)

I don’t know what to do now, please help.

2 Likes

Using Meteor-up with the standard settings you should NOT be able to access mongodb from outside the server. You also shouldn’t have to install mongodb yourself. All you need to do is add:

  mongo: {
    version: '3.4.1',
    servers: {
      one: {}
    }
  }

To your config and mup should do the rest. I use it in non-mission-critical single-server production apps all the time.

2 Likes

Just to answer the title, the easiest and the “best” way to deploy Meteor in 2020 is on Galaxy. And Atlas for MongoDB. It’s very, very easy in fact, everything just works. Those are production scalable platforms as a service.

Galaxy runs Docker containers and manages them with Kubernetes all on AWS behind the scenes. It configures your SSL cert automagically, you can change the size of container you run on, and change the number of containers manually or by auto-trigger rules you set up. You get access to APM to monitor your app internals for a little extra learning, everyone should at least try Galaxy out for the 1 month for free with all the goodies, so you know what you might be missing without it. It’s a great service, and the Meteor team is working hard & fast to make it even better. @filipenevola has been writing lots of doc updates (check out the Galaxy Docs here)

You can run the tiny cluster long term for as low as $7 a month w/ a yearly payment or just $9 for month to month. That’s 3x lower cost that the recent lowest cost option with Galaxy, so very low cost for such a solid infrastructure.

And Atlas allows you to run a 3 node cluster for free, which works for development and maybe a small internal app user base.

I’ve used both Galaxy & Atlas for years and have never had even 1 issue. On Galaxy I run a Staging app environment, and a Production app environment.

You can shut down your server/environment and then you pay $0 while it is off, turn it back on a week later if you like, and everything is exactly as you left it. So it’s important to realize you only pay while you are actually using the service. That’s exactly how it should be.

Also using Galaxy and paying a tiny amount of $$ for Galaxy is the main revenue source to pay for the Meteor team to keep making Meteor and Galaxy more awesome! So I’m just sharing how much I like the service and why the value seems awesome to me!

You update your app in the cloud with 1 line re-deploys and your users never notice. I think this doesn’t get talked about enough. :heart:

There are other options out there too, but you won’t find a more well updated and maintained service.

9 Likes

Thank you for such a very detail infomation. I used Heroku with mlab before, now i decided switch to self-manage vps because the speed, my visitors is mainly in Asia so i need a vps in the same location.

When used mlab the databse storage reach 1GB so fast, but my budget is only about under $40/month. So i must find a cheaper solution to keep the app live but i’m facing too many issues when tried to deploy meteor on Digital Ocean droplet. :frowning:

Using Meteor-up with the standard settings you should NOT be able to access mongodb from outside the server. You also shouldn’t have to install mongodb yourself. All you need to do is add

I couldn’t restore my db like the guide in meteor-up page. I used the command mongodump to export the db from mongodb:

/dump/meteor/file.bson

I also try to zip dump.gz or meteor.gz but it’s not work, when use the restore command i met this error message:

2020-07-03T20:26:36.493+0000 Failed: stream or file does not appear to be a mongodump archive

The command on the guide works for me, this is part of my utility bash script which I use for various projects:

dump() {
    ssh -i "$key" $user@$server "docker exec mongodb mongodump -d $appname --archive --gzip" > dump.$server.gz
    echo "${cyan}>>> Data backed up to : $(pwd)/dump.$server.gz"
}

Did you remember to change -d meteor to -d <your-app-name>?

Did you let mup create your mongodb, or did you install it yourself? Perhaps try starting with a completely fresh instance to wipe any mongo you created yourself previously, then let mup create mongo, they try the mongodump.

1 Like

Galaxy does have an Asia-Pacific Region, but if that is not specific enough, you could also request a region. I think you would be in good shape with $40 a month on Galaxy.

But Meteor is very portable too, so pick what works for you :sunglasses:

1 Like

Thank you, i did the command and could restore the database but the app seem like doesn’t recognize database name, which database name is correct in this case and how could i specfic the database name in mongorestore command?

And i have some questions, please help me if you can:
1/ How to create cron task in meteor-up (i have a cron job to update the database collection)
2/ How to see the up-time of my app.
3/ How to see the console log like the message show on the terminal screen when use “meteor run” command on local computer.

The database name is whatever your app is called:

app: {
    name: '<your-app-name>',

For cron you can use a regular cron job, or build a job scheduler into your app. I use wildhart:jobs but only because I wrote it, there are others.

The uptime can possibly be obtained from mup status, I haven’t tried recently. Or maybe docker ps via ssh.

Logs can be viewed with mup logs.

3 Likes

Nice Jobs package @wildhart, I’m glad I know that exists, because it looks very handy! Clear docs too :sunglasses:

Thanks @mullojo, although for the docs I should really pass the credit on to @msavin from whom I forked and then rewrote my package. Most of the docs and the simple API are his work.

1 Like

Thank you very much, i changed the database name and it works. Is there any way to keep user not log out when app restarted or change the config?

Currently I used DigitalOcean 2GB 2vCPUs 3TB 60GB $0.022 $15 for 2 apps deploy (2 Docker container apps) with difference PORT.
Excuse me, how much app could deploy on one Container Size of Galaxy?
For example I choose Compact, 512MB RAM, 0.5 ECU, $23 / month, $32 / month???

I like waveshosting.com and Mongo Atlas

Users should not be logged out if you don’t change the database between restarts/redeploys. However, users will be logged out if you restore the db with old data containing old access tokens which are out-of-sync with the access tokens stored in their browser.

What are you changing in the config? Try a redeploy without changing anything and you should not get logged out.

1 Like

Consider Galazy or Heroku. I made this commit for a new intern that was having trouble deploying their app to heroku - https://github.com/RobertLowe/versus-meteor/commit/27b8e6e588356ed57695c0dbc4effde6b9e57b98 It’s really simple to get started and can be just a click away:

Deploy

I like scalingo, they take care of meteor hosting very well, both the app + mongodb. Just from my personal experience, highly recommended.

Hosting on a VPS with mLab for a cloud MongoDB is one option. If you plan to scale and not want ot deal with infrastructure, Galaxy is the best.

To deploy freely, mup is recommended

I love mup. I’m deploying my apps to AWS for many years now, and it never really let me down. The docs could be a bit better, and there are some glitches here and there - but hey, at least it is well-maintained, thanks to @zodern and the other contributors.

2 Likes