Using Different Repositories
When you use the brightbox
command to create your config/deploy.rb
file, it doesn't use source code management and instead deploys whatever is in the current directory. That's great for quick start, but as you develop the application you are going to want to tie the deployment into some sort of source code version control respository.
Understanding deployment strategies
Capistrano comes with several 'deployment strategies' built in. All the repository examples on this page can use any of these strategies unless stated otherwise:
# the default behavior set :deploy_via, :checkout # use export, rather than checkout set :deploy_via, :export # keep a cached copy on the server. set :deploy_via, :remote_cache # checkout locally, then tar and gzip the copy # and sftp it to the remote servers set :deploy_via, :copy set :copy_exclude, [".svn", ".git"] # for tar+gzip+copy, but using an SCM export, # rather than checkout set :deploy_via, :copy set :copy_strategy, :export # for zip+copy, if you don't have tar or gzip handy set :deploy_via :copy set :copy_compression, :zip # Keep a local checkout copy up to date and copy that. set :deploy_via, :copy set :copy_cache, true set :copy_exclude, [".svn", ".git"]
Using the inbuilt Subversion repository
Each Brightbox comes with a subversion repository in the home directory of the rails
user.
To use this repository remove the default settings and add in the following:
set :local_repository, "svn+ssh://rails@<machine>.vm.brightbox.net/home/rails/subversion/<app-branch>" set :repository, "file:///home/rails/subversion/<app-branch>" set :scm, :subversion
You can use Ruby-power to create the paths in the usual fashion. For example
set :repository, "file:///home/#{user}/subversion/#{application}/trunk" set :local_repository, repository.sub(%r{^file://}, "svn+ssh://#{user}@bbtest-001.vm.brightbox.net") set :scm, :subversion
Using a Git public repository
If your application is stored on a Git public repository, use the following settings
set :repository, <public clone url> set :scm, :git set :branch, <deployment branch>
For example:
set :repository, "git://github.com/GitAccount/myproject.git" set :scm, :git set :branch, "master"
Using a private Subversion repository
If you have a password protected svn directory that your Brightbox can see, set the scm up as follows:
set :repository, "svn://<host>/<path to deployment branch>" set :scm, :subversion set :scm_username, <svn user> set :scm_password, <svn password>
When you have a repository like this, it may be a good idea to have a user setup that has read only access to the repository and use this for deployment. Then you can put the :scm_username
and :scm_password
entries in your ~/.caprc
file and they will be picked up for all your deployments.