2017-08-31 123 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

嘿,我有同樣的問題。您提供的鏈接不再存在。心神更新,如果你有機會獲得建設者包還是? –