Skip to content

Instantly share code, notes, and snippets.

@polidog
Last active August 29, 2015 14:02
Show Gist options
  • Save polidog/67886ec4719503307ec2 to your computer and use it in GitHub Desktop.
Save polidog/67886ec4719503307ec2 to your computer and use it in GitHub Desktop.
Capistrano3でSymfony2をデプロイする ref: http://qiita.com/polidog/items/47ea1ca1f642a47c6091
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
++ # Include Symfony2 tasks
++ require 'capistrano/symfony'
# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
namespace :deploy do
after 'deploy:updated', 'symfony:assets:install'
after 'deploy:updated', 'symfony:assetic:dump'
++task :upload do
++ on roles(:app) do |host|
++ upload!('config/parameters.yml',"#{shared_path}/app/config/parameters.yml")
++ end
++ end
++end
$ mkdir -p ~/capistrano/test
$ cd ~/capistrano/test
$ vim Gemfile
source 'https://rubygems.org'
gem 'capistrano', '~> 3.1'
gem 'capistrano-symfony', '~> 0.1', :github => 'capistrano/symfony'
$ bundle ex cap procution deploy:check
ERRORlinked file /var/www/vhost/test/shared/app/config/parameters.yml does not exist on blog.polidog.jp
cap aborted!
$ bundle ex cap production deploy:upload
$ bundle ex cap procution deploy:check
$ bundle ex cap procution deploy
$ bundle install --path=vendor/bundler
$ bundle ex cap install
$ tree
.
├── Capfile
├── Gemfile
├── Gemfile.lock
├── config
│   ├── deploy
│   │   ├── production.rb
│   │   └── staging.rb
│   └── deploy.rb
└── lib
└── capistrano
└── tasks
5 directories, 6 files
-- server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
++ server 'blog.polidog.jp', user:'polidog', role: [:app]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment