upgrade procedure

Hi,

I have a site running older versions of Ruby and Rails. It's running Ruby 1.8.4 and Rails 1.2.2.

It's working fine, but I've set up a new desktop and now I need a development environment for it.

I look at the latest version of Ruby and Rails and it's not compatible, so I'm left with two choices.

1. Match the ruby and rails in production for now, while I plan for an upgrade. The only problem here is that I can't seem to find older releases of ruby on the ruby website, and the online documentation doesn't seem to track anything but the latest versions anyway.

2. Upgrade production to the latest, but I'm unsure of the best procedure to do this. Right now the current boot.rb and environment.rb files are not even compatible so I'm assuming that I'd start there.

So, what is the recommended upgrade procedure, and where do I find older copies of Ruby? I'm assuming that I can still find older copies of rails by specifying the version to gem install.

Thanks, Mike

msoulier wrote:

I look at the latest version of Ruby and Rails and it's not compatible, so I'm left with two choices.

El Goog will find you "ruby-1.8.4 tar.bz2". Remove your current Ruby and install that. You might then also need an older version of RubyGems.

Install the correct version of rails with

   sudo gem install rails -v=1.2.2

I have written up the instructions on upgrading rails before, and I will find them and blog about them now...

msoulier wrote:

So, what is the recommended upgrade procedure

Don't say I never did nothin' for ya!

   Radar – O’Reilly

Cool, thanks!

Mike

To add to the good advice you already got -- I would seriously think about creating a virtualized environment to replicate production's ruby/rails/gems setup rather than changing your desktop system's base install.

You might even create other VMs for the intermediate steps of the upgrade -- no unexpected conflicts, disposable when finished.

FWIW,

El Goog will find you "ruby-1.8.4 tar.bz2". Remove your current Ruby and install that. You might then also need an older version of RubyGems.

Unfortunately 1.8.4 wouldn't build on my current system. Looks like it died in the openssl code, something likely backwards-incompatible.

Install the correct version of rails with

sudo gem install rails -v=1.2.2

Yup, did that and grabbed sqlite3-ruby for development.

Unfortunately running ruby 1.8.7 with rails 1.2.2 on the existing site produces this

wrong number of arguments (2 for 1) /home/msoulier/work/bin/papproach/lib/ruby/1.8/cgi/session.rb:267:in `respond_to ?' /home/msoulier/work/bin/papproach/lib/ruby/1.8/cgi/session.rb:267:in `initialize ' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/cgi_process.rb:122:in `new' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/cgi_process.rb:122:in `session' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/cgi_process.rb:154:in `stale_session_check!' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/cgi_process.rb:109:in `session' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/base.rb:1052:in `assign_shortcuts_without_flash' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/flash.rb:140:in `assign_shortcuts' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/base.rb:424:in `process_without_filters' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/filters.rb:624:in `process_without_session_management_support' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/session_management.rb:114:in `process' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/a ction_controller/base.rb:330:in `process' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/dispatc her.rb:41:in `dispatch' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/webrick _server.rb:113:in `handle_dispatch' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/webrick _server.rb:79:in `service' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/httpserver.rb: 104:in `ser vice' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/httpserver.rb: 65:in `run' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb: 173:in `start_thread' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb: 162:in `start' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb: 162:in `start_thread' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb:95:in `start' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb:92:in `each' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb:92:in `start' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb:23:in `start' /home/msoulier/work/bin/papproach/lib/ruby/1.8/webrick/server.rb:82:in `start' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/webrick_server.rb:63:in `dispatch' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/commands/servers/webrick.rb:59 /home/msoulier/work/bin/papproach/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require__' /home/msoulier/work/bin/papproach/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:495:in `require' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:342:in `new_constants_in' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:495:in `require' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/rails-1.2.2/ lib/commands/server.rb:39 /home/msoulier/work/bin/papproach/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require__' /home/msoulier/work/bin/papproach/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:495:in `require' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:342:in `new_constants_in' /home/msoulier/work/bin/papproach/lib/ruby/gems/1.8/gems/ activesupport-1.4.1/lib/active_support/dependencies.rb:495:in `require' script/server:3

Obviously some incompatibility here...

Mike

msoulier wrote:

Unfortunately 1.8.4 wouldn't build on my current system. Looks like it died in the openssl code, something likely backwards-incompatible.

Post the error - it's probably just a missing openssl-dev package.

Obviously some incompatibility here...

1.8.7 is too big a leap over 1.8.6 - try that.

But stop screwing with your production server to try things!

Post the error - it's probably just a missing openssl-dev package.

I don't think so since 1.8.7 builds fine. My desktop is gentoo so there are no dev packages, it's all here.

1.8.7 is too big a leap over 1.8.6 - try that.

Ok, but I'm curious as to what the problem is...

I think it's the bootstrap and environment code. I'm not sure that copying all of that into the web app is such a good idea.

But stop screwing with your production server to try things!

That's a joke right? No way do I touch production. That's why I'm trying to recreate production on my desktop.

I'm thinking of a new O'Reilly book. "Maintaining Rails applications in the real world".

Mike

As requested. Looks like an api change in openssl to me.

compiling openssl make[1]: Entering directory `/home/msoulier/temp/ruby-1.8.4/ext/ openssl' gcc -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/openssl - DHAVE_UNISTD_H -DHAVE_SYS_TIME_H -DHAVE_ASSERT_H -DHAVE_OPENSSL_SSL_H - DHAVE_OPENSSL_CONF_API_H -DHAVE_ERR_PEEK_LAST_ERROR -DHAVE_BN_MOD_ADD - DHAVE_BN_MOD_SQR -DHAVE_BN_MOD_SUB -DHAVE_BN_PSEUDO_RAND_RANGE - DHAVE_BN_RAND_RANGE -DHAVE_CONF_GET1_DEFAULT_CONFIG_FILE - DHAVE_EVP_CIPHER_CTX_SET_PADDING -DHAVE_EVP_CIPHERFINAL_EX - DHAVE_EVP_CIPHERINIT_EX -DHAVE_EVP_DIGESTFINAL_EX - DHAVE_EVP_DIGESTINIT_EX -DHAVE_EVP_MD_CTX_CLEANUP - DHAVE_EVP_MD_CTX_CREATE -DHAVE_EVP_MD_CTX_DESTROY - DHAVE_EVP_MD_CTX_INIT -DHAVE_HMAC_CTX_CLEANUP -DHAVE_HMAC_CTX_INIT - DHAVE_PEM_DEF_CALLBACK -DHAVE_X509V3_SET_NCONF - DHAVE_X509V3_EXT_NCONF_NID -DHAVE_X509_CRL_ADD0_REVOKED - DHAVE_X509_CRL_SET_ISSUER_NAME -DHAVE_X509_CRL_SET_VERSION - DHAVE_X509_CRL_SORT -DHAVE_OPENSSL_CLEANSE -DHAVE_VA_ARGS_MACRO - DHAVE_OPENSSL_ENGINE_H -DHAVE_ENGINE_ADD - DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DHAVE_ENGINE_GET_DIGEST - DHAVE_ENGINE_GET_CIPHER -DHAVE_ENGINE_CLEANUP -DHAVE_OPENSSL_OCSP_H - DHAVE_ST_FLAGS -DHAVE_ST_ENGINE -DHAVE_ST_SINGLE -c ossl_ocsp.c In file included from ossl.h:190,                  from ossl_ocsp.c:12: openssl_missing.h:119: error: conflicting types for 'BN_rand_range' /usr/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.h:120: error: conflicting types for 'BN_pseudo_rand_range' /usr/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here ossl_ocsp.c: In function 'ossl_ocspreq_initialize': ossl_ocsp.c:114: warning: passing argument 2 of 'd2i_OCSP_REQUEST' from incompatible pointer type ossl_ocsp.c: In function 'ossl_ocspres_initialize': ossl_ocsp.c:321: warning: passing argument 2 of 'd2i_OCSP_RESPONSE' from incompatible pointer type make[1]: *** [ossl_ocsp.o] Error 1 make[1]: Leaving directory `/home/msoulier/temp/ruby-1.8.4/ext/ openssl' make: *** [all] Error 1

Mike

msoulier wrote:

I don't think so since 1.8.7 builds fine. My desktop is gentoo so there are no dev packages, it's all here.

Post the error. And can this gentoo thing get an older openssl and put it where Ruby 1.8.4 can find it?

But stop screwing with your production server to try things!

That's a joke right? No way do I touch production. That's why I'm trying to recreate production on my desktop.

Did not read closely.

I'm thinking of a new O'Reilly book. "Maintaining Rails applications in the real world".

Yay. Ain't gonna write it! Too busy maintaining Rails apps in the real world.

Oh, and Rails 3 is secretly gonna be Merb configured to look like Rails. Joy. If too few established rails sites use it (like >100,000 users), then maybe Rails 2 will never go out of maintenance, despite my blog entry!

Post the error. And can this gentoo thing get an older openssl and put it where Ruby 1.8.4 can find it?

I'll have to investigate. It's running openssl 0.9.8j, which is likely too new for the older ruby.

Maybe it's just time to upgrade everything and once I figure out the steps, do it in production.

Yay. Ain't gonna write it! Too busy maintaining Rails apps in the real world.

:slight_smile: I Just wish all the Rails books I read mentioned how difficult this kind of thing can be. They always make working with these new frameworks look so attractive without mentioning that if you don't move forward in production quickly enough then you'll find yourself left behind.

Oh, and Rails 3 is secretly gonna be Merb configured to look like Rails. Joy. If too few established rails sites use it (like >100,000 users), then maybe Rails 2 will never go out of maintenance, despite my blog entry!

Hmm. Django anyone? :wink:

Mike

msoulier wrote:

openssl_missing.h:119: error: conflicting types for 'BN_rand_range' /usr/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here openssl_missing.h:120: error: conflicting types for 'BN_pseudo_rand_range'

If I were on my own notebook, I would just pick one of those header files and edit it.

The point is C++ "recently" (meaning "recently" in glacial C++ time) became more restrictive around pointer types. Foo * cannot silently cast to Foo const * anymore, despite the latter is more restrictive. So one function prototype cannot match the other.

But the linker can't see these details, so if you just tweak the headers, the compiler was the last chance to catch this non-error, and if you thwart it, you will have your executables.

Or you could try the next tick of Ruby & the next tick of Rails...

As it turns out I don't need openssl support for this site, so I deleted the openssl extension and built without it.

I still need an upgrade strategy, but now I can work on that and maintain the site too.

Thanks, Mike

msoulier wrote:

I still need an upgrade strategy, but now I can work on that and maintain the site too.

Can you try the cycle I blogged about?