Module: EbDeployer
- Defined in:
- lib/eb_deployer.rb,
lib/eb_deployer/utils.rb,
lib/eb_deployer/package.rb,
lib/eb_deployer/version.rb,
lib/eb_deployer/component.rb,
lib/eb_deployer/aws_driver.rb,
lib/eb_deployer/smoke_test.rb,
lib/eb_deployer/application.rb,
lib/eb_deployer/environment.rb,
lib/eb_deployer/event_poller.rb,
lib/eb_deployer/config_loader.rb,
lib/eb_deployer/default_config.rb,
lib/eb_deployer/eb_environment.rb,
lib/eb_deployer/resource_stacks.rb,
lib/eb_deployer/version_cleaner.rb,
lib/eb_deployer/default_component.rb,
lib/eb_deployer/deployment_strategy.rb,
lib/eb_deployer/throttling_handling.rb,
lib/eb_deployer/aws_driver/beanstalk.rb,
lib/eb_deployer/aws_driver/s3_driver.rb,
lib/eb_deployer/cloud_formation_provisioner.rb,
lib/eb_deployer/deployment_strategy/blue_green.rb,
lib/eb_deployer/aws_driver/cloud_formation_driver.rb,
lib/eb_deployer/deployment_strategy/inplace_update.rb
Defined Under Namespace
Modules: AWSDriver, DeploymentStrategy, Utils Classes: Application, CloudFormationProvisioner, Component, ConfigLoader, DefaultComponent, DefaultConfig, EbEnvironment, Environment, EventPoller, Package, ResourceNotInReadyState, ResourceStacks, SmokeTest, ThrottlingHandling, VersionCleaner
Constant Summary collapse
- VERSION =
"0.4.4"
Class Method Summary collapse
- .cli ⇒ Object
-
.deploy(opts) ⇒ Object
Deploy a package to specfied environments on elastic beanstalk.
- .destroy(opts) ⇒ Object
-
.query_resource_output(key, opts) ⇒ Object
Query ouput value of the cloud formation stack.
Class Method Details
.cli ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/eb_deployer.rb', line 223 def self.cli = { :action => :deploy, :environment => 'dev', :config_file => 'config/eb_deployer.yml' } parser = cli_parser() parser.parse! action = .delete(:action) if File.exists?([:config_file]) puts "Found configuration at #{[:config_file]}." else puts "Generated default configuration at #{[:config_file]}." DefaultConfig.new(File.basename(Dir.pwd)).write_to([:config_file]) exit(2) end if ![:package] && action == :deploy puts "Missing options: -p (--package)" puts "'eb_deploy --help' for details" puts parser exit(-1) end self.send(action, ConfigLoader.new.load()) end |
.deploy(opts) ⇒ Object
Deploy a package to specfied environments on elastic beanstalk
packages will be stored. Note that the string “.packages” will be added as a suffix to your bucket. So, if “thoughtworks.simple” is passed as the bucket name, the actual s3 bucket name will be thoughtworks.simple.packages.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/eb_deployer.rb', line 171 def self.deploy(opts) if region = opts[:region] AWS.config(:region => region) end bs = opts[:bs_driver] || AWSDriver::Beanstalk.new s3 = opts[:s3_driver] || AWSDriver::S3Driver.new cf = opts[:cf_driver] || AWSDriver::CloudFormationDriver.new app_name = opts[:application] version_prefix = opts[:version_prefix].to_s.strip version_label = "#{version_prefix}#{opts[:version_label].to_s.strip}" application = Application.new(app_name, bs, s3, opts[:package_bucket]) resource_stacks = ResourceStacks.new(opts[:resources], cf, opts[:skip_resource_stack_update]) bs = ThrottlingHandling.new(bs, AWS::ElasticBeanstalk::Errors::Throttling) environment = Environment.new(application, opts[:environment], bs) do |env| env.resource_stacks = resource_stacks env.settings = opts[:option_settings] || opts[:settings] || [] env.inactive_settings = opts[:inactive_settings] || [] env.creation_opts = { :solution_stack => opts[:solution_stack_name], :cname_prefix => opts[:cname_prefix], :smoke_test => opts[:smoke_test], :phoenix_mode => opts[:phoenix_mode], :tier => opts[:tier] } env.strategy_name = opts[:strategy] || :blue_green env.components = opts[:components] env.component_under_deploy = opts[:component] end application.create_version(version_label, opts[:package]) environment.deploy(version_label) application.clean_versions(version_prefix, opts[:keep_latest].to_i || 0) end |
.destroy(opts) ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/eb_deployer.rb', line 210 def self.destroy(opts) if region = opts[:region] AWS.config(:region => region) end app = opts[:application] bs = opts[:bs_driver] || AWSDriver::Beanstalk.new s3 = opts[:s3_driver] || AWSDriver::S3Driver.new cf = opts[:cf_driver] || AWSDriver::CloudFormationDriver.new Application.new(app, bs, s3).delete(opts[:environment]) end |
.query_resource_output(key, opts) ⇒ Object
Query ouput value of the cloud formation stack
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/eb_deployer.rb', line 41 def self.query_resource_output(key, opts) if region = opts[:region] AWS.config(:region => region) end app = opts[:application] env_name = opts[:environment] cf = opts[:cf_driver] || AWSDriver::CloudFormationDriver.new provisioner = CloudFormationProvisioner.new("#{app}-#{env_name}", cf) provisioner.output(key) end |