将Ruby站点从EngineYard迁移到Heroku

时间:2012-06-25 15:08:10

标签: ruby-on-rails ruby heroku refinerycms engineyard

作为一个大型项目的一部分,我的任务是迁移一些现有的Ruby on Rails站点(使用旧版本的refinerycms 0.9.6.34构建,至少这是源代码中包含的Gemfile中列出的版本)。我通常不会使用Ruby,所以我有点亏。以前的开发人员只需移交最新的git转储以及数据库转储。

我正在努力让网站在Ubuntu 11.10本地计算机上本地工作,然后再进行测试Heroku安装。如果可以直接使用他们提供的文件直接推送到Heroku,那么我可以试试,但我的理解是我需要让一切正常工作,然后使用Heroku的工具进行部署。

之前的开发者说他们正在使用ruby 1.8.7,所以在Ubuntu中我做了以下工作:

aptitude install ruby1.8 ruby1.8-dev ruby1.8-full
aptitude install rubygems1.8

我已经恢复了数据库,在config目录中我对database.yml进行了更改,指向已恢复的数据库。

当我尝试从提取的源目录的根目录运行“bundle install”时,我得到:

Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mime-types-1.18.gemspec]: invalid date format in specification: "2012-03-21 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mime-types-1.18.gemspec]: invalid date format in specification: "2012-03-21 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mime-types-1.18.gemspec]: invalid date format in specification: "2012-03-21 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Installing tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.3)
Installing mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Installing mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Using acts_as_indexed (0.7.8)
Using awesome_nested_set (2.1.3)
Using babosa (0.3.7)
Using bcrypt-ruby (3.0.1)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using coffee-rails (3.2.2)
Using orm_adapter (0.0.7)
Using warden (1.1.1)
Using devise (2.0.4)
Using dragonfly (0.9.12)
Using friendly_id (4.0.6)
Using paper_trail (2.6.3)
Using globalize3 (0.2.0)
Installing jquery-rails (2.0.2)
Using bundler (1.1.4)
Using rails (3.2.3)
Using sass (3.1.19)
Installing sass-rails (3.2.5)
Using truncate_html (0.5.5)
Using uglifier (1.2.4)
Using will_paginate (3.0.3)
Using refinerycms-core (2.0.4)
Using refinerycms-authentication (2.0.4)
Using refinerycms-dashboard (2.0.4)
Using refinerycms-images (2.0.4)
Using seo_meta (1.3.0)
Using refinerycms-pages (2.0.4)
Using refinerycms-resources (2.0.4)
Using refinerycms (2.0.4)
Using routing-filter (0.3.1)
Using refinerycms-i18n (2.0.0)
Using sqlite3 (1.3.6)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

显然,无效gemspec的错误需要解决,但另一件让我感到不安的是:

Using refinerycms-core (2.0.4)
Using refinerycms-authentication (2.0.4)
Using refinerycms-dashboard (2.0.4)
Using refinerycms-images (2.0.4)
Using seo_meta (1.3.0)
Using refinerycms-pages (2.0.4)
Using refinerycms-resources (2.0.4)
Using refinerycms (2.0.4)
Using routing-filter (0.3.1)
Using refinerycms-i18n (2.0.0)

由于Gemfile中列出的refinerycms版本是0.9.6.34。

说到Ruby世界,我有点失落,所以任何帮助都会受到高度赞赏。

谢谢,

更新 根据要求,gemfile看起来像:

source 'http://rubygems.org'

gem 'refinerycms', '= 0.9.6.34'
gem 'rails', '~> 2.3.14'

gem 'mysql2', '~> 0.2.18'

gem 'hpricot'
gem 'rmagick', '= 2.12.2'

