Meteor + Plesk = Easy virtual domain hosting!


#1

Just thought I’d share a something I finally got figured out. For a while when I deployed a Meteor project I’d have to grab a droplet from Digital Ocean or similar service and set it all up then move on. This was annoying considering the many beefy servers I already have available to me for production and development. The issue was that Plesk was managing them all. Plesk does not like you to go out of the lines with it so I never really gave it a shot. I half attempted mup on a Ubuntu box but ran into an issue with the sudoers file and then on CentOs I can into an issue with a npm binary if I remember right.

Then one day I found the JXCore extension in the Plesk catalog, installed it, and with the help of their github board (one user in particular max) I was up in running in under a minute. On one server (in-house, multi-core, 12GB RAM, 250GB SSD ) I’m able to run numerous meteor apps all under different domains using the shared IP address of the box.

These are not huge high-volume apps. 98% of my clients are small to medium sized businesses and lately most have been internal apps to define their workflow and cutdown on paper usage. This isn’t to knock any other service out there, just to get the word out that if you already have a dedicated server setup and you’re running other domains off of it or maybe the only thing holding you back is fear of offending the might Plesk (I really do find that system irritating but its the best I’ve found )…whoever built the extension made life a little easier for Meteor apps. From meteor build to production in under 60 seconds…I’ll take it!

DISCLAIMER: I have no idea who is behind the extension. At first you had to put your ENV vars in the main.js folder but after asking on their github page, a week or so later and they implemented domain specific ENV variables.

Meteor is an interesting beast with resources so I’ve been keeping a strict eye on the balance between the apps and the regular sites running on the same machine. Good thing is is I can cap CPU and Memory per app in JXCore.

Just thought I’d share my experience. I’m happy with the apps I have out on Digital Ocean but I have significant resources running regular sites setup with virtual hosting and I now don’t have to feel like they’re just being wasted. I also run into issues lately explaining why a project for a client needs a new host when they have a literal room full of dedicated web servers.

** that sixty seconds claim is after server setup. If anyone is curious about that I can post below this on how I setup my Nginx service and locked it all down with an SSL layer


#2

Hey @paryguy, it would really be great if you could share your Nginx service and SSL setup!
And thanks for sharing the tip, I think it could be groundbreaking!


#3

@francesco sure thing!

If I ever get around to finishing up an article with a detailed walk-through I’ll post the link but for now this should get you up to speed.

First step is enabling TLS1.2, D3 Creative has two great posts that helped me with the initial setup. First one hardens your server up a bit the second is a walk-through for getting SPDY up and going

https://www.d13creative.co.uk/blog/2014-9-12/enabling-tls-1-2-on-centos-server-running-plesk-and-nginx

https://www.d13creative.co.uk/blog/2014-11-9/enabling-spdy-for-nginx-in-plesk-on-centos

After that it’s pertty simple, download the JXCore Plesk extension from the Plesk catalog and you’re pretty much good to go as long as Node, Mong, etc. are already installed. You need to track down the SSL certificate name Plesk creates but that shouldn’t be too bad, I had to go into the Plesk DB table but I’m sure there’s an easier way. I’m not sure if JXCore pushed a new version of the extension out with environmental variable support, if you download it and you don’t see a field to add your ENV vars then see this thread on github for the beta version towards the bottom of the thread, that works perfectly.

In Plesk under the domain or subdomain you’re using, go to Web Server Settings and make sure NGINX is enabled and add the following to your Additional NGINX Directives textarea:

location / {
    proxy_pass http://myapp.com:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
}

When working with multiple clients who all have different types of projects, having this flexibility to quickly deploy a meteor app on the same server as any other project is really really helpful.

If anyone sees anything wrong or has any additional input I’m all ears!