Rails部署问题:```应用程序与buildpack不兼容:...```

时间:2019-10-24 14:38:11

标签: ruby-on-rails ruby heroku web-deployment puma

问题

这是Rail应用程序,因此,当我尝试在heroku上进行部署时,在终端:远程上收到此错误:----->应用程序与buildpack不兼容:https://buildpack ...

请帮助。

git status
  On branch master
  nothing to commit, working tree clean

$ git remote -v
heroku  https://git.heroku.com/morning-wildwood-95866.git (fetch)
heroku  https://git.heroku.com/morning-wildwood-95866.git (push)
origin  git@github.com:othman-19/social_media.git (fetch)
origin  git@github.com:othman-19/social_media.git (push)


~/social_media/fb_clone$ ls
app     config.ru  Gemfile.lock  log           public     spec     vendor
bin     db         Guardfile     package.json  Rakefile   storage
config  Gemfile    lib           Procfile      README.md  tmp

使用以下方法在heroku上部署:

git push heroku master

错误日志

    $ git push heroku masterCounting objects: 1494, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1433/1433), done.
Writing objects: 100% (1494/1494), 564.61 KiB | 5.54 MiB/s, done.
Total 1494 (delta 929), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> App not compatible with buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to morning-wildwood-95866.
remote: 
To https://git.heroku.com/morning-wildwood-95866.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/morning-wildwood-95866.git'

此文件用于部署

config / puma.rb

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
    threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
    threads threads_count, threads_count
    preload_app!
    rackup      DefaultRackup
    port        ENV['PORT']     || 3000
    environment ENV['RACK_ENV'] || 'development'
    on_worker_boot do
        # Worker specific setup for Rails 4.1+
        # See: https://devcenter.heroku.com/articles/
        # deploying-rails-applications-with-the-puma-web-server#on-worker-boot
        ActiveRecord::Base.establish_connection
    end

Procfile

web: bundle exec puma -C config/puma.rb

config / database.yml

default: &default
        adapter: postgresql
        encoding: unicode
        pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    development:
        <<: *default
        database: fb_clone_development
    test:
        <<: *default
        database: fb_clone_test
    production:
        <<: *default
        database: fb_clone_production
        username: fb_clone
        password: <%= ENV['FB_CLONE_DATABASE_PASSWORD'] %>

1 个答案:

答案 0 :(得分:0)

尝试创建构建包,并确保您具有正确的rails目录结构。

heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git

git push heroku master
相关问题