Как переключить приложение Heroku с MySql на PostgreSql - PullRequest
1 голос
/ 17 ноября 2010

Я использую приложение Heroku в базе данных MySql. Теперь я хочу по какой-то причине переключиться на PostgreSql. Для этого я изменяю database.yml, а также меняю файлы миграции в соответствии с требованиями PostgreSql. Я также изменяю DATABASE_URL и SHARED_DATABASE_URL для того же приложения. Но когда я захожу в приложение, оно падает.

Heroku: в журналах отображается следующая ошибка

/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.

Я хочу выполнить шаги при переключении через базу данных для Heroku или как избежать вышеупомянутой ошибки.

Редакция: -

мой файл .gems выглядит следующим образом

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

Выдает ту же ошибку, когда я изменяю 'rack - версия 1..0' 'OT' rack - версия 1.0.0 '

.

С уважением,

Салил Гайквад

1 Ответ

1 голос
/ 18 ноября 2010

Я не знаю, почему, но это работает после того, как закомментируйте следующую строку в config / средах / production.rb

config.serve_static_assets = true

Теперь я хочу знать, что за комментарием над строкой возникнут некоторые проблемы в будущем?И какая польза от этого кода?

...