Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Meteor on Windows

I find it rather weird that there are no detailed step by step explanations on how to deploy your own Meteor webapp onto your own Windows server. Or maybe I'm just not able to use Google to find one such explanation.

On many pages, even on some questions here on SO, I found people simply saying "build it and deploy it like any other node.js app" which is great, except I can't find any explanation on how to deploy a node.js webapp on to a Windows server either.

Meteor is so awesome, that I feel if anyone would write up such a step by step on how to deploy a Meteor app on a Windows server, a looooot of people would be very happy campers... Especially if the explaintion describes how to deploy multiple Meteor apps onto one Windows server ;)

It certainly does not have to be IIS, nginx runs on Windows just fine.

Also, Node.js runs on Windows just fine. MongoDB runs on Windows just fine, as a service. Meteor builds the apps on Windows apparently just fine. So, it really is missing just one last step to get it deployed on a Windows server as well...

So, anyone out there knows how to deploy several Meteor apps on one Windows server and is willing to write up a n00b-friendly step by step explanation for that?

Pretty please?

like image 824
Predrag Stojadinović Avatar asked Nov 20 '15 14:11

Predrag Stojadinović


People also ask

How do I run a meteor project on Windows?

You can use the application by pointing your web browser at localhost:3000. No Internet connection is required. This is the default command. Simply running meteor is the same as meteor run .

How do I launch meteor app?

To create a Meteor run configurationSpecify the folder under which the application files to run are stored. This folder must have a . meteor subfolder in the root so WebStorm recognizes your application as a Meteor project. By default, the working directory is the project root folder.


1 Answers

Predrag -- I started to write up what I hope is going to be a fairly reasonable step-by-step guide on the Meteor Forums here: Windows Deployment.

Hopefully over the next few days I'll complete it, but it's a start!

Meanwhile here are the basic steps for those who don't need a step-by-step guide:

  • On some Windows machine (can certainly be your development machine if you are developing on Windows) make sure to have the following installed:

    1. Meteor
    2. VS12 (VS15 maybe able to work, but I am using VS12) with the c++ command line build tools installed!
    3. Node (if you are tricky can be the same node as is embedded in Meteor) otherwise any node should work
    4. npm
    5. demeteorizer (npm install -g demeteorizer)
  • Then from your Meteor project run the following:

    demeteorizer -o c:\somepath
    cd c:\somepath\bundle\programs\server
    npm install
    

This is the critical part. The last command will attempt to build Fibers .. so make sure the VS command line tools can be found and work.

If the above works, you are almost home!

Running To run the application -- it IS very similar to any other node application except we need to define (at a minimum) two environment variables (the first two below). I do this via a .bat file, but whatever equivalent should be able to work. The ENV variables are defined in the README file under the bundle directory above BTW if you want to read about them.

set MONGO_URL=mongodb://localhost:27017/mydbname
set ROOT_URL=http://myapp.example.com:8080
set PORT=8080
set MAIL_URL=smtp://user:password@host:port
node main.js

Now the above assumes many simplistic things, namely that your are running your MongoDB on the local machine, with no user security, at the default port. If not, you'll need to change the MONGO_URL part to reflect reality. The "mydbname" is whatever logical name you want to call your collection of documents. In Development mode this was "meteor" but it's unlikely that makes much sense in production (especially if it's against a real production DB!). This also assumes NO Oplog Tailing.

I like to specify the PORT explicitly in the .bat file so it's clear and of course needs to be done unless you want to use 3000 (or 80 - whatever the default is, which I don't remember).

You may also have to set the MAIL_URL if you are using any of the user packages that does email notification, etc. I put it above but it's optional.

Anyway, that's the basics. For more details please read the guide linked above (which is a work in progress).

like image 87
sjmcdowall Avatar answered Nov 08 '22 23:11

sjmcdowall