Installation de bundle
gem install bundler
Installation des librairies (Capistrano 3, capistrano-symfony, ...).
Voir fichier Gemfile pour plus de détail
bundle install --clean --path=vendor/bundle
Creation du fichier Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/composer'
require 'capistrano/symfony'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Creation du fihier deploy.rb
set :application, 'alertor'
set :repo_url, 'git@bitbucket.org:aamant/alertor.git'
set :branch, 'master'
set :linked_files, %w{app/config/parameters.yml}
set :linked_dirs, %w{app/logs vendor}
set :symfony_console_path, 'bin/console'
namespace :deploy do
before :starting, 'composer:install_executable'
before 'symfony:cache:warmup', 'symfony:assets:install'
before 'symfony:cache:warmup', 'symfony:assetic:dump'
before 'symfony:cache:warmup', 'alertor:install'
before :published, 'composer:install'
before 'composer:install', :composer_selfupdate do
on roles(:app) do
within shared_path do
execute :php, 'composer.phar', 'self-update'
end
end
end
end
Creation du fichier production.rb
set :stage, :production
set :ssh_user, 'deployers'
server 'amant.pro', user: fetch(:ssh_user), roles: %w{web app db}
set :deploy_to, '/var/websites/app'
Creation de la structure distante
bundle exec cap production deploy:check:directories
Creation du fichier parameters.yml
mkdir -p /var/websites/app/shared/app/config
vim /var/websites/app/shared/app/config/parameters.yml
Deploiement
bundle exec cap staging deploy
Liens utiles
https://www.occitech.fr/blog/2014/06/deployez-votre-application-orocrm-avec-capistrano-3/
http://bundler.io/git.html