1

デプロイ (同じサーバー上のステージングと本番の両方) で次のエラーが発生します。

    triggering after callbacks for `deploy:update_code'
  * executing `deploy:assets:precompile'
  * executing "cd /var/www/staging/releases/20130215205558 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile"
    servers: ["domain.com"]
    [domain.com] executing command
    [domain.com] cd /var/www/staging/releases/20130215205558 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile
 ** [out :: domain.com] rake aborted!
 ** [out :: domain.com] uninitialized constant RAILS_ENV
 ** [out :: domain.com] 
 ** [out :: domain.com] Tasks: TOP => environment
 ** [out :: domain.com] (See full trace by running task with --trace)
    command finished in 22567ms
*** [deploy:update_code] rolling back

このアプリは実行中です:

  • レール 3.1.4
  • ルビー 1.9.2-p290

deploy.rb ファイルには以下が含まれます。

set :stages, %w(staging production)
require 'capistrano/ext/multistage'
require "bundler/capistrano"
set :application, "appname"
role :app, "domain.com"
role :web, "domain.com"
role :db,  "domain.com", :primary => true
set :scm, :git
set :repository, "git@git.git:username/appname.git"
set :deploy_via, :remote_cache
set :user, "username"
set :runner, "username"
set :use_sudo, false
set :shared_children, %w(system log pids spree)
default_run_options[:pty] = true
default_run_options[:shell] = false
require './config/boot'
require 'airbrake/capistrano'
load 'deploy/assets'
namespace :deploy do
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
  task :default do
    update
    restart
    cleanup
  end
  task :finalize_update, :except => { :no_release => true } do
    run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
    run <<-CMD
      rm -rf #{latest_release}/log #{latest_release}/public/system #{latest_release}/tmp/pids &&
      mkdir -p #{latest_release}/public &&
      mkdir -p #{latest_release}/tmp &&
      ln -s #{shared_path}/log #{latest_release}/log &&
      ln -s #{shared_path}/system #{latest_release}/public/system &&
      ln -s #{shared_path}/spree #{latest_release}/public/spree &&
      ln -s #{shared_path}/pids #{latest_release}/tmp/pids
    CMD
    if fetch(:normalize_asset_timestamps, true)
      stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
      asset_paths = fetch(:public_children, %w(images stylesheets javascripts)).map { |p| "#{latest_release}/public/#{p}" }.join(" ")
      run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" }
    end
  end
  end
end

Gemfile には以下が含まれます。

source 'http://rubygems.org'
gem 'rails', '~> 3.1'
gem 'spree', '~> 0.70.3'
gem 'tinymce-rails', '3.4.4'
gem 'honeypot-captcha'
gem 'spree_static_content', :git => 'https://github.com/spree/spree_static_content.git', :branch => '0-70-stable'
gem 'spree_editor', :git => 'https://github.com/commonmedia/spree_editor.git', :branch => 'master'
gem 'spree_contact_form', :git => 'git://github.com/commonmedia/spree-contact-form.git', :branch => 'master'
gem 'mysql2'
gem 'airbrake'
gem 'newrelic_rpm'
gem 'jquery-rails'
gem 'capistrano'
gem 'capistrano-ext'
group :assets do
  gem 'sass-rails',   '~> 3.1.5'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end
group :development do
  gem 'highline'
end
group :test do
  gem 'turn', '0.8.2', :require => false
end
group :development, :test do
  gem 'itslog'
end
group :staging, :production do
  gem 'therubyracer'
end
4

2 に答える 2

1

コマンドが正しくありません。変更する必要があります:

bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile

... に:

RAILS_ENV=staging RAILS_GROUPS=assets bundle exec rake assets:precompile
于 2013-02-15T21:24:04.743 に答える