This gem will let you run Symfony tasks with Capistrano 3.x.
More informations about Symfony & Capistrano (fr)
Important : The capistrano-symfony GEM name has been moved to the official capistrano/symfony module. Take a look on the installation part to use this module with Gemfile.
- Installation
- Usage
- Available tasks
- Executing symfony console commands on the server directly from the local CLI
- Handling parameters.yml
- Contributing
Add this line to your application's Gemfile:
gem 'capistrano-symfony', '~> 0.3', :github => 'TheBigBrainsCompany/capistrano-symfony'
And then execute:
$ bundle
Or install it yourself via gem:
$ gem install capistrano-symfony
Add a "require" statement in your application Capfile
:
require 'capistrano/symfony'
Here is a list of available options with their default values:
set :symfony_roles, :web
set :symfony_default_flags, '--quiet --no-interaction'
set :symfony_assets_flags, '--symlink'
set :symfony_assetic_flags, ''
set :symfony_cache_clear_flags, ''
set :symfony_cache_warmup_flags, ''
set :symfony_env, 'prod'
set :symfony_parameters_upload, :ask
set :symfony_parameters_path, 'app/config/'
set :symfony_parameters_name_scheme, 'parameters_#{fetch(:stage)}.yml'
- symfony:assets:install
- symfony:assetic:dump
- symfony:cache:clear
- symfony:cache:warmup
- symfony:parameters:upload
- symfony:app:clean_environment
If you are using assetic
, add in your config file
before 'deploy:publishing', 'symfony:assetic:dump'
This library also provides a symfony:run
task which allows access to any
Symfony console command.
With log level set to debug, from the command line you can run:
$ cap production symfony:run['list --env=prod']
Or from within a rake task using capistrano's invoke
:
task :my_custom_composer_task do
invoke 'symfony:run', :'assets:install'
end
If necessary, the capistrano-symfony
module can upload the app/config/parameters.yml
for you.
The :symfony_parameters_upload
option can take tree values :
- :never : Never upload the local parameters file even when the remote version is different
- :always : Always upload the local parameters file when the remote version is different
- :ask : Always ask you before uploading the local parameters file when the remote version is different (default)
The local parameters file must be defined in the app/config/
, see default value of :symfony_parameters_path
option.
The parameters file name depends on the defined capistrano stages parameters_#{fetch(:stage)}.yml
By using this strategy, you can have different parameters files for each of your capistrano stages, e.g:
- app/config/parameters_staging.yml
- app/config/parameters_production.yml
The only required configuration is the :linked_files
,
set :linked_files, %w{app/config/parameters.yml}
Note: On first deployment, the parameters file will be uploaded in the shared folder. On next deployments, this will depend on the strategy you defined with the :symfony_parameters_upload
option.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request