Deploy Meteor on Windows

后端 未结 2 1295
梦毁少年i
梦毁少年i 2021-02-04 10:47

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

相关标签:
2条回答
  • 2021-02-04 11:20

    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).

    0 讨论(0)
  • Well, their page about custom deployment is quite short and I discovered some facts while managing to deploy the Welcome to Meteor application:

    • the ROOT_URL environment variable is required but seems that the port number inside makes no sense.
    • the port number is defined by the PORT environment variable or assigned by node. This PORT variable is not mentioned in the guide. I used the netstat command to find out the port used.
    • the MONGO_URL environment variable is optional in this application.
    • must run npm install before executing the meteor build

    Hope this help.

    0 讨论(0)
提交回复
热议问题