Symfony 2 アプリケーションの Capifony デプロイメントをリモート サーバーに正常に動作させるのに問題があるようです。走った後
cap deploy
capifony からの出力はデプロイが成功したことを示していますが、リモート サーバーのアプリケーション フォルダーを見ると、「現在の」シンボリック リンクが配置されておらず、releases フォルダーが空です。
役立つ予備情報を次に示します。
- リモートおよびローカルの展開サーバーは CentOS 6.4 を実行しています
- ローカル展開サーバーの Ruby バージョンは 1.8.7 です
- カピストラーノのバージョンは 2.15.5 です
- アプリケーション Symfony バージョン 2.2
- ステージング環境にデプロイするマルチステージ プラグインを使用しています
私の deploy.rb ファイルの内容は次のとおりです。
app/config/deploy.rb
set :stages, %w(production staging)
set :default_stage, "staging"
set :stage_dir, "app/config"
require 'capistrano/ext/multistage'
set :application, "mysite"
set :user, "deploy"
set :group, "users"
set :shared_files, ["app/config/parameters.yml","composer.phar"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :use_composer, true
set :update_vendors, true
set :copy_vendors, true
set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader"
set :dump_assetic_assets, true
set :symfony_env_prod, "test"
set :writable_dirs, ["app/cache"]
set :webserver_user, "apache"
set :permission_method, :chmod
set :use_set_permissions, false
default_run_options[:pty] = true
default_run_options[:shell] = true
set :use_sudo, false
set :repository, "git@bitbucket.org:repo/mysite.git"
set :branch, "develop"
set :scm, :git
set :model_manager, "doctrine"
role(:web) { domain } # Your HTTP server, Apache/etc
role(:app, :primary => true) { domain } # This may be the same as your `Web` server
set :app_path, "app"
set :keep_releases, 3
set :deploy_via, :remote_cache
set(:deploy_to) { "/var/www/#{domain}/" }
# Tasks
namespace :post_deployment do
desc "Set the right file permissions / ownership for deployed files"
task :app_permissions, :roles => :app do
run "#{sudo} chown -Rf apache.users #{deploy_to}"
run "#{sudo} chmod 775 -Rf #{deploy_to}"
run "#{sudo} chmod 777 -hRf #{deploy_to}/app/cache"
end
end
after "post_deployment:app_permissions","deploy:cleanup"
logger.level = Logger::MAX_LEVEL
staging.rb ファイルの内容は次のとおりです。
app/config/staging.rb
server 'staging.mysite.com', :app, :web, :primary => true
set :domain, "staging.#{application}.com"
展開プロセスから得られる出力は次のとおりです。
cap deploy の出力
[deploy@a mysite]]$ cap deploy
triggering load callbacks
* 2013-08-04 16:20:09 executing `staging'
triggering start callbacks for `deploy'
* 2013-08-04 16:20:09 executing `multistage:ensure'
* 2013-08-04 16:20:09 executing `deploy'
* 2013-08-04 16:20:09 executing `deploy:update'
** transaction: start
* 2013-08-04 16:20:09 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
--> Updating code base with checkout strategy
executing locally: "git ls-remote git@bitbucket.org:repo/mysite.git develop"
command finished in 2120ms
* executing "git clone -q -b develop git@bitbucket.org:repo/mysite.git /var/www/staging.mysite.com/releases/20130804152011 && cd /var/www/staging.mysite.com/releases/20130804152011 && git checkout -q -b deploy 643def41fb76916aebccae9cb7dd87a82f7227d9 && (echo 643def41fb76916aebccae9cb7dd87a82f7227d9 > /var/www/staging.mysite.com/releases/20130804152011/REVISION)"
servers: ["staging.mysite.com"]
Password:
[staging.mysite.com] executing command
command finished in 140ms
* 2013-08-04 16:20:17 executing `deploy:finalize_update'
* executing "chmod -R g+w /var/www/staging.mysite.com/releases/20130804152011"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
--> Creating cache directory
* executing "sh -c 'if [ -d /var/www/staging.mysite.com/releases/20130804152011/app/cache ] ; then rm -rf /var/www/staging.mysite.com/releases/20130804152011/app/cache; fi'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
* executing "sh -c 'mkdir -p /var/www/staging.mysite.com/releases/20130804152011/app/cache && chmod -R 0777 /var/www/staging.mysite.com/releases/20130804152011/app/cache'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 216ms
* executing "chmod -R g+w /var/www/staging.mysite.com/releases/20130804152011/app/cache"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* 2013-08-04 16:20:17 executing `deploy:share_childs'
--> Creating symlinks for shared directories
* executing "mkdir -p /var/www/staging.mysite.com/shared/app/logs"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* executing "sh -c 'if [ -d /var/www/staging.mysite.com/releases/20130804152011/app/logs ] ; then rm -rf /var/www/staging.mysite.com/releases/20130804152011/app/logs; fi'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* executing "ln -nfs /var/www/staging.mysite.com/shared/app/logs /var/www/staging.mysite.com/releases/20130804152011/app/logs"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
* executing "mkdir -p /var/www/staging.mysite.com/shared/web/uploads"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 136ms
* executing "sh -c 'if [ -d /var/www/staging.mysite.com/releases/20130804152011/web/uploads ] ; then rm -rf /var/www/staging.mysite.com/releases/20130804152011/web/uploads; fi'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 140ms
* executing "ln -nfs /var/www/staging.mysite.com/shared/web/uploads /var/www/staging.mysite.com/releases/20130804152011/web/uploads"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* executing "mkdir -p /var/www/staging.mysite.com/shared/vendor"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* executing "sh -c 'if [ -d /var/www/staging.mysite.com/releases/20130804152011/vendor ] ; then rm -rf /var/www/staging.mysite.com/releases/20130804152011/vendor; fi'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* executing "ln -nfs /var/www/staging.mysite.com/shared/vendor /var/www/staging.mysite.com/releases/20130804152011/vendor"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 142ms
--> Creating symlinks for shared files
* executing "mkdir -p /var/www/staging.mysite.com/shared/app/config"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 142ms
* executing "touch /var/www/staging.mysite.com/shared/app/config/parameters.yml"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* executing "ln -nfs /var/www/staging.mysite.com/shared/app/config/parameters.yml /var/www/staging.mysite.com/releases/20130804152011/app/config/parameters.yml"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* executing "mkdir -p /var/www/staging.mysite.com/shared"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* executing "touch /var/www/staging.mysite.com/shared/composer.phar"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 140ms
* executing "ln -nfs /var/www/staging.mysite.com/shared/composer.phar /var/www/staging.mysite.com/releases/20130804152011/composer.phar"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
--> Normalizing asset timestamps
* executing "find /var/www/staging.mysite.com/releases/20130804152011/web/css /var/www/staging.mysite.com/releases/20130804152011/web/images /var/www/staging.mysite.com/releases/20130804152011/web/js -exec touch -t 201308041520.20 {} ';' &> /dev/null || true"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 140ms
triggering after callbacks for `deploy:finalize_update'
* 2013-08-04 16:20:20 executing `symfony:composer:install'
triggering before callbacks for `symfony:composer:install'
* 2013-08-04 16:20:20 executing `symfony:composer:get'
* executing "if [ -e /var/www/staging.mysite.com/releases/20130804152011/composer.phar ]; then echo 'true'; fi"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
--> Downloading Composer
* executing "sh -c 'cd /var/www/staging.mysite.com/releases/20130804152011 && curl -s http://getcomposer.org/installer | php'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
--> Installing Composer dependencies
* executing "sh -c 'cd /var/www/staging.mysite.com/releases/20130804152011 && php composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* 2013-08-04 16:20:20 executing `symfony:composer:dump_autoload'
--> Dumping an optimized autoloader
* executing "sh -c 'cd /var/www/staging.mysite.com/releases/20130804152011 && php composer.phar dump-autoload --optimize'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 137ms
* 2013-08-04 16:20:20 executing `symfony:cache:warmup'
--> Warming up cache
* executing "sh -c 'cd /var/www/staging.mysite.com/releases/20130804152011 && php app/console cache:warmup --env=test --no-debug'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
* executing "chmod -R g+w /var/www/staging.mysite.com/releases/20130804152011/app/cache"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 139ms
* 2013-08-04 16:20:21 executing `symfony:project:clear_controllers'
--> Clear controllers
* executing "sh -c 'cd /var/www/staging.mysite.com/releases/20130804152011 && rm -f web/app_*.php'"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 141ms
* 2013-08-04 16:20:21 executing `deploy:create_symlink'
* executing "rm -f /var/www/staging.mysite.com/current && ln -s /var/www/staging.mysite.com/releases/20130804152011 /var/www/staging.mysite.com/current"
servers: ["staging.mysite.com"]
[staging.mysite.com] executing command
command finished in 138ms
triggering after callbacks for `deploy:create_symlink'
--> Successfully deployed!
** transaction: commit
* 2013-08-04 16:20:21 executing `deploy:restart'
何が起こっているのか、なぜこの奇妙な結果が得られるのかについて、誰か考えがありますか (成功しましたが、実際の成功はありません)。これを引き起こす可能性のある構成に何か問題がありますか? どんな助けでも大歓迎です。