Class: Conjure::Postgres

Inherits:
Object
  • Object
show all
Defined in:
lib/conjure/postgres.rb

Instance Method Summary collapse

Constructor Details

#initialize(container_host) ⇒ Postgres

Returns a new instance of Postgres.



6
7
8
9
10
# File 'lib/conjure/postgres.rb', line 6

def initialize(container_host)
  @container_host = container_host
  @name = "conjure_db_#{SecureRandom.hex 8}"
  @password = new_password
end

Instance Method Details



27
28
29
# File 'lib/conjure/postgres.rb', line 27

def container_link
  {container_name => container_name}
end

#installObject



12
13
14
# File 'lib/conjure/postgres.rb', line 12

def install
  server_template.start(@container_host, "/sbin/my_init", start_options)
end

#pending_filesObject



31
32
33
# File 'lib/conjure/postgres.rb', line 31

def pending_files
  []
end

#rails_configObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/conjure/postgres.rb', line 16

def rails_config
  {
    "adapter" => "postgresql",
    "database" => @name,
    "host" => container_name,
    "username" => "db",
    "password" => @password,
    "template" => "template0",
  }
end