请流星运行在Amazon EC2 [英] Keep meteor running on amazon EC2

查看:183
本文介绍了请流星运行在Amazon EC2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的亚马逊EC2服务器上快到一个简单的流星应用程序。一切是伟大的工作。我手动与我的用户通过流星在项目目录中启动它。

I have a simple meteor app that I'm running on an Amazon EC2 server. Everything is working great. I start it manually with my user via meteor in the project directory.

不过,我想是这个应用程序,以

However, what I would like is for this app to

  1. 在开机运行
  2. 幸免于挂起

我试着通过的nohup流星和放大器运行它; ,但是当我尝试注销EC2实例中,我得到了你正在运行的作业的消息。继续注销停止的应用程序。

I try running it via nohup meteor &, but when I try to log out of the EC2 instance, I get the "You have running jobs" message. Continuing to log out stops the app.

我怎样才能获得应用程序启动的启动和熬夜(除非它崩溃出于某种原因)?

How can I get the app to start on startup and stay up (unless it crashes for some reason)?

推荐答案

安装永远,并使用一个开始脚本。

Install forever and use a start script.

$ npm install -g forever

我有几个脚本来管理我的生产环境 - 启动脚本如下所示:

I have several scripts for managing my production environment - the start script looks something like:

#!/bin/bash

forever stopall

export MAIL_URL=...
export MONGO_URL=...
export MONGO_OPLOG_URL=...
export PORT=3000
export ROOT_URL=...
forever start /home/ubuntu/apps/myapp/bundle/main.js

exit 0

方便的是,它也将追加到〜/ .forever 日志文件,该文件会显示在运行你的应用程序中遇到的任何错误。你可以得到日志文件的位置和其他属性:说说你的应用程序:

Conveniently, it will also append to a log file in ~/.forever which will show any errors encountered while running your app. You can get the location of the log file and other stats about your app with:

$ forever list

为了让您的应用程序开始启动时,你需要做适当的事情为你的Linux的味道。你可以,也许只是把的/etc/rc.local 的启动脚本。为Ubuntu看到这个问题

To get your app to start on startup, you'd need to do something appropriate for your flavor of linux. You can maybe just put the start script in /etc/rc.local. For ubuntu see this question.

另外请注意您真的应,如果在生产中使用它捆绑您的应用程序。请参见这种比较上的差异的更多细节。

Also note you really should be bundling your app if using it in production. See this comparison for more details on the differences.

这篇关于请流星运行在Amazon EC2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