Sha256: 635613bdf0a003731ad0782013350fb7dc222f4114fc69dc823bfa894f4e544b
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
# frozen_string_literal: true require 'capistrano/plugin' module Capistrano module ASG module Rolling # Load this Capistrano Plugin in your Capfile: # # require 'capistrano/asg/rolling' # install_plugin Capistrano::ASG::Rolling::Plugin # class Plugin < Capistrano::Plugin def set_defaults set_if_empty :aws_access_key_id, ENV['AWS_ACCESS_KEY_ID'] set_if_empty :aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY'] set_if_empty :aws_region, ENV['AWS_REGION'] set_if_empty :asg_rolling_group_name, ENV['asg_name'] set_if_empty :asg_rolling_use_private_ip_address, true set_if_empty :asg_rolling_verbose, true end def register_hooks Capistrano::DSL.stages.each do |stage| after stage, 'rolling:setup' end after 'deploy', 'rolling:update' after 'deploy:failed', 'rolling:cleanup' after 'rolling:update', 'rolling:cleanup' after 'rolling:create_ami', 'rolling:cleanup' # Register an exit hook to do some cleanup when Capistrano # terminates without calling our after cleanup hook. at_exit { cleanup } end def define_tasks eval_rakefile File.expand_path('../tasks/rolling.rake', __dir__) end def logger @logger ||= Logger.new(verbose: config.verbose?) end def config Capistrano::ASG::Rolling::Configuration end def cleanup instances = config.instances.auto_terminate return if instances.empty? logger.info 'Terminating instance(s)...' instances.terminate end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-asg-rolling-0.1.0 | lib/capistrano/asg/rolling/plugin.rb |