我有点好奇Meteor (或其他Meteor应用程序部署Modulus之类的进程)是否比复制Meteor应用程序、启动tmux会话和运行meteor在服务器上启动应用程序做得更好。先谢谢你!
发布于 2015-10-23 01:21:06
Meteor Up和Modulus似乎只运行node.js和Mongodb。他们运行你的应用程序后,它已经打包为生产与meteor build。这可能会让你的应用在性能上有优势。
可以只在tmux或屏幕会话中运行meteor。我使用meteor run --settings settings.json --production来传递设置,也使用生产模式来缩小代码等等。您还可以使用像Nginx这样的代理转发器将请求转发到端口80 (http)和443 (https)。
作为参考,下面是我的Nginx配置:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate /etc/ssl/private/example.com.unified.crt;
ssl_certificate_key /etc/ssl/private/example.com.ssl.key;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/ssl/private/example.com.unified.crt;
ssl_certificate_key /etc/ssl/private/example.com.ssl.key;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}通过使用此方法,所有内容都包含在流星容器中,并且您可以使用流星监视更改等。但是,服务器上可能会有一些额外的开销。我不确定到底有多少,因为我还没有对这两种方式进行足够的测试。
通过使用这种方法,我发现的唯一问题是,在重新启动时,所有东西都是自动化的,比如自动运行tmux然后启动meteor,而不是使用特殊设计的工具,比如Node.js Forever或PM2,后者在服务器重新启动时自动启动。因此,您必须手动登录到服务器并运行meteor。如果您想出了一种使用、tmux、或屏幕轻松完成此操作的方法,请告诉我。
编辑:
我设法让Meteor在系统启动时从/etc/rc.local文件中的以下行开始:
sudo -H -u ubuntu -i /usr/bin/tmux new-session -d '/home/ubuntu/Sites/meteorapp/run_meteorapp.sh'一旦系统启动,此命令将在tmux会话中运行run_meteorapp.sh shell脚本。在run_meteorapp.sh中有:
#!/usr/bin/env bash
(cd /home/ubuntu/Sites/meteorapp && exec meteor run --settings settings.json --production)发布于 2015-10-22 11:12:19
如果您查看Meteor页面:https://github.com/arunoda/meteor-up,您可以看到它的功能。
例如:
特性 单命令服务器安装单命令部署多服务器部署环境变量管理支持基于settings.json密码或基于私钥(Pem)的服务器身份验证访问,支持来自终端的日志(支持日志跟踪)支持多个流星部署(实验性) 服务器配置 如果应用程序在服务器重新启动(使用upstart)用户特权恢复到以前的版本后崩溃(使用永久)自动重新启动,则自动重新启动,如果部署失败,则保护MongoDB安装(可选)预先安装的PhantomJS (可选)
所以是的..。它做的更多..。
发布于 2015-12-15 18:23:27
Mupx做的更多。它利用了码头。这是开发版本,但在将Meteor更新为1.2之后,我发现它比mup更可靠
更多信息可以在github:https://github.com/arunoda/meteor-up/tree/mupx上找到
https://stackoverflow.com/questions/33271031
复制相似问题