class Deploy::Runner
Public Instance Methods
deploy()
click to toggle source
# File lib/deploy/runner.rb, line 13 def deploy check_setup environment = options[:environment] build = options[:build] version = options[:version] check_version(version, environment) repo = ENV['DOCKER_REPO'] if build && !version_exists?(version) announce_title = "Deployment started with build" build_image(repo, version) else announce_title = "Deployment started without build" pull_image(repo, version) end tag_image_as_latest(repo, version) push_image(repo, version) push_image(repo, 'latest') announce({ color: '#6080C0', title: announce_title, text: "Deploying version #{version} to #{environment}" }) run_deploy(version, environment) announce({ color: 'good', title: 'Deployment Succeeded!!', text: "The current version of #{environment} is #{version}" }) end
rollback()
click to toggle source
# File lib/deploy/runner.rb, line 45 def rollback check_setup environment = options[:environment] version = options[:version] check_rollback_version(version, environment) repo = ENV['DOCKER_REPO'] announce({ color: '#6080C0', title: "Rollback started", text: "Rolling back to #{version} on #{environment}" }) pull_image(repo, version) tag_image_as_latest(repo, version) push_image(repo, 'latest') run_rollback(version, environment) announce({ color: 'good', title: 'Rollback Succeeded!!', text: "The current version of #{environment} is #{version}" }) end
setup()
click to toggle source
# File lib/deploy/runner.rb, line 89 def setup (shout('AWS creds already configured in ~/.bashrc'); exit(1)) if ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] key = ask('Enter AWS Key:') secret = ask('Enter AWS Secret:') region = ask('Enter AWS Region:', default: 'us-west-2') File.open(File.expand_path('~/.bashrc'), 'a') do |f| f.puts '' f.puts '# Variables defined by eb-docker-deploy:' f.puts "export AWS_ACCESS_KEY_ID=#{key}" f.puts "export AWS_SECRET_ACCESS_KEY=#{secret}" f.puts "export AWS_REGION=#{region}" end shout('AWS creds successfully configured at ~/.bashrc.') shout('You must now run "source ~/.bashrc"') end
test_slack()
click to toggle source
# File lib/deploy/runner.rb, line 67 def test_slack notifier('', { color: 'good', title: 'This is a test notification from eb-docker-deploy.' }) end
version()
click to toggle source
# File lib/deploy/runner.rb, line 82 def version check_setup shout current_version_for_environment(options[:environment]) end
versions()
click to toggle source
# File lib/deploy/runner.rb, line 72 def versions check_setup application_versions_array.each do |version| shout version end end