在英雄雪松堆栈上部署sinatra app(with config.ru) [英] Deploying sinatra app (with config.ru) on heroku cedar stack

查看:133
本文介绍了在英雄雪松堆栈上部署sinatra app(with config.ru)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重构我的sinatra代码,将主文件分离成单独的文件,使用此回复,我有麻烦部署到heroku。

I'm trying to refactor my sinatra code to separate my main file into separate files, using some tips from this response, and I'm having troubles deploying to heroku.

以前我没有一个 config.ru 文件,只是使用我的 Procfile ,它是:

Previously I didn't have a config.ru file, and just used my Procfile, which was:

web: bundle exec ruby web.rb -p $PORT

根据这篇文章

从重构,我现在改变了我的 Procfile to

From the refactor, I've now changed my Procfile to

web: bundle exec thin -R config.ru start -p $PORT

使用我的 config.ru 文件

root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new

而我的 web.rb 文件包含在一个类定义

And my web.rb file being contained around a class definition

class MyApp < Sinatra::Application
  # ...
end

这适用于我本地开发电脑,但是当我部署到heroku时,我得到

This works on my local development computer, but when I deploy to heroku, I get

2011-12-01T11:21:54+00:00 app[web.1]: bundler: command not found: thin
2011-12-01T11:21:54+00:00 app[web.1]: Install missing gem executables with `bundle install`
2011-12-01T11:21:56+00:00 heroku[web.1]: State changed from starting to crashed
2011-12-01T11:22:01+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2011-12-01T11:22:02+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=

瘦身没有安装在heroku上?还有还有其他一些方法来运行我的应用程序在heroku上的变化?

Is thin not installed on heroku? Or is there some other way of running my app on heroku with the changes?

推荐答案

我不得不更新我的 Procfile ,因为 RACK_ENV 不会传入英雄环境。 Procfile 成为:

I had to update my Procfile because the RACK_ENV isn't passed into the heroku environment. The Procfile became:

web: bundle exec thin -R config.ru start -p $PORT -e $RACK_ENV

这篇关于在英雄雪松堆栈上部署sinatra app(with config.ru)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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