Meteor production deployment set-up


#1

Hey Guys,

So I’m going to set my first full production server up and I just wanted to run my route through you guys to see if perhaps there are better ways to do it that I am missing.

My plan is to deploy and ubuntu ec2 instance, install mongo and nginx there and deploy multiple meteor apps on that server that use the same mongo db and are routed by the nginx server. I will then store all non layout images in an s3 bucket for each site to keep server load to a minimum to maximize server efficiency and keep cpu load to a minimum.

My alternative is to use docker, but I am already comfortable with nginx and settign up ssl certificates that way and I read it may be difficult in docker.

Also is there anything I am missing about using Galaxy or Digital ocean or some other host than ec2? Other than ease to deploy I don’t see any advantages of using something other than ec2 in terms of price and scale. I


#2

Take care to forward web socket connections correctly. Or configure nginx to forward all upgrade requests correctly. Get familiar with the ddp-client package so that you can see exactly how web socket connections are made.

However, you may get more out of just running each application in ELB (the pricing is right, considering that you could turn a single m5.large into a cheaper collection of t2.nanos, depending on how much load you actually expect each application to have) and just deploying your NGINX load balancer.

The alternative of using docker with phusion:baseimage and the incredibly simple script it entails will involve a lot less finnicky IT, especially for debugging, logging and version control. If you have the opportunity to not create servers that you have to ssh into, use that opportunity. Then you can use ELB for docker containers, or eventually GCE, or whoever is cheapest.


#3

There are always better ways, but to get started I think there’s nothing better than keeping it simple and slapping it onto a server setup that you already know.

I currently host a few low-volume apps this way on a single self-managed ec2 box without fancy infrastructure frameworks.

I use PM2 to startup and manage the node processes, and nginx to handle domains and ssl termination

Save the other stuff for when you need it


#4

Hey awesome call on the pm2, it is an awesome addition, especially considering I started off this project trying to use the upstart service.

I’m considering make an nice write up on it.

-On ec2 Ububtu 18.04
-With SSL from lego
-With NGINX
-With Node
-with mongodb
-Deploy with pm2

Do you use a particular e-mail server? Do you know of one that will be good for multiple domains? I’d like to run several sites per instance and have all the emails and the DB manages on that server.


#5

I usually end up using something like mailgun, sendgrid or even Amazon SES

I’ve done email marketing before and know exactly how awful email is, I’m much happier to have someone else be responsible