This gem includes every recipe/task that is in use in more than one project at Novelys.
capistranovelys
has a dependency on recent versions of capistrano
,
meaning you can remove capistrano
and capistrano-ext
from your Gemfile, and replace it with :
gem "capistranovelys", '~> 2.0.1'
In your deploy.rb :
- remove `require "production_chain/capistrano" if you are using novelys/production_chain
- add
require 'capistrano/novelys'
(loads the core recipes) - load recipes you need, eg:
use_recipes :database, :rails2, :rbenv, :whenever
. To be used BEFORE other loading of recipes such asdeploy/assets
, otherwise some hooks (such as the symlinks) will be executed too late.- You can use
use_novelys_and [arg, ...]
. It will loadairbrake
,rbenv
,logs
,stages
,remote_commands, production_chain
, and the recipes supplied as arguments. This will also use Novelys' configuration foruser
,deploy_to
, andrepository
. Useuse_novelys
if you don't want/need anything else.
- You can use
- You probably want to set
user
,deploy_to
, andrepository
at the very least. Refer tocore.rb
to see which default values are set - Make sure you don't have duplicates!
Common setup and options is done here. I suggest reading the file to go through all the details.
Basically, using core means you're using git, you're using rails, and you'll keep 5 releases.
This gem has a dependency on sushi
. This allows you to do capistrano [stage] ssh
.
Rails 3 & 4 commands.
rails:console
: open a rails consolerails:secret_token:copy
: copy the secret_token from your local file to the shared pathrails:secret_token:symlink
: symlink the secret_token.rb file from the shared path to the current path. Hooked afterdeploy:update_code
Rails 2 commands.
rails:console
: open a rails consolerails:secret_token:copy
: copy the session_store from your local file to the shared pathrails:secret_token:symlink
: symlink the session_store.rb file from the shared path to the current path. Hooked afterdeploy:update_code
Replacement with better defaults for stages:
- bundles two stages,
staging
andproduction
,staging
being the default`; - those stages comes with default for
branch
andrails_env
; staging can overridebranch
at runtime (viacap -S branch=value
); - if no stages are specified, stages are defined and loaded by looking in
config/deploy/*.rb
You should not require capistrano/ext/multistage
.
database:create
: create the databasedatabase:seed
: seed the databasedatabase:copy
: copy the database.yml from your local file to the shared pathdatabase:symlink
: symlink the database.yml file from the shared path to the current path. Hooked afterdeploy:update_code
mongoid:copy
: copy the mongoid.yml from your local file to the shared pathmongoid:symlink
: symlink the mongoid.yml file from the shared path to the current path. Hooked afterdeploy:update_code
mongoid:index
: create the indexes
logs:tail
: tail the logs of the rails app
Recipes usings rake tasks from novelys/production_chain. Will work only if the gem is present.
db:dump_and_restore
: restore the database from the server to your local env. SupplyFILE=mongoid
when using mongoid.assets:dump_and_restore
: restore the assets from the public direction to your local env.
Setup the default_environment
with the correct path for rbenv
remote:rake
: Execute a rake task on the target (eg:cap remote:rake "assets:precompile"
)remote:command
: Execute a shell command on the target (eg:cap remote:command ls
)
s3:copy
: copy the amazon_s3.yml from your local file to the shared paths3:symlink
: symlink the amazon_s3.yml file from the shared path to the current path. Hooked afterdeploy:update_code
deploy:start
, deploy:stop
, deploy:graceful_stop
, deploy:reload
, deploy:restart
tasks for unicorn
deploy:start
, deploy:stop
, deploy:graceful_stop
, deploy:reload
, deploy:restart
tasks for puma. Doesn't actually do anything except requiring "puma".
airbrake:copy
: copy the airbrake.rb from your local file to the shared pathairbrake:symlink
: symlink the airbrake.rb file from the shared path to the current path. Hooked afterdeploy:update_code
thinking_sphinx:copy
: copy the *.sphinx.conf from your local file to the shared paththinking_sphinx:symlink
: symlink the *.sphinx.conf file from the shared path to the current path. Hooked afterdeploy:update_code
- Every task available under the namespace
thinking_sphinx
is also available under the namespacets
, eg.ts:rebuild
sunspot:copy
: copy the sunspot.yml from your local file to the shared pathsunspot:symlink
: symlink the sunspot.yml file from the shared path to the current path. Hooked afterdeploy:update_code
Setup options for the whenever
gem