Here some general settings and use of them in capistrano deployment.
1. set_scm: Set protocol to copy code from your repository to server.
set: 'git' // git protocol will used for deployment.
2. Set repository: set path of your git repository.
3. deploy_via : This is very important setting. There are two ways to set this variable
3.1 Set to copy :
set :deploy_via, :copy
this will copy all code with all meta data of repository like branch info n all.This will be a slow process because capistrano will perform a scp from your repository to server.
3.2 Set to export:
set :deploy_via, :export
This is faster a bit because it will clone repository to the server it leave metadata of the repository.
4. Set branch: Set default branch to be deployed.There are many ways you can set it like:
4.1 Set it manually: Just hard code the branch name.
set :branch ,'branch_name'
4.2 Ask before deployment: Use Capistrano::CLI.ask to take branch name at deployment time.
set :branch do
default_branch = Capistrano::CLI.ask('Enter branch name')
end
4.3 Use current branch: You can use current working branch like:
set :branch do
default_branch = `git rev-parse --abbrev-ref HEAD`.chomp
end
These are some common settings to keep in mind before writing a deployment script in capistrano.
Enjoy!!!!!
1. set_scm: Set protocol to copy code from your repository to server.
set: 'git' // git protocol will used for deployment.
2. Set repository: set path of your git repository.
3. deploy_via : This is very important setting. There are two ways to set this variable
3.1 Set to copy :
set :deploy_via, :copy
this will copy all code with all meta data of repository like branch info n all.This will be a slow process because capistrano will perform a scp from your repository to server.
3.2 Set to export:
set :deploy_via, :export
This is faster a bit because it will clone repository to the server it leave metadata of the repository.
4. Set branch: Set default branch to be deployed.There are many ways you can set it like:
4.1 Set it manually: Just hard code the branch name.
set :branch ,'branch_name'
4.2 Ask before deployment: Use Capistrano::CLI.ask to take branch name at deployment time.
set :branch do
default_branch = Capistrano::CLI.ask('Enter branch name')
end
4.3 Use current branch: You can use current working branch like:
set :branch do
default_branch = `git rev-parse --abbrev-ref HEAD`.chomp
end
These are some common settings to keep in mind before writing a deployment script in capistrano.
Enjoy!!!!!
No comments:
Post a Comment