$ cd my_perfect_app
$ gem install capistrano
$ cap install
# config/deploy.rb
set :application, 'slides'
set :repo_url, 'git@github.com:kugaevsky/slides.git'
# config/deploy/staging.rb
role :app, %w{nick@kugaevsky.ru}
set :deploy_to, '/home/kugaevsky/www/slides.kugaevsky.ru'
set :user, 'nick'
my_perfect_app
├── Capfile
├── config
│ ├── deploy
│ │ ├── production.rb
│ │ ├── staging.rb
│ │ └── ...
│ └── deploy.rb
└── lib
└── capistrano
└── tasks
my_perfect_app
├── current → ../releases/20141209222103
├── releases
│ ├── 20141209220703
│ ├── 20141209222103
│ └── ...
├── repo
│ ├── branches
│ ├── config
│ ├── description
│ └── ...
└── shared
├── node_modules
├── uploads
├── vendor
└── ...
deploy:starting # start a deployment, make sure everything is ready
deploy:started # started hook (for custom tasks)
deploy:updating # update server(s) with a new release
deploy:updated # updated hook
deploy:publishing # publish the new release
deploy:published # published hook
deploy:finishing # finish the deployment, clean up everything
deploy:finished # finished hook
deploy:starting
deploy:started
deploy:reverting # revert server(s) to previous release
deploy:reverted # reverted hook
deploy:publishing
deploy:published
deploy:finishing_rollback # finish the rollback, clean up everything
deploy:finished
# Capfile
require 'capistrano/rvm'
require 'capistrano/rbenv'
require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# config/deploy.rb
desc 'Create symlinks for npm modules'
task :npm do
on roles(:app) do
execute "ln -nfs /node_modules /node_modules"
end
end
desc 'Install npm modules'
task :npm do
on roles(:app) do
execute "cd && npm install"
end
end
desc 'Compile assets'
task :compile_assets do
on roles(:app) do
execute "cd && /node_modules/.bin/gulp compile:production"
end
end