Upgrade Ruby to 2.0 (better do not use Ruby 2.0)

Added by Alex Guzun about 6 years ago

Hi all
now we have redmine 2.3 on ruby 1.8.7, i want to upgrade to latest ruby (1.8.7 is faulting from time ti time, making redmine unavailable).
What are the steps? Just uninstall old and install new?

Thank you

Replies (17)

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

as always all went down :(

So i started with fresh ruby2, install it, then installed DevKit.
bundle update went ok

C:\redmine>gem list

  • LOCAL GEMS ***

actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.2)
bigdecimal (1.2.0)
builder (3.0.0)
bundler (1.3.5)
coderay (1.0.9)
erubis (2.7.0)
hike (1.2.2)
i18n (0.6.1)
io-console (0.4.2)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.7.7)
mail (2.5.3)
mime-types (1.23)
minitest (4.3.2)
multi_json (1.7.2)
mysql (2.8.1 x86-mingw32)
net-ldap (0.3.1)
pg (0.15.1 x86-mingw32)
polyglot (0.3.3)
psych (2.0.0)
rack (1.4.5)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.0.4, 0.9.6)
rdiscount (2.0.7.2)
rdoc (4.0.0, 3.12.2)
ruby-openid (2.1.8)
sprockets (2.2.2)
sqlite3 (1.3.7 x86-mingw32)
test-unit (2.0.0.0)
thor (0.18.1)
tilt (1.3.7)
treetop (1.4.12)
tzinfo (0.3.37)

But rake db:migrate give me strange error

C:\redmine>rake db:migrate RAILS_ENV=production
rake aborted!
cannot load such file -- 2.0/mysql_api
C:/redmine/config/application.rb:7:in `<top (required)>'
C:/redmine/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

i have mysql gem and why it looks for 2.0 folder?

How to fix it, please?

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

if i rename c:\Ruby\lib\ruby\gems\2.0.0\ to c:\Ruby\lib\ruby\gems\2.0\

i have this

C:\redmine>rake db:migrate RAILS_ENV=production
C:/Ruby/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 0 total gem(s) (Gem::LoadError)
        from C:/Ruby/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
        from C:/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
        from C:/Ruby/bin/rake:22:in `<main>'

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

C:\redmine>rake db:migrate RAILS_ENV=production  --trace
rake aborted!
cannot load such file -- 2.0/mysql_api
C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `require'
C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `rescue in <top (required)>'
C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
C:/redmine/config/application.rb:7:in `<top (required)>'
C:/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/redmine/Rakefile:5:in `<top (required)>'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
C:/Ruby/lib/ruby/gems/2.0.0/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
C:/Ruby/bin/rake:23:in `load'
C:/Ruby/bin/rake:23:in `<main>'

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

The following DOESNT WORK either

gem uninstall mysql2
Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip
Extract it to C:\connector-6.0.2
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\connector-6.0.2"'

coz

C:\redmine>rake db:migrate RAILS_ENV=production
Could not find mysql-2.8.1-x86-mingw32 in any of the sources
Run `bundle install` to install missing gems.

RE: Upgrade Ruby to 2.0 - Added by Anonymous about 6 years ago

Hi,

you need to uninstall mysql (not mysql2 because in your database adapter database.yml mysql2 is needed). Then re-run bundle install (maybe without test development and without rmagick).

The installation of mysql2 as you pointed out above worked for me. the bundler will use the preinstalled mysql2 gem.

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

same problem after this, please check (why Gems in the groups development, test and rmagick were not installed.)

C:\redmine>gem uninstall mysql
Successfully uninstalled mysql-2.8.1-x86-mingw32

C:\redmine>gem uninstall mysql2
Successfully uninstalled mysql2-0.3.11

C:\redmine>gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-m
ysql-dir="C:\connector-6.0.2"'
Fetching: mysql2-0.3.11.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\con
nector-6.0.2"'
This could take a while...
Successfully installed mysql2-0.3.11
Parsing documentation for mysql2-0.3.11
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skipping
Installing ri documentation for mysql2-0.3.11
Done installing documentation for mysql2 (0 sec).
1 gem installed

C:\redmine>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.7.2)
Using activesupport (3.2.13)
Using builder (3.0.0)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.2)
Using tilt (1.3.7)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.5.3)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using coderay (1.0.9)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.13)
Using jquery-rails (2.0.3)
Installing mysql (2.8.1)
Using net-ldap (0.3.1)
Using pg (0.15.1)
Using ruby-openid (2.1.8)
Using rack-openid (1.3.1)
Using bundler (1.3.5)
Using rails (3.2.13)
Using sqlite3 (1.3.7)
Your bundle is complete!
*Gems in the groups development, test and rmagick were not installed.*
Use `bundle show [gemname]` to see where a bundled gem is installed.

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

actual list

C:\redmine>gem list

*** LOCAL GEMS ***

actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.2)
bigdecimal (1.2.0)
builder (3.0.0)
bundler (1.3.5)
coderay (1.0.9)
erubis (2.7.0)
hike (1.2.2)
i18n (0.6.1)
io-console (0.4.2)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.7.7)
mail (2.5.3)
mime-types (1.23)
minitest (4.3.2)
multi_json (1.7.2)
mysql (2.8.1 x86-mingw32)
mysql2 (0.3.11)
net-ldap (0.3.1)
pg (0.15.1 x86-mingw32)
polyglot (0.3.3)
psych (2.0.0)
rack (1.4.5)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.0.4, 0.9.6)
rdiscount (2.0.7.2)
rdoc (4.0.0, 3.12.2)
ruby-openid (2.1.8)
sprockets (2.2.2)
sqlite3 (1.3.7 x86-mingw32)
test-unit (2.0.0.0)
thor (0.18.1)
tilt (1.3.7)
treetop (1.4.12)
tzinfo (0.3.37)

RE: Upgrade Ruby to 2.0 - Added by Anonymous about 6 years ago

Is your database.yml adopted to mysql2?

development:
* adapter: mysql2 *
  database: redmine_development
  host: 127.0.0.1
  username: root
  password: "" 
  encoding: utf8

esp. the mysql2 is important
otherwise the bundler will not detect the mysql2 gem.

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

this is mine yml

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: "" 
  encoding: utf8

RE: Upgrade Ruby to 2.0 - Added by Anonymous about 6 years ago

Hello,

your bundler needs to parse your database.yml. Then it should recognize the use of mysql2.

Unless bundle install does not say "Using mysql2 (x.x.x)" your installation will not work.

I'm afraid i don't know why the bundler does not find your db adapter.

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

strange.. im stuck again
what should i do, now, please?

RE: Upgrade Ruby to 2.0 - Added by Alex Guzun about 6 years ago

from my point of view Ruby 2.0 is not compatible with current redmine.
Saw mysql problems reported on github from other app, using ruby 2.0
Installed Ruby 1.9.3 and all wen fine withing 5 minutes.

Environment:
Redmine version 2.3.0.devel.11744
Ruby version 1.9.3 (i386-mingw32)
Rails version 3.2.13
Environment production
Database adapter MySQL

RE: Upgrade Ruby to 2.0 - Added by Etienne Massip about 6 years ago

Alex Guzun wrote:

from my point of view Ruby 2.0 is not compatible with current redmine.

It is, build is all green.

You have to use mysql2 gem indeed ; the database.yml excerpt you provided is relative to the development environment and you're running db migration on production.

In last resort, there are notes in mysql2 gem changelog indicating that you might be luckier with beta (use gem install mysql2 --pre).

Delete your Gemfile.lock and .bundle before running bundle install --without test dev rmagick or it will keep your --without previous settings.

If you want to see your bundle content, use bundle show, gem list will show all your gems installed.

RE: Upgrade Ruby to 2.0 (better do not use Ruby 2.0) - Added by Alex Guzun about 6 years ago

i might try it later, thank you for clarification

RE: Upgrade Ruby to 2.0 (better do not use Ruby 2.0) - Added by Paresh Patel about 6 years ago

hi,
your problem best solution is using turnkey redmine install then your old redmime database backup create then restore in turnkey redmine

turnkey redmine offical website download iso source then install in separted system this source is bootable os

RE: Upgrade Ruby to 2.0 (better do not use Ruby 2.0) - Added by Alex Guzun about 6 years ago

probably yes,
but recently i got another problem (dont know what it is caused by)

some pages cant be accessed - Internal Error

Started GET "/projects/tt/issues" for 10.0.0.147 at 2013-04-29 16:21:39 +0200
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"tt"}
  Current user: admin (id=1)
  Rendered queries/_filters.html.erb (31.2ms)
  Rendered queries/_columns.html.erb (4.9ms)
  Rendered issues/_list.html.erb (60.5ms)
  Rendered issues/index.html.erb within layouts/base (211.8ms)
Completed 500 Internal Server Error in 315ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    59: <% if @issues.empty? %>
    60: <p class="nodata"><%= l(:label_no_data) %></p>
    61: <% else %>
    62: <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
    63: <p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
    64: <% end %>
    65: 
  app/views/issues/index.html.erb:62:in `_app_views_issues_index_html_erb__737447811_55178040'
  app/controllers/issues_controller.rb:83:in `block (2 levels) in index'
  app/controllers/issues_controller.rb:82:in `index'

somehting like http://www.redmine.org/boards/1/topics/36573
but im on windows and i didnt change DB, just updated redmine and played with ruby.

Thanks for any tip
Alex

RE: Upgrade Ruby to 2.0 (better do not use Ruby 2.0) - Added by Alex Guzun about 6 years ago

fixed:
uninstalled mysql and installed myswl2 gem
ten edited database.yml file
running server 2008r2, so you need to change localhost to 127.0.0.1 in config file (as it is stated in Install guide)

Important note for Win7 and later
On Win7 and later, localhost is commented out in the hosts file1 and IPV6 is the default2. As the mysql2 gem does no support IPV6 addresses3, a connection can't be established and you get the error "Can't connect to MySQL server on 'localhost' (10061)".
You can confirm this by pinging localhost, if ping targets "::1:" IPV6 is being used.

Workaround:
Replace localhost with 127.0.0.1 in database.yml.

1 http://serverfault.com/questions/4689/windows-7-localhost-name-resolution-is-handled-within-dns-itself-why
2 http://www.victor-ratajczyk.com/post/2012/02/25/mysql-fails-to-resolve-localhost-disable-ipv6-on-windows.aspx
3 https://github.com/brianmario/mysql2/issues/279

(1-17/17)