mongodb - 在 heroku 上部署 Meteor 1.0 应用程序后出现应用程序错误

标签 mongodb heroku deployment meteor

我正在尝试使用以下 buildpack 在heroku 上部署meteor.js 应用程序(v 1.0):
https://github.com/AdmitHub/meteor-buildpack-horse
并按照本教程进行操作:
http://www.growthux.com/ux-html-css-js-growth-hack/installing-meteor-on-heroku

我的应用更像是一个静态网站,我正在使用数据库构建一个简单的后台:
- 存储管理员用户和图像路径,然后在我的模板中动态呈现。

在 Heroku 上创建我的应用程序后,设置 ROOT_URL 变量,将 MONGO_URL= 变量设置为我在 MONGO HQ 上的外部数据库,(也尝试过 mongo lab,同样的问题),最后推送到 Heroku,我收到了这个错误访问网址时的消息:

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

所以我做到了:

2014-11-10T17:10:23.825922+00:00 heroku[web.1]: Stopping process with SIGKILL 2014-11-10T17:10:23.825723+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2014-11-10T17:10:24.584852+00:00 heroku[web.1]: State changed from starting to crashed 2014-11-10T17:10:24.574995+00:00 heroku[web.1]: Process exited with status 137 2014-11-10T17:10:26.415257+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cle-meteor.herokuapp.com request_id=ffc312a1-316d-4337-9165-caa492aa7c15 fwd="80.13.242.126" dyno= connect= service= status=503 bytes=

不确定我是否在部署过程中做错了什么,或者我是否必须重新考虑我的应用程序在不在本地运行时如何与数据库交互。
有什么见解吗?

最佳答案

我有一个类似的问题,原来我从 ROOT_URL 中删除了“http://”。

您的日志消息相当笼统,在那之前有什么吗?

以下是我在 heroku 和 mongolab 上运行 meteor “todos”应用程序的方法。


Heroku 上的 meteor

安装 meteor

curl install.meteor.com | /bin/sh

将 meteor 添加到我们的路径中,以便我们可以从任何地方运行“ meteor ”命令。

将现有的 meteor 应用程序克隆到 heroku 文件夹中。

meteor create --example todos heroku

切换到 meteor 应用的文件夹。

cd heroku

我添加了一个如下所示的 package.json 文件。

{
  "name": "myapp",
  "version": "0.0.1",
  "engines": {
    "node": "0.10.33",
    "npm":  "1.4.23"
  },
  "dependencies": {
    "fibers": "1.0.0"
  }
}

更改到我们的主文件夹。我们想回到我们之前的位置。

pushd ~

获取heroku客户端并安装它。

wget http://assets.heroku.com/heroku-client/heroku-client.tgz
tar -zxvf heroku-client.tgz 
export PATH=${PATH}:${HOME}/heroku-client/bin

回到我们之前的位置。

popd

登录heroku。

heroku login

SKIP THIS PART IF YOU ALREADY HAVE SSH CONFIGURED NICELY WITH HEROKU AND GITHUB

Add your public SSH key to heroku (if you haven't already done so)

heroku keys:add ~/keys/heroku_public_key_ssh.txt

(Manually) Ensure that public SSH key has also been added to your GitHub account.

If you're running ssh-agent, ensure your matching private SSH key is loaded

ssh-add ~/.ssh/id_rsa_heroku_github

将我们的子文件夹设置为 git 存储库,我们将把它推送到 heroku。用您自己的 heroku 应用名称替换下面的“mikestodos”。

git init
heroku git:remote -a mikestodos
git add .
git commit -a -m "first deploy"

创建一个 heroku应用程序。我的叫mikestodos。

heroku create mikestodos --stack cedar --region us --buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git

创建一个新的mongolab数据库,以及一个新的数据库用户。

将 heroku 的 MONGO_URL 设置为我们的 MongoLabs 数据库 URL。格式为:

heroku config:set MONGO_URL=mongodb://<my_mongouser>:<my_mongodbpassword>@<mymongoserver>:<mymongoport>/<mymongodbname>

在下面替换您自己的 MongoLabs URL。

heroku config:set MONGO_URL=mongodb://mikestodos:<dbpassword>@ds051980.mongolab.com:51980/mikestodos

为我们的 heroku 应用设置 ROOT_URL。

heroku config:set ROOT_URL=http://mikestodos.herokuapp.com

现在将我们的应用推送到 heroku。

git push heroku master

关于mongodb - 在 heroku 上部署 Meteor 1.0 应用程序后出现应用程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26867881/

相关文章:

node.js - 什么查询或运算符将有助于找出 mongoDb 中数组元素的累积和

mongodb - mongo shell 可以警告对不存在的集合的操作吗?

node.js - 如何使用 Mongoose 和 NodeJS 在 MongoDB 中保存嵌套数组

ruby-on-rails - 由于嵌套的 asn1 错误,Rails 无法从环境中读取证书信息

node.js - Heroku 构建被拒绝 - NodeJS

java - 在 Jetty 中运行 servlet 时获取 HTTP 500

eclipse maven项目部署报错

java - 使用 Java 构建路径将 Spring 项目添加到 Spring Boot

python - 在 Flask+Heroku 上将 HTTP 重定向到 HTTPS

带参数的 MySQL 脚本