@mirbook

Почему не работает деплой capistrano?

При деплое выдает ошибку:

* executing "cp -RPp /home/app/production/shared/cached-copy /home/app/production/releases/20171019060907 && (echo e3f8f140652b3f1a6b6065b442f29d13646c3e70 > /home/app/production/releases/20171019060907/REVISION)"
servers: ["77.244.215.99"]
[77.244.215.99] executing command
** [out :: 77.244.215.99] cp:
** [out :: 77.244.215.99] cannot create directory '/home/app/production/releases/20171019060907'
** [out :: 77.244.215.99] : No such file or directory
** [out :: 77.244.215.99]
command finished in 355ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/app/production/releases/20171019060907; true"
servers: ["77.244.215.99"]
[77.244.215.99] executing command
command finished in 294ms

failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell '2.2.1' -c 'cp -RPp /home/app/production/shared/cached-copy /home/app/production/releases/20171019060907 && (echo e3f8f140652b3f1a6b6065b442f29d13646c3e70 > /home/app/production/releases/20171019060907/REVISION)'" on 77.244.215.99

deploy.rb
set :rvm_ruby_string, "2.2.1"
set :rvm_install_ruby_params, '--1.9'

#for jruby/rbx default to 1.9 mode
#set :rvm_install_pkgs, %w[libyaml openssl] # package list from https://rvm.io/packages
#set :rvm_install_ruby_params, '--with-opt-dir=/usr/local/rvm/usr' # package support

before 'deploy:setup', 'rvm:install_rvm'   # install RVM
#before 'deploy:setup', 'rvm:install_pkgs'  # install RVM packages before Ruby
before 'deploy:setup', 'rvm:install_ruby'  # install Ruby and create gemset, or:
#before 'deploy:setup', 'rvm:create_gemset' # only create gemset
#before 'deploy:setup', 'rvm:import_gemset' # import gemset from file


require "bundler/capistrano"
require "rvm/capistrano"

# Enable multistage.
require "capistrano/ext/multistage"

# Declare the stages. The stages should follow the names you gave them in config/environments/* .
set :stages, %w(production staging)

# Set the default stage
set :default_stage, "production"

# The application name is used to determine what repository to pull from, name databases and other nifty stuff.
set :application, ENV["app"]

# Use sudo when deploying the application.
# Dunno what's default but true is evil.
set :use_sudo, false

# Hack to allow Capistrano to prompt for password.
# Comment out if the deployer user needs a password for sudo.
# set :sudo_prompt, ""

# Choose the Source Control Management tool of your preference.
# (Don't. Really. Use git).
set :scm, :git

# Set the repository we're going to pull from.
# (Sorry, no multirepo, just multistage).
set :repository, (ENV["repo"] || "ssh://git@gitlab.com/sqcat/#{application}.git")

# Setup the way you want the deploy to be done.
# I sincerely suggest using :remote_cache.
set :deploy_via, :remote_cache

# Pseudo Terminals.
# If you want Capistrano client password prompt to work this must be true.
default_run_options[:pty] = true

# Imagine you ask a friend to give you his car keys to drive it by yourself.
ssh_options[:forward_agent] = true


namespace :deploy do
  desc "Create database yaml in shared path."
  task :db_configure do
    db_config = <<-EOF
#{rails_env}:
  host: #{database_host}
  username: #{database_username}
  password: #{database_password}
  database: #{application.gsub('-', '_')}_#{rails_env}
    EOF

    run "mkdir -p #{current_path}/config"
    put db_config, "#{current_path}/config/mongoid.yml"
  end

#  desc "Make symlink for database yaml."
#  task :db_symlink do
#    run "ln -snf #{shared_path}/config/mongoid.yml #{latest_release}/config/mongoid.yml"
#  end

  desc "Setup the database."
  task :db_setup, roles: :app do
    run "cd #{current_path} && bundle exec rake db:setup RAILS_ENV=#{rails_env}"
  end

  desc "Create thin yaml in shared path."
  task :thin_configure do
    thin_config = <<-EOF
---
chdir:                /home/app/#{appstage}/current
environment:          production
address:              127.0.0.1
port:                 3000
timeout:              30
log:                  /home/app/#{appstage}/shared/log/#{rails_env}.log
pid:                  /home/app/#{appstage}/shared/pids/#{rails_env}.pid
max_conns:            1024
max_persistent_conns: 512
require:              []

wait:                 30
servers:              1
daemonize:            true
    EOF

    put thin_config, "#{current_path}/config/thin.yml"
  end


  desc "Start the services."
  task :start, roles: :app, except: { no_release: true } do
    run "cd #{current_path} && bundle exec thin start -C ./config/thin.yml"
  end

  desc "Stop the services."
  task :stop, roles: :app, except: { no_release: true } do
    run "cd #{current_release} && bundle exec thin stop -C ./config/thin.yml || exit 0"
  end

  desc "Restart the services."
  task :restart, roles: :app, except: { no_release: true } do
    run "cd #{current_path} && bundle exec thin restart -C ./config/thin.yml || exit 0"
  end

  desc "Deploys and starts a 'cold' application."
  task :cold do
    update
    db_configure
    #db_symlink
    db_setup
    migrate
    thin_configure
    start
  end
end

# Before hooks. You can define your own too!

after "deploy:create_symlink", "deploy:db_configure"
after "deploy:create_symlink", "deploy:thin_configure"


Переустанавливал rvm не помогает.
  • Вопрос задан
  • 175 просмотров
Решения вопроса 1
Ясно же написано:
cannot create directory '/home/app/production/releases/20171019060907

Дайте права на директорию.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
Instamart Москва
До 220 000 руб.
от 80 000 до 220 000 руб.
Royal Software Москва
от 80 000 до 150 000 руб.
21 июл. 2019, в 00:52
80000 руб./за проект
20 июл. 2019, в 19:38
10000 руб./за проект
20 июл. 2019, в 17:55
15000 руб./за проект