Class: Provisional::Deployment
- Inherits:
-
Object
- Object
- Provisional::Deployment
- Defined in:
- lib/provisional/deployment.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #deploy_cold ⇒ Object
-
#initialize(environment, options = {}) ⇒ Deployment
constructor
A new instance of Deployment.
Constructor Details
#initialize(environment, options = {}) ⇒ Deployment
Returns a new instance of Deployment.
9 10 11 12 |
# File 'lib/provisional/deployment.rb', line 9 def initialize(environment, = {}) @environment = environment @options = end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
6 7 8 |
# File 'lib/provisional/deployment.rb', line 6 def environment @environment end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/provisional/deployment.rb', line 7 def @options end |
Instance Method Details
#deploy_cold ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/provisional/deployment.rb', line 14 def deploy_cold verify_all_required_images_have_been_built(environment) puts "Deploying all images to '#{environment}'." deployment_config.each do |server_type, server_config| server_count = server_config["servers"] image = Provisional::Image.find(name: server_type) # For a cold deploy, we can assume (but should verify) that there are no existing servers in the environment. # existing_servers = Provisional::Server.list(environment).reject{|server| server.name =~ /-\d{14}/} # next_server_number = highest_server_number(existing_servers) new_server_numbers = (1 .. server_count) new_server_numbers.each do |server_number| server_name = "#{server_type}#{server_number}.#{environment}" puts "Create server #{server_name} with image '#{image.name}'" Provisional::Server.create(name: server_name, image: image) end # existing_servers.each do |server| # server.delete # end end end |