此外,这是Gemfile.lock文件中的内容:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.3)
      actionpack (= 4.2.3)
      mail (~> 2.4.4)
    actionpack (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
    activerecord (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
    activesupport (3.2.3)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    acts_as_indexed (0.7.8)
    arel (3.0.2)
    awesome_nested_set (2.1.3)
      activerecord (>= 3.0.0)
    babosa (0.3.7)
    bcrypt-ruby (3.0.1)
    builder (3.0.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    devise (2.0.4)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.3)
      railties (~> 3.1)
      warden (~> 1.1.1)
    dragonfly (0.9.12)
      rack
    erubis (2.7.0)
    execjs (1.4.0)
      multi_json (~> 1.0)
    friendly_id (4.0.6)
    globalize3 (0.2.0)
activemodel (>= 3.0.0)
      activerecord (>= 3.0.0)
      paper_trail (~> 2)
    hike (1.2.1)
    i18n (0.6.0)
    journey (1.0.3)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.3)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.18)
    multi_json (1.3.6)
    orm_adapter (0.0.7)
    paper_trail (2.6.3)
      activerecord (~> 3.0)
      railties (~> 3.0)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.3)
      actionmailer (= 3.2.3)
      actionpack (= 3.2.3)
      activerecord (= 3.2.3)
      activeresource (= 3.2.3)
      activesupport (= 3.2.3)
      bundler (~> 1.0)
      railties (= 3.2.3)
    railties (3.2.3)
      actionpack (= 3.2.3)
      activesupport (= 3.2.3)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    refinerycms (2.0.4)
      bundler (~> 1.0)
      refinerycms-authentication (= 2.0.4)
      refinerycms-core (= 2.0.4)
      refinerycms-dashboard (= 2.0.4)
      refinerycms-images (= 2.0.4)
      refinerycms-pages (= 2.0.4)
      refinerycms-resources (= 2.0.4)
    refinerycms-authentication (2.0.4)
      devise (~> 2.0.0)
      orm_adapter (~> 0.0.7)
      refinerycms-core (= 2.0.4)
    refinerycms-core (2.0.4)
      acts_as_indexed (~> 0.7.7)
      awesome_nested_set (~> 2.1.3)
      coffee-rails (~> 3.2.1)
      friendly_id (~> 4.0.1)
      globalize3 (~> 0.2.0)
      jquery-rails (~> 2.0.0)
      rails (>= 3.1.3, < 3.3)
      sass-rails (~> 3.2.3)
      truncate_html (~> 0.5)
      uglifier (>= 1.0.3)
      will_paginate (~> 3.0.2)
    refinerycms-dashboard (2.0.4)
      refinerycms-core (= 2.0.4)
   refinerycms-i18n (2.0.0)
      refinerycms-core (~> 2.0.0)
      routing-filter (>= 0.2.3)
    refinerycms-images (2.0.4)
      dragonfly (~> 0.9.8)
      rack-cache (>= 0.5.3)
      refinerycms-core (= 2.0.4)
    refinerycms-pages (2.0.4)
      awesome_nested_set (~> 2.1.3)
      babosa (!= 0.3.6)
      refinerycms-core (= 2.0.4)
      seo_meta (~> 1.3.0)
    refinerycms-resources (2.0.4)
      dragonfly (~> 0.9.8)
      rack-cache (>= 0.5.3)
      refinerycms-core (= 2.0.4)
    routing-filter (0.3.1)
      actionpack
    sass (3.1.19)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    seo_meta (1.3.0)
      railties (>= 3.0.0)
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.6)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    truncate_html (0.5.5)
    tzinfo (0.3.33)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    warden (1.1.1)
      rack (>= 1.0)
    will_paginate (3.0.3)

PLATFORMS
  ruby

DEPENDENCIES
  coffee-rails (~> 3.2.1)
  jquery-rails
  rails (= 3.2.3)
  refinerycms (~> 2.0.0)
  refinerycms-i18n (~> 2.0.0)
  sass-rails (~> 3.2.3)
  sqlite3
  uglifier (>= 1.0.3)

2 个答案:

答案 0 :(得分:0)

您可以放心地忽略无效的gemspec错误,它只是一个不会影响您的日期格式问题。关于gem版本,你可以发布你的Gemfile的内容吗?我认为这只是在你的宝石旁边放一个版本的问题。见http://gembundler.com/gemfile.html

编辑:我不确定这会解决问题,但您应该删除Gemfile中的=。以下是它的外观:

enter code here gem&#39; refinerycms&#39;,&#39; 0.9.6.34&#39;

对于您使用此语法的其他宝石也是如此

答案 1 :(得分:0)

有几个因素需要考虑:

1)Ruby版本:确保Heroku设置使用1.8.7,以便您可以“按原样”复制当前系统。 Heroku(Cedar)的“当前”堆栈使用的是1.9.3,因此请确保获得仍支持ruby 1.8.7的较旧的heroku堆栈。 确保安装并开始使用RVM来管理ruby版本。这是大多数人使用的,强烈建议避免痛苦的问题。

2)Rails版本:我看到你的Gemfile列表中列出了Rails 2.3.2。这是一个非常“当前”版本的rails,非常棒。你应该知道,有了这个,或者下一个次要版本的rails,Ruby 1.8.7将不受支持(它在开源领域相当'老'),所以你还需要尝试移动到1.9 .3尽快。如果没有这个,你将开始有无尽的宝石问题,并为旧版本解决它们是不切实际的,特别是如果你更新的ruby和rails。

3)数据库。 听起来你已经导入了那个好的,因为这可能是个大问题。 不确定你使用了什么 - 可能是一个sql转储或备份。 大概你是在本地做过的。 对于Heroku本身,您可能已经使用了https://devcenter.heroku.com/articles/taps

主要是你的捆绑完成了。
99%的时间这意味着你的宝石也可以。

我会尝试运行应用程序,看看它是如何工作的。