gpt4 book ai didi

ruby-on-rails - Ruby on Rails : Capistrano 3 deployment error

转载 作者:行者123 更新时间:2023-12-04 06:04:23 26 4
gpt4 key购买 nike

我正在尝试在开发模式下部署我的 rails 4 应用程序。当我尝试 cap deploy:setup 时,它说暂存未设置。接下来我根据它的建议尝试了 cap development deploy 并得到以下错误。请帮助我进行部署。

command: cap development deploy

cap aborted!
wrong number of arguments (5 for 1..2)
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/dsl/env.rb:38:in `server'
config/deploy/development.rb:5:in `<top (required)>'
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/setup.rb:15:in `load'
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/setup.rb:15:in `block (2 levels) in <top (required)>'
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/home/divya/.rvm/gems/ruby-2.1.0/bin/cap:23:in `load'
/home/divya/.rvm/gems/ruby-2.1.0/bin/cap:23:in `<main>'
/home/divya/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
/home/divya/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => development
(See full trace by running task with --trace)

使用以下文件:
deploy.rb
set :application, 'timeTracker'
set :scm, :git
set :repository, "git@github.com:p/project.git"
set :user, "r"
set :scm_passphrase, "r"
set :branch, "master"
set :deploy_via, :remote_cache
set :stages, ["staging", "development", "production"]
set :default_stage, "development"
#set :rvm_ruby_string, :local
#before 'deploy:setup', 'rvm:install_rvm'
#set :default_shell, "/bin/bash -l"
#set :rvm_type, :user
#set :rvm_install_with_sudo, true
#default_run_options[:pty] = true
#ssh_options[:forward_agent] = true
#ssh_options[:auth_methods] = "publickey"
# ssh_options[:keys] = "il.pem"
# set :ssh_options, {:auth_methods => "publickey"}
# set :ssh_options, {:keys => ["/home/c/mbk.pem"]}

# default_environment['PATH'] = '/usr/local/rvm/gems/ruby-1.9.3-p392:$PATH'
# default_environment['GEM_PATH']= '/usr/local/rvm/gems/ruby-1.9.3-p392'
# set :location, "http://ec2-23-23-59-41.compute-1.amazonaws.com"
# set :use_sudo, false
# ssh_options[:keys] = ["/home/c/ec2/mbk.pem"]

config/development.rb
require "rvm/capistrano"
require 'capistrano/bundler'
server "IP", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/t/"
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
set :rails_env, "development" #added for delayed job
set :rvm_type, :system
after 'deploy:update_code' do
# run "cd #{release_path}; RAILS_ENV=production rake assets:precompile"
run "cd #{release_path};"
run "mkdir -p #{release_path}/tmp/cache;"
run "chmod -R 777 #{release_path}/tmp/cache;"
run "mkdir -p #{release_path}/public/uploads;"
run "chmod -R 777 #{release_path}/public/uploads"
run "rm -rf #{release_path}/public/system"
# run "unlink #{release_path}/public/db_admin"
# run "unlink #{release_path}/public/blog"
run "ln -s #{shared_path}/system/ #{release_path}/public/"
run "ln -s '/var/www/blog' #{release_path}/public/"
run "mv #{release_path}/config/database.example.yml #{release_path}/config/database.yml"

run "cd #{release_path} && bundle install"
run "cd #{release_path} && rake db:create"
run "cd #{release_path} && rake db:migrate"
# run "cd #{release_path} && RAILS_ENV=production rake assets:precompile"
# run "chown -R www-data:www-data #{release_path}/*"
# run "chmod -R 777 #{release_path}/log"
end

namespace :deploy do
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end

最佳答案

wrong number of arguments (5 for 1..2)
/home/divya/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/dsl/env.rb:38:in `server'

它告诉你你传递了太多参数给 server .尝试用第二行替换第一行:
server "151.236.218.85", :app, :web, :db, :primary => true 
server "151.236.218.85", roles: [:app, :web, :db], :primary => true

也可以使用 roles: %w(app web db)如果你发现那个更干净。

关于ruby-on-rails - Ruby on Rails : Capistrano 3 deployment error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21259826/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com