I'm currently testing this: (The below is a useless example, but should try to add '127.0.0.1' to the list of servers...)
root@domU-example:/var/lib/gems/2.0.0/gems/capistrano-autoscale-0.0.1/lib/capistrano# cat autoscale.rb
require 'aws-sdk'
require 'net/dns'
#### The below is old Cap2 syntax... What is the new equivalent? ####
#Capistrano::Configuration.instance(:must_exist).load do
### end old syntax (I think) ####
module Capistrano
class Configuration
module ELB
def elastic_load_balancer(name, *args)
hostname = "127.0.0.1"
server(hostname, *args)
end
end
include ELB
end
end
root@domU-example:~/webapp# cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
undefined method `elastic_load_balancer' for main:Object
config/deploy/production.rb:14:in `<top (required)>'
/var/lib/gems/2.0.0/gems/capistrano-3.0.1/lib/capistrano/setup.rb:13:in `load'
/var/lib/gems/2.0.0/gems/capistrano-3.0.1/lib/capistrano/setup.rb:13:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/var/lib/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.0.0/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/var/lib/gems/2.0.0/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/usr/local/bin/cap:23:in `load'
/usr/local/bin/cap:23:in `<main>'
Tasks: TOP => production
root@domU-example:~/webapp# cat Capfile | grep -v "^#"
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
root@dom-example:~/webapp# cat config/deploy.rb | grep -v "^#" | grep -v "^$"
set :application, 'blog'
set :ssh_options, {:forward_agent => false, keys: ['/home/deploy/.ssh/private_key'], :paranoid => false}
set :deploy_via, :remote_cache
set :use_sudo, true
set :deploy_to, '/webapp'
set :scm, :git
set :scm_user, :git
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
if test("[ ! -d " + release_path.join("tmp").to_s + " ]")
execute "mkdir ", release_path.join("tmp")
end
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, 'deploy:cleanup'
end
- Stage files (production.rb, staging.rb)
root@domU-example:~/webapp/config/deploy/# cat production.rb | grep -v "^#"
require 'capistrano/autoscale'
set :rails_env, "production"
set :stage, :production
set :user, 'deploy'
Any pointers in the right direction would be greatly appreciated. I've no issues reading as much documentation as you send me, but I haven't found this one yet....