问题
I am trying to run a meteor app on a remote host. The application works on my desktop, but when I run it on the remote host the meteor processes are either killed or they freeze. Here are a couple commands that are experiencing this issue:
meteor
meteor update
meteor restart
Each command is taking up about 99% of the cpu at the time of failure, so I suspect Ubuntu is killing the process. I believe that upgrading the CPU will fix these issues, but I want to get a second opinion before I buy anything.
I am running the application on a server with the following CPU specs:
model name : Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
stepping : 4
microcode : 0x1
cpu MHz : 2399.998
cache size : 15360 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
Additionally, is the output when running the meteor
command:
[[[[[ /HELPq ]]]]]
=> Started proxy.
=> Started MongoDB.
Unexpected mongo exit code null. Restarting.
Killedlding for web.browser
The last line says Building for web.browser
, but is partially overwritten by the Killed
output.
回答1:
You shouldn't be running Meteor this way. Basically when your shell times out the meteor process will be killed. You need to detach it from the remote login.
There are a number of ways to do it.
The first step will be to do a 'meteor build', which will produce a bundle, and zip it up ready for transfer to the host
1) Nginx and Phusion Passenger This is my recommendation, as I have found it very easy to set up and maintain, and it also looks after sharing one IP address among several Meteor servers (much like Apache does with virtual hosts). There is an excellent wizard on their site which leads you through installation and setup https://www.phusionpassenger.com/library/install/nginx/install/oss/
2) Forever If you are only running one server and have simpler needs, forever will do. It's also useful for running nodejs servers (which is what meteor server is). https://github.com/foreverjs/forever
3) mup will allow you a one step publish to your own server https://github.com/kadirahq/meteor-up
4) Galaxy hosting. Perhaps more expensive, but again it gives you a one step publish option. https://www.meteor.com/hosting
Galaxy and mup are the least amount of effort, as they are very much a black box. Trouble shooting when things go wrong can be harder. I like the nginx solution because you have fine grained control and yet setup is really simple.
来源:https://stackoverflow.com/questions/41308179/running-meteor-application-on-a-single-core