Capistrano config files location

1.6k views Asked by At

Im using capistrano to deploy PHP projects which all works perfectly I am now introducing multistage, which I have also got working no problem

In my actual application setup I like to store the files in a differnt format

eg

/

..application/

....deploy/deploy.rb

....deploy/production.rb

..configs (etc)

I understand the default is config/deploy/production.rb This dosent follow my applications say up, so is there anyway to define which path to use?

Capfile:

load 'deploy' if respond_to?(:namespace) # cap2 differentiator

load 'application/deploy/deploy' # remove this line to skip loading any of the default tasks

1

There are 1 answers

1
JohnColvin On

I only use one file: config/deploy.rb with multiple tasks. Ignore the RVM business if you don't use it. Like this:

task :staging do
  set :rails_env, 'staging'
  role :app, "staging.example.com"
  role :web, "staging.example.com"
  role :db,  "staging.example.com", :primary => true
end

task :production do
  set :rails_env, 'production'
  set :branch, 'master'
  # RVM integration as specified at https://rvm.beginrescueend.com/integration/capistrano/
  $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
  require "rvm/capistrano"
  set :rvm_ruby_string, 'ruby-version@gemset'
  set :rvm_type, :user

  role :app, "prod.example.com"
  role :web, "prod.example.com"
  role :db,  "prod.example.com", :primary => true
end

Then you deploy with cap staging deploy and cap production deploy.