2017-08-31 111 views
0

我在Heroku上创建了一个Rails应用程序,我决定从github部署它。由于我的github文件夹具有以下结构,如果我选择使用heroku从github进行部署,它不会识别我因为子文件夹而在rails上使用ruby。从github子文件夹中部署Heroku

*\.git 
*\otherfiles 
*\book-market 
*****\app 
*****\bin 
*****\config 
...ecc 

我有我的rails应用程序在book_market文件夹。起初,我使用下面的命令

git subtree push --prefix book_market heroku master 

,一切的伟大工程,execpt的事实,我必须承诺并推动每一次从Heroku的CLI推。

昨天,我发现这个构建路径Heroku Buildpack Subdir,使您可以在文件夹内执行构建路径,所以我在我的根的git目录中创建一个.buildpacks与以下行

book_market=https://github.com/heroku/heroku-buildpack-ruby.git 

而且我也是在创造了Procfile根目录

web: book_market/bin/bundle exec rails server -p $PORT -e $RAILS_ENV 

从GitHub部署的伟大工程,它编译一切,但它无法启动服务器和日志说

heroku[web.1]: Starting process with command `book_market/bin/bundle exec rails server -p 59500 -e production 
heroku[web.1]: Process exited with status 1 
heroku[web.1]: State changed from starting to crashed 
app[web.1]: /usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException) 
app[web.1]:  from book_market/bin/bundle:3:in `<main>' 

这是我的Gemfile

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 

gem 'bundler' 

gem 'aws-sdk' 

gem 'bcrypt', '3.1.11' 

gem 'bootstrap-sass', '3.3.7' 

gem 'bootstrap-will_paginate', '1.0.0' 

# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 

gem 'faker', '1.7.3' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 

gem 'jquery-slick-rails' 
# Use jquery as the JavaScript library 
gem 'jquery-rails' 

gem 'meta-tags' 

gem 'omniauth-google-oauth2' 

gem 'omniauth-facebook', '4.0.0' 

gem 'paperclip', '~> 5.0.0' 
# Use Puma as the app server 
gem 'puma', '~> 3.0' 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.0.3' 

gem 'rails-controller-testing', '1.0.2' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 

gem 'select2-rails', '4.0.3' 
# Use sqlite3 as the database for Active Record 
gem 'pg' 

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 

gem 'unicorn', '5.3.0' 

gem 'vacuum' 

gem 'will_paginate', '3.1.6' 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'listen', '~> 3.0.5' 
    gem 'web-console', '>= 3.3.0' 
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 
    gem 'spring-watcher-listen', '~> 2.0.0' 
end 
group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platform: :mri 
end 

我也注意到,当我创建的应用程序,并与子树命令推它创造不同的环境变量

[email protected]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_LOG_TO_STDOUT, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars 

和连接数据库

[email protected]: Attach DATABASE (@ref:postgresql-solid-35310) 

当我部署从github它没有这样做。

我怎样才能解决这个问题呢?由于

回答

0

我解决了这个问题。首先,我改成this建设者包,并根据他们的指示我在子目录移动Procfile。

关于数据库的问题,我只是简单地添加在Heroku PostgreSQL的插件并配置它的一切

+0

嘿,我有同样的问题。您提供的链接不再存在。心神更新,如果你有机会获得建设者包还是? –