Capistrano:链接文件composer.lock在IP上不存在

时间:2017-11-12 04:20:35

标签: ruby deployment capistrano

我不知道自己做错了什么,但为什么composer.lock文件不存在?我将其添加到linked_files。这是我的控制台输出:

 DEBUG [8df0d002] Command: /usr/bin/env mkdir -p /var/www/html/my_site/shared /var/www/html/my_site/shared/sites/default
  INFO [8df0d002] Finished in 0.614 seconds with exit status 0 (successful).
 DEBUG [b06431bc] Running [ -f /var/www/html/my_site/shared/composer.lock ] as deploy@xxx.xx.xxx.xx
 DEBUG [b06431bc] Command: [ -f /var/www/html/my_site/shared/composer.lock ]
 DEBUG [b06431bc] Finished in 0.614 seconds with exit status 1 (failed).
 ERROR linked file /var/www/html/my_site/shared/composer.lock does not exist on xxx.xx.xxx.xx
Build step 'Execute shell' marked build as failure
Finished: FAILURE

这是我的Capfile:

require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/composer"
require 'capistrano/file-permissions'

# config valid only for current version of Capistrano
lock '3.5.0'
set :application, 'my_site'
set :repo_url, 'sample@xxx.xx.xxx.xx:hello/my_site.git'

#Composer installation Flag set
set :composer_install_flags, '--no-interaction --optimize-autoloader'
#Composer path in the Webserver, so check with DSU for this path
SSHKit.config.command_map[:composer] = "/usr/bin/composer"

# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Path where application code will be deployed in Webservers
set :deploy_to, '/var/www/html/my_site/'
#Setting Files/Folders as linked
set :linked_files, ["composer.lock", "sites/default/settings.php", ".htaccess"]
set :linked_dirs, ["core", "vendor", "sites/default/files"]

# Setting Files/Folders permission
set :file_permissions_paths, ["sites/default/files", "private-files"]
set :file_permissions_users, ["deploy"]
set :file_permissions_groups, ["apache"]
set :file_permissions_chmod_mode, "0775"

# 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 keep_releases is 5
set :keep_releases, 4

namespace :deploy do

    after :restart, :clear_cache do
        on roles(:web), in: :groups, limit: 3, wait: 10 do
            # Here we can do anything such as:
            # within release_path do
            #   execute :rake, 'cache:clear'
        end
    end

    task :composer do
        on roles(:app) do
            invoke 'composer:install'
        end
    end

    desc 'Delete failed release'
        task :rm_failed do
            on roles(:all) do
                execute(:rm, "-rf #{release_path}")
        end
    end

end

# Composer installation
after 'deploy:updated', 'deploy:composer'

#Files/Folders permission set
after "deploy:updated", "deploy:set_permissions:chown"
after "deploy:updated", "deploy:set_permissions:chgrp"
after "deploy:updated", "deploy:set_permissions:chmod"

#If failure in latest release then latest release folder will be deleted automatically
after "deploy:failed", "deploy:rm_failed"

您能为此提供任何解决方案吗?

invoke 'composer:install'还做什么?

仅供参考,我没有SSH访问服务器,所以我无法检查composer.lock文件是否存在,我也不知道有关capistrano和ruby的任何信息。

0 个答案:

没有答案