conjure 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### Version 0.2.5
2
+ 2014-9-3
3
+
4
+ * Extra configuration options for provisioning
5
+
1
6
  ### Version 0.2.4
2
7
  2014-8-29
3
8
 
@@ -6,9 +6,10 @@ require "yaml"
6
6
  module Conjure
7
7
  module Provision
8
8
  class Instance
9
- def initialize(app_name, rails_env)
9
+ def initialize(app_name, rails_env, options = {})
10
10
  @app_name = app_name
11
11
  @rails_env = rails_env
12
+ @options = options
12
13
  end
13
14
 
14
15
  def provision(options = {})
@@ -21,7 +22,7 @@ module Conjure
21
22
  database = Postgres.new(platform)
22
23
  database.start
23
24
 
24
- webserver = Passenger.new(platform, database, @rails_env)
25
+ webserver = Passenger.new(platform, database, @rails_env, @options)
25
26
  webserver.start
26
27
  passenger_ip = webserver.ip_address
27
28
 
@@ -6,10 +6,12 @@ module Conjure
6
6
  class Passenger
7
7
  attr_reader :ip_address
8
8
 
9
- def initialize(platform, database, rails_env)
9
+ def initialize(platform, database, rails_env, options)
10
10
  @platform = platform
11
11
  @database = database
12
12
  @rails_env = rails_env
13
+ @nginx_directives = options[:nginx_directives] || {}
14
+ @system_packages = options[:system_packages] || []
13
15
  end
14
16
 
15
17
  def start
@@ -26,6 +28,7 @@ module Conjure
26
28
  public_key = File.expand_path("~/.ssh/id_rsa.pub")
27
29
  raise "Error: ~/.ssh/id_rsa.pub must exist." unless File.exist?(public_key)
28
30
  file = Docker::Template.new("conjure/passenger-ruby21:1.0.1")
31
+ file.run apt_command if apt_command
29
32
  file.add_file public_key, "/root/.ssh/authorized_keys"
30
33
  file.add_file public_key, "/home/app/.ssh/authorized_keys"
31
34
  file.run "chown app.app /home/app/.ssh/authorized_keys"
@@ -36,6 +39,12 @@ module Conjure
36
39
  file
37
40
  end
38
41
 
42
+ def apt_command
43
+ if @system_packages.any?
44
+ "apt-get update && apt-get install -y #{@system_packages.join ' '}"
45
+ end
46
+ end
47
+
39
48
  def database_yml
40
49
  {@rails_env => @database.rails_config}.to_yaml
41
50
  end
@@ -52,8 +61,8 @@ module Conjure
52
61
  :passenger_user => "app",
53
62
  :passenger_ruby => "/usr/bin/ruby2.1",
54
63
  :passenger_app_env => @rails_env,
55
- }
56
- "server {" + options.map{|k, v| " #{k} #{v};"}.join("\n") + "}\n"
64
+ }.merge @nginx_directives
65
+ "server {\n" + options.map{|k, v| " #{k} #{v};"}.join("\n") + "\n}\n"
57
66
  end
58
67
  end
59
68
  end
@@ -1,3 +1,3 @@
1
1
  module Conjure
2
- VERSION = "0.2.4" unless defined?(VERSION)
2
+ VERSION = "0.2.5" unless defined?(VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-29 00:00:00.000000000 Z
12
+ date: 2014-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog