class Conjure::Instance

Public Class Methods

create(options) click to toggle source
# File lib/conjure/instance.rb, line 15
def self.create(options)
  @server = Server.create server_name_prefix(options), options
  new(@server.ip_address, options).tap(&:update)
end
new(ip_address, options) click to toggle source
# File lib/conjure/instance.rb, line 10
def initialize(ip_address, options)
  @server = Server.new ip_address
  @options = options
end
update(options) click to toggle source
# File lib/conjure/instance.rb, line 20
def self.update(options)
  ip_address = options.delete(:ip_address)
  new(ip_address, options).tap(&:update)
end

Private Class Methods

server_name_prefix(options) click to toggle source
# File lib/conjure/instance.rb, line 47
def self.server_name_prefix(options)
  "#{options[:app_name]}-#{options[:rails_env]}"
end

Public Instance Methods

ip_address() click to toggle source
# File lib/conjure/instance.rb, line 29
def ip_address
  @server.ip_address
end
pending_files() click to toggle source
# File lib/conjure/instance.rb, line 41
def pending_files
  components.flat_map(&:pending_files)
end
port() click to toggle source
# File lib/conjure/instance.rb, line 33
def port
  2222
end
update() click to toggle source
# File lib/conjure/instance.rb, line 25
def update
  components.each(&:install)
end
user() click to toggle source
# File lib/conjure/instance.rb, line 37
def user
  "app"
end

Private Instance Methods

components() click to toggle source
# File lib/conjure/instance.rb, line 51
def components
  @components ||= [
    Firewall.new(@server),
    Swap.new(@server),
    RailsApplication.new(Docker::Host.new(@server), @options),
  ]
end