How to switch a Heroku Application from MySql to PostgreSql
I am running my Heroku Application on MySql Database. Now i want to switch to the PostgreSql for some reason.For that i change database.yml and also change my migration files as required by PostgreSql. I also change DATABASE_URL and SHARED_DATABASE_URL for the same application. But when i go to the application it is getting crashed.
Heroku:logs showing following error
/disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks': can't activate rack (~> 1.0.0, runtime) for [], already activated rack-1.1.0 for ["thin-1.2.6"] (RuntimeError)
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/environment.rb:9
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/thin-1.2.6/lib/rack/adapter/rails.rb:42:in `load_application'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/thin-1.2.6/lib/rack/adapter/rails.rb:23:in `initialize'
from /home/heroku_rack/heroku.ru:29:in `new'
from /home/heroku_rack/heroku.ru:29
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:63:in `new'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:63:in `map'
from /home/heroku_rack/heroku.ru:18
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/heroku_rack/heroku.ru:11:in `new'
from /home/heroku_rack/heroku.ru:11
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/heroku_rack/heroku.ru:1:in `new'
from /home/heroku_rack/heroku.ru:1
==> dyno-1284675.log (crash) <==
/disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks': can't activate rack (~> 1.0.0, runtime) for [], already activated rack-1.1.0 for ["thin-1.2.6"] (RuntimeError)
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /disk1/home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/config/environment.rb:9
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/thin-1.2.6/lib/rack/adapter/rails.rb:42:in `load_application'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/thin-1.2.6/lib/rack/adapter/rails.rb:23:in `initialize'
from /home/heroku_rack/heroku.ru:29:in `new'-----> Heroku receiving push
-----> Rails app detected
Compiled slug size is 15.3MB
-----> Launching.... done
from /home/heroku_rack/heroku.ru:29
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:63:in `new'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:63:in `map'
from /home/heroku_rack/heroku.ru:18
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/heroku_rack/heroku.ru:11:in `new'
from /home/heroku_rack/heroku.ru:11
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/slugs/181380_0fa1c59_dfd1-7eadaa54-533c-4617-b1de-bf74852a7afe/mnt/.gems/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/heroku_rack/heroku.ru:1:in `new'
from /home/heroku_rack/heroku.ru:1
-----> An error happened during the initialization of your app.
This may be due to a typo, wrong number of arguments, or calling a
function that doesn't exist.
Make sure the app is working locally in production mode, by running it
with RAILS_ENV (for Rails apps) or RACK_ENV (for Sinatra or other rack
apps) set to production. e.g. RAILS_ENV=production script/server.
Examine the backtrace above this message to debug.
==> cron-2153255.log (crash) <==
(in /disk1/home/slugs/181380_b09ba5c_aaf3-ed376a4c-936a-459f-b8c8-3111c45124e1/mnt)
config.gem: Unpacked gem CVS in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem CVS in vendor/gems not in a versioned directory. Giving up.
rake aborted!
undefined method `serve_static_assets=' for #<Rails::Configuration:0x2aec8dff9cc8>
(See full trace by running 开发者_开发知识库task with --trace)
-----> Your application crashed.
Examine the backtrace above this message to debug.
I want Steps to be followed while switching through database for Heroku or how to avoid the above mentioned Error.
EDITED:-
my .gems file is as follows
rails -v 2.3.8
spreadsheet --version 0.6.4
spreadsheet-excel --version 0.3.5.1
rack --version 1.1.0
money --version 2.2.0
fastercsv --version 1.5.3
xml-mapping --version 0.8.1
It gives same error when i change 'rack --version 1.1.0' ot 'rack --version 1.0.0'
Regards,
Salil Gaikwad
I don't know why but it works after comment out following line in the config/environments/production.rb
config.serve_static_assets = true
Now i want to know is comment out above line occur some problem in future? AND what is the use of that code?
精彩评论