我正在尝试使用capistrano进行部署。
我可以ssh进入我的服务器,服务器ssh密钥被添加到我的bitbucket配置文件中。
我收到以下错误: 有人知道问题是什么吗?
01 bundle exec rake assets:precompile
01 DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables…
01
01 DEPRECATION WARNING: You did not specify a `log_level` in `production.rb`. Currently, the default value for `log_level` is `:info` for the production environment…
01
01 config.log_level = :info
01
01 . (called from block in tsort_each at /home/deploy/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226)
01
01 rake aborted!
01 NameError: uninitialized constant Mailboxer
01 /opt/www/03truxx/releases/20160612124038/config/initializers/mailboxer.rb:1:in `<top (required)>'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:652:in `block in load_config_initializer'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:166:in `instrument'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:651:in `load_config_initializer'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:615:in `each'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:615:in `block in <class:Engine>'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `instance_exec'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `run'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:44:in `each'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:44:in `tsort_each_child'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:54:in `run_initializers'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:352:in `initialize!'
01 /opt/www/03truxx/releases/20160612124038/config/environment.rb:5:in `<top (required)>'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:328:in `require'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:328:in `require_environment!'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:457:in `block in run_tasks_blocks'
01 /opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
01 /home/deploy/.rbenv/versions/2.2.3/bin/bundle:23:in `load'
01 /home/deploy/.rbenv/versions/2.2.3/bin/bundle:23:in `<main>'
01 Tasks: TOP => environment
01 (See full trace by running task with --trace)
然后
(Backtrace restricted to imported tasks)
cap aborted!
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:651:in `load_config_initializer'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:615:in `each'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/engine.rb:615:in `block in <class:Engine>'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `instance_exec'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `run'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:44:in `each'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:44:in `tsort_each_child'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:54:in `run_initializers'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:352:in `initialize!'
/opt/www/03truxx/releases/20160612124038/config/environment.rb:5:in `<top (required)>'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:328:in `require'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:328:in `require_environment!'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/opt/www/03truxx/shared/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/home/deploy/.rbenv/versions/2.2.3/bin/bundle:23:in `load'
/home/deploy/.rbenv/versions/2.2.3/bin/bundle:23:in `<main>'
DEBUG [ba9c6e96] Tasks: TOP => environment
DEBUG [ba9c6e96] (See full trace by running task with --trace)
gem文件:
source 'https://rubygems.org'
ruby '2.2.3'
gem 'rails', '4.2.2'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
#gem 'fog', '1.26.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
#gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
gem 'rake', '11.1.2'
gem 'mailboxer'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
end
group :development do
#gem 'better_errors'
gem 'unicorn'
gem 'pry-rails'
gem 'pry-nav'
gem 'meta_request'
gem 'capistrano', '~> 3.4.1'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-ssh-doctor', '~> 1.0'
gem 'net-ssh', '~> 2.0'
# Add this if you're using rbenv
#gem 'capistrano-rbenv', github: "capistrano/rbenv"
end
配置/ application.rb中
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module SampleApp2
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
配置/初始化/ mailboxer.rb
Mailboxer.setup do |config|
#Configures if you application uses or not email sending for Notifications and Messages
config.uses_emails = true
#Configures the default from for emails sent for Messages and Notifications
config.default_from = "no-reply@mailboxer.com"
#Configures the methods needed by mailboxer
config.email_method = :mailboxer_email
config.name_method = :name
#Configures if you use or not a search engine and which one you are using
#Supported engines: [:solr,:sphinx]
config.search_enabled = false
config.search_engine = :solr
#Configures maximum length of the message subject and body
config.subject_max_length = 255
config.body_max_length = 32000
end
配置/ deploy.rb
# config valid only for current version of Capistrano
lock '3.5.0'
set :application, '03truxx'
set :repo_url, 'git@bitbucket.org:r2artene/03trux.git'
set :deploy_to, '/opt/www/03truxx'
set :user, 'deploy'
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets}
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, '/var/www/my_app_name'
# Default value for :scm is :git
# set :scm, :git
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
%w[start stop restart].each do |command|
desc 'Manage Unicorn'
task command do
on roles(:app), in: :sequence, wait: 1 do
execute "/etc/init.d/unicorn_#{fetch(:application)} #{command}"
end
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
end
答案 0 :(得分:2)
从Gemfile的'mailboxer'
组移动development
gem。 Capistrano不会安装development
和test
组Gemfile。