Class: Oops::OpsworksDeploy
- Inherits:
-
Object
- Object
- Oops::OpsworksDeploy
- Defined in:
- lib/oops/opsworks_deploy.rb
Defined Under Namespace
Classes: Deployment
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#stack_name ⇒ Object
Returns the value of attribute stack_name.
Instance Method Summary collapse
- #deploy(file_url) ⇒ Object
-
#initialize(app_name, stack_name) ⇒ OpsworksDeploy
constructor
A new instance of OpsworksDeploy.
Constructor Details
#initialize(app_name, stack_name) ⇒ OpsworksDeploy
Returns a new instance of OpsworksDeploy.
5 6 7 8 9 |
# File 'lib/oops/opsworks_deploy.rb', line 5 def initialize(app_name, stack_name) @client = Aws::OpsWorks::Client.new region: 'us-east-1' self.stack_name = stack_name self.app_name = app_name end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
3 4 5 |
# File 'lib/oops/opsworks_deploy.rb', line 3 def app_name @app_name end |
#stack_name ⇒ Object
Returns the value of attribute stack_name.
3 4 5 |
# File 'lib/oops/opsworks_deploy.rb', line 3 def stack_name @stack_name end |
Instance Method Details
#deploy(file_url) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/oops/opsworks_deploy.rb', line 11 def deploy(file_url) @client.update_app(app_id: app_id, app_source: { url: file_url }) instance_ids = @client.describe_instances(stack_id: stack_id).instances.map(&:instance_id).to_a deployment = @client.create_deployment(stack_id: stack_id, app_id: app_id, command: { name: 'deploy', args: { "migrate"=>["true"] } }, instance_ids: instance_ids ) Deployment.new(@client, deployment) end |