ruby on rails - Pushing to Heroku failed after adding new gems for postgresql and installing bundle -
when trying push heroku master, after installing gem needed postgresql heroku not recognise sqlite3, failed precompile assets , compile application. following online guide deploy heroku: http://jgtr.github.io/blog/2013/07/28/deploying-a-sqlite3-database-to-heroku-for-production-using-postgres/
any ideas problem?
git push heroku master counting objects: 2287, done. delta compression using 4 threads. compressing objects: 100% (1951/1951), done. writing objects: 100% (2287/2287), 17.77 mib | 17.00 kib/s, done. total 2287 (delta 534), reused 0 (delta 0) remote: compressing source files... done. remote: building source: remote: remote: -----> ruby app detected remote: -----> compiling ruby/rails remote: -----> using ruby version: ruby-2.2.1 remote: -----> installing dependencies using bundler 1.9.7 remote: running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: fetching gem metadata https://rubygems.org/......... remote: fetching version metadata https://rubygems.org/... remote: fetching dependency metadata https://rubygems.org/.. remote: using rake 10.4.2 remote: installing minitest 5.8.3 remote: installing i18n 0.7.0 remote: installing thread_safe 0.3.5 remote: installing builder 3.2.2 remote: installing mini_portile2 2.0.0 remote: installing erubis 2.7.0 remote: installing rack 1.6.4 remote: installing mime-types 2.99 remote: installing json 1.8.3 remote: installing arel 6.0.3 remote: installing addressable 2.3.8 remote: installing execjs 2.6.0 remote: installing thor 0.19.1 remote: installing sass 3.4.19 remote: installing coffee-script-source 1.10.0 remote: installing multipart-post 2.0.0 remote: installing concurrent-ruby 1.0.0 remote: installing hashie 3.4.3 remote: installing high_voltage 2.4.0 remote: installing multi_json 1.11.2 remote: installing jwt 1.5.2 remote: using bundler 1.9.7 remote: installing multi_xml 0.5.5 remote: installing tilt 2.0.1 remote: installing tzinfo 1.2.2 remote: installing rack-test 0.6.3 remote: installing mail 2.6.3 remote: installing autoprefixer-rails 6.1.2 remote: installing uglifier 2.7.2 remote: installing select2-rails 4.0.0 remote: installing coffee-script 2.4.1 remote: installing faraday 0.9.2 remote: installing sprockets 3.5.0 remote: installing omniauth 1.2.2 remote: installing activesupport 4.2.1 remote: installing bootstrap-sass 3.3.6 remote: installing koala 2.2.0 remote: installing oauth2 1.0.0 remote: installing pg 0.18.4 remote: installing rails-deprecated_sanitizer 1.0.3 remote: installing globalid 0.3.6 remote: installing activemodel 4.2.1 remote: installing jbuilder 2.3.2 remote: installing omniauth-oauth2 1.4.0 remote: installing activejob 4.2.1 remote: installing activerecord-postgresql-adapter 0.0.1 remote: installing omniauth-facebook 3.0.0 remote: installing activerecord 4.2.1 remote: installing nokogiri 1.6.7 remote: installing loofah 2.0.3 remote: installing rails-dom-testing 1.0.7 remote: installing rails-html-sanitizer 1.0.2 remote: installing actionview 4.2.1 remote: installing actionpack 4.2.1 remote: installing sprockets-rails 2.3.3 remote: installing actionmailer 4.2.1 remote: installing railties 4.2.1 remote: installing bootstrap-datepicker-rails 1.5.0 remote: installing simple_form 3.2.0 remote: installing bootstrap-generators 3.3.4 remote: installing bootstrap-typeahead-rails 0.10.5.1 remote: installing chart-js-rails 0.0.9 remote: installing coffee-rails 4.1.0 remote: installing jquery-rails 4.0.5 remote: installing rails 4.2.1 remote: installing sass-rails 5.0.4 remote: bundle complete! 27 gemfile dependencies, 67 gems installed. remote: gems in groups development , test not installed. remote: bundled gems installed ./vendor/bundle. remote: bundle completed (26.34s) remote: cleaning bundler cache. remote: -----> preparing app rails asset pipeline remote: running: rake assets:precompile remote: rake aborted! remote: nomethoderror: undefined method `configure' main:object remote: /tmp/build_1a115f32b847c2bee80ca9efb3688741/config/environment.rb:7:in `<top (required)>' remote: /tmp/build_1a115f32b847c2bee80ca9efb3688741/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require' remote: /tmp/build_1a115f32b847c2bee80ca9efb3688741/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require_environment!' remote: /tmp/build_1a115f32b847c2bee80ca9efb3688741/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:457:in `block in run_tasks_blocks' remote: /tmp/build_1a115f32b847c2bee80ca9efb3688741/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define' remote: tasks: top => environment remote: (see full trace running task --trace) remote: ! remote: ! precompiling assets failed. remote: ! remote: remote: ! push rejected, failed compile ruby app remote: remote: verifying deploy.... remote: remote: ! push rejected nokorupsi. remote: https://git.heroku.com/nokorupsi.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed push refs 'https://git.heroku.com/nokorupsi.git' this gemfile (i updated gemfile.lock through bundle install already, gems should installed right):
source 'https://rubygems.org' ruby '2.2.1' gem 'rails', '4.2.1' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' gem 'jbuilder', '~> 2.0' group :development, :test gem 'byebug' gem 'web-console', '~> 2.0' gem 'spring' end gem 'bootstrap-sass' gem 'high_voltage' gem 'omniauth' gem 'omniauth-facebook' gem 'simple_form' group :development gem 'better_errors' gem 'hub', :require=>nil gem 'quiet_assets' gem 'rails_layout' gem 'sqlite3' end group :production gem 'pg' gem "activerecord-postgresql-adapter" end gem 'koala' gem 'bootstrap-generators', '~> 3.3.4' gem "select2-rails" gem 'bootstrap-typeahead-rails' gem 'bootstrap-datepicker-rails' gem 'chart-js-rails' this database.yml in config directory:
# sqlite version 3.x # gem install sqlite3 # # ensure sqlite 3 gem defined in gemfile # gem 'sqlite3' # default: &default # adapter: sqlite3 # pool: 5 # timeout: 5000 development: adapter: sqlite3 database: database.db # <<: *default # database: db/development.sqlite3 # warning: database defined "test" erased , # re-generated development database when run "rake". # not set db same development or production. test: adapter: sqlite3 database: database.db # <<: *default # database: db/test.sqlite3 production: adapter: postgresql database: nokorupsi username: username password: password host: localhost # <<: *default # database: db/production.sqlite3 this application.rb in config directory:
require file.expand_path('../boot', __file__) require 'rails/all' # require gems listed in gemfile, including gems # you've limited :test, :development, or :production. bundler.require(*rails.groups) module merdekahack class application < rails::application # settings in config/environments/* take precedence on specified here. # application configuration should go files in config/initializers # -- .rb files in directory automatically loaded. # set time.zone default specified zone , make active record auto-convert zone. # run "rake -d time" list of tasks finding time zone names. default utc. # config.time_zone = 'central time (us & canada)' # default locale :en , translations config/locales/*.rb,yml auto loaded. # config.i18n.load_path += dir[rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de # not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end end this environment.rb in config directory:
# load rails application. require file.expand_path('../application', __file__) # initialize rails application. rails.application.initialize! this development.rb in environments folder in config directory:
rails.application.configure # settings specified here take precedence on in config/application.rb. # in development environment application's code reloaded on # every request. slows down response time perfect development # since don't have restart web server when make code changes. config.cache_classes = false # not eager load code on boot. config.eager_load = false # show full error reports , disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # don't care if mailer can't send. config.action_mailer.raise_delivery_errors = false # print deprecation notices rails logger. config.active_support.deprecation = :log # raise error on page load if there pending migrations. config.active_record.migration_error = :page_load # debug mode disables concatenation , preprocessing of assets. # option may cause significant delays in view rendering large # number of complex assets. config.assets.debug = true # asset digests allow set far-future http expiration dates on assets, # yet still able expire them through digest params. config.assets.digest = true # adds additional error checking when serving assets @ runtime. # checks improperly declared sprockets dependencies. # raises helpful error messages. config.assets.raise_runtime_errors = true # raises error missing translations # config.action_view.raise_on_missing_translations = true # database development set :database, "sqlite3:///database.db" end this production.rb in same environments folder in config directory:
rails.application.configure # settings specified here take precedence on in config/application.rb. # code not reloaded between requests. config.cache_classes = true # eager load code on boot. eager loads of rails , # application in memory, allowing both threaded web servers # , relying on copy on write perform better. # rake tasks automatically ignore option performance. config.eager_load = true # full error reports disabled , caching turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # enable rack::cache put simple http cache in front of application # add `rack-cache` gemfile before enabling this. # large-scale production use, consider using caching reverse proxy # nginx, varnish or squid. # config.action_dispatch.rack_cache = true # disable serving static files `/public` folder default since # apache or nginx handles this. config.serve_static_files = env['rails_serve_static_files'].present? # compress javascripts , css. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # not fallback assets pipeline if precompiled asset missed. config.assets.compile = false # asset digests allow set far-future http expiration dates on assets, # yet still able expire them through digest params. config.assets.digest = true # `config.assets.precompile` , `config.assets.version` have moved config/initializers/assets.rb # specifies header server uses sending files. # config.action_dispatch.x_sendfile_header = 'x-sendfile' # apache # config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # nginx # force access app on ssl, use strict-transport-security, , use secure cookies. # config.force_ssl = true # use lowest log level ensure availability of diagnostic information # when problems arise. config.log_level = :debug # prepend log lines following tags. # config.log_tags = [ :subdomain, :uuid ] # use different logger distributed setups. # config.logger = activesupport::taggedlogging.new(sysloglogger.new) # use different cache store in production. # config.cache_store = :mem_cache_store # enable serving of images, stylesheets, , javascripts asset server. # config.action_controller.asset_host = 'http://assets.example.com' # ignore bad email addresses , not raise email delivery errors. # set true , configure email server immediate delivery raise delivery errors. # config.action_mailer.raise_delivery_errors = false # enable locale fallbacks i18n (makes lookups locale fall # i18n.default_locale when translation cannot found). config.i18n.fallbacks = true # send deprecation notices registered listeners. config.active_support.deprecation = :notify # use default logging formatter pid , timestamp not suppressed. config.log_formatter = ::logger::formatter.new # not dump schema after migrations. config.active_record.dump_schema_after_migration = false # connecting postgresql db = uri.parse(env['postgres://iqwljiwwoqdysd:qzgrggaski_smyssp4dcabr8km@ec2-54-83-61-45.compute-1.amazonaws.com:5432/dde6roet07bko1'] || 'postgres://localhost/mydb') activerecord::base.establish_connection( :adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme, :host => db.host, :username => db.user, :password => db.password, :database => db.path[1..-1], :encoding => 'utf8' ) end
remove the: gem "activerecord-postgresql-adapter" production , try again.
Comments
Post a Comment