让ffmpeg与Heroku一起工作
我试图为我的Heroku Rails应用程序安装ffmpeg,现在我的应用程序崩溃了。
我使用以下命令添加了一个buildpack:
heroku config:add BUILDPACK_URL=https://github.com/shunjikonishi/heroku-buildpack-ffmpeg
推送到Heroku后,根据我的日志得到以下错误:
2013-11-17T17:50:44.022351+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 47171` 2013-11-17T17:50:46.295602+00:00 app[web.1]: bash: bundle: command not found 2013-11-17T17:50:47.589491+00:00 heroku[web.1]: Process exited with status 127 2013-11-17T17:50:47.597968+00:00 heroku[web.1]: State changed from starting to crashed 2013-11-17T17:50:48.620853+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ (...) fwd="76.118.180.235" dyno= connect= service= status=503 bytes= 2013-11-17T17:50:48.847288+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=(...) fwd="76.118.180.235" dyno= connect= service= status=503 bytes=
当我运行heroku运行rake db:migrate时 ,我收到错误:
Running `rake db:migrate` attached to terminal... up, run.9791 (in /app) rake aborted! no such file to load -- bundler/setup :29:in `require' :29:in `require' /app/config/boot.rb:6:in `' :29:in `require' :29:in `require' /app/config/application.rb:1:in `' :29:in `require' :29:in `require' /app/Rakefile:5:in `' /usr/local/lib/ruby/1.9.1/rake.rb:2373:in `load' /usr/local/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' /usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' /usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' /usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run' /usr/local/bin/rake:31:in `'
当我检查我正在使用的捆绑包的版本(捆绑show bundler)时,我得到:
/Users/(...).rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Users/(...)/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5
我怎么解决这个问题?
您已使用FFMpeg buildpack替换了Ruby buildpack。 这不起作用。 您仍然需要包含Ruby buildpack来运行Rails应用程序。
你可以使用ddollar的heroku buildpack-multi来做到这一点 – https://github.com/ddollar/heroku-buildpack-multi
然后,您将.buildpacks文件添加到项目的根目录,其中包括标准的Ruby buildpack和FFMpeg buildpack。
当我尝试使用我的rails应用程序将FFMPEG安装到Heroku上时,我遇到了类似的问题。 我最终使用了paperclip-av-transcoder gem,因为所有其他FFMPEGgem都已被弃用。
无论如何,我已经在Heroku上安装了FFMPEG buildpack(一个附加组件)。 这导致了我的Heroku应用程序进程,“没有运行Web进程”错误。
显然,当您在Heroku中安装buildpack时,您现在必须使用如下基本指令创建一个Procfile
:
web: bin/rails server -p $PORT -e $RAILS_ENV worker: bundle exec rake jobs:work
但是,您仍然必须登录Heroku.com并打开它们! 哪个太荒谬了! 但是我的应用程序现在可用
所以这个过程是:
- 安装gem
- 在Heroku上安装buildpack
- 在应用程序的根路径创建Procfile并编写基本指令以启动应用程序并启动dynos
- 登录Heroku.com并手动打开“资源”选项卡中的进程。
我遇到了同样的问题,并尝试安装现有的ffmpeg buildpacks,如https://github.com/issueapp/heroku-buildpack-ffmpeg,但所有只支持’ffmpeg’单一推荐,但我们需要’ffmpeg’的全部支持,就像它对我们的工作一样安装后的本地系统。
我在buildpack中做了一些更改并在https://github.com/laddhadhiraj/heroku-buildpack-ffmpeg创建了一个自定义构建包,因此它将支持所有ffmpeg命令’ffmpeg,ffprobe,ffserver,ffmpeg-10bit和qt-faststart “
为heroku应用程序安装完整支持’ffmpeg’的简便方法
# Ruby buildpack $ cat .buildpacks https://github.com/laddhadhiraj/heroku-buildpack-ffmpeg https://github.com/heroku/heroku-buildpack-ruby # for new project $ heroku create --buildpack https://github.com/ddollar/heroku-buildpack-multi # for existing project $ heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi $ heroku config:set FFMPEG_BIN_URL="http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz" $ git push heroku master # verify and profit! $ heroku run "ffmpeg -version" $ heroku run "ffprobe -version" $ heroku run "ffserver -version" $ heroku run "ffmpeg-10bit -version" $ heroku run "qt-faststart -version"