私はRuby on Rails 3.1.0とCapistrano gemを使用しており、データベーステーブルのカラム名を変更するためにマイグレーションファイルを作成しました。ローカルマシンでrake db:migrate
コマンド(development
モード)を実行すると動作しますが、production
モードのリモートサーバーでこれらの変更を有効にしたいと考えています。 私の問題はです:私はカピストラーノコマンドcap deploy:migrate
を実行する場合、私は、リモートサーバーの生産ログファイルに次のエラーメッセージが表示されます:プロダクションモードでの移行に関する問題
* executing "cd /<my_application_path>/releases/20111025205951 && rake RAILS_ENV=production db:migrate"
servers: ["<my_application_IP>"]
[<my_application_IP>] executing command
** [out :: <my_remote_server_IP>] (in /<my_application_path>/releases/20111025205951)
*** [err :: <my_remote_server_IP>] rake aborted!
*** [err :: <my_remote_server_IP>] uninitialized constant Rake::DSL
*** /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
*** ...
どのように私はこの問題を解決することができますか?上記のエラーメッセージで出力されたRubyバージョン1.9.1の使用に関連していますか?
注:私はruby -v
コマンドを実行した場合
# on the local machine (MacOS running Snow Leopard 10.6.7) I get
>> ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.7.0]
# on the remote machine (Linux running Ubuntu 10.04 LTS) I get
>> ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
UPDATE@Simone Carletti
のための私はの先頭にrequire 'bundler/capistrano'
を追加した後、 deploy.rb
fil Eと私は次のエラーを取得するcap deploy:migrations
コマンドを実行した後:
...
* executing "cd /<my_application_path>/releases/20111026132212 && bundle install --gemfile /<my_application_path>/releases/20111026132212/Gemfile --path /<my_application_path>/shared/bundle --deployment --quiet --without development test"
servers: ["<my_remote_server_IP>"]
[<my_remote_server_IP>] executing command
** [out :: <my_remote_server_IP>] Some gems seem to be missing from your vendor/cache directory.
** [out :: <my_remote_server_IP>] Could not find libv8-3.3.10.2 in any of the sources
command finished in 2554ms
failed: "sh -c 'cd /<my_application_path>/releases/20111026132212 && bundle install --gemfile /<my_application_path>/releases/20111026132212/Gemfile --path /<my_application_path>/shared/bundle --deployment --quiet --without development test'" on <my_remote_server_IP>
これは何を意味するのでしょうか?次のテキストの最後の部分(つまり、N.B.
部分)に関連している可能性がありますか?もしそうなら、私は何をすべきですか?
私は(official documentationから)cap -e bundle:install
コマンドを実行すると、私が手:
------------------------------------------------------------
cap bundle:install
------------------------------------------------------------
Install the current Bundler environment. By default, gems will be installed to
the shared/bundle path. Gems in the development and test group will not be
installed. The install command is executed with the --deployment and --quiet
flags. If the bundle cmd cannot be found then you can override the bundle_cmd
variable to specifiy which one it should use.
You can override any of these defaults by setting the variables shown below.
N.B. bundle_roles must be defined before you require 'bundler/capistrano' in
your deploy.rb file.
set :bundle_gemfile, "Gemfile"
set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
set :bundle_flags, "--deployment --quiet"
set :bundle_without, [:development, :test]
set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
set :bundle_roles, {:except => {:no_release => true}} # e.g. [:app, :batch]
注:cap deploy:migrations
コマンドは755
pemissionと空/<my_application_path>/shared/bundle/ruby/1.9.1
のディレクトリを作成します。
あなたは試しましたか。 'bundle exec rake db:migrate RAILS_ENV = production' – apneadiving
@apneadiving - 確信していますか?過去には 'bundle exec ... 'で始まる何かを実行していましたが、私は重大な問題を抱えていました。(私が覚えていない)... – user502052
' bundle exec'はあなたのレールアプリからレーキのバージョン互換性の問題を解決します。 – apneadiving