conjure 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### Version 0.2.8
2
+ 2014-10-31
3
+
4
+ * Add SSL configuration when provisioning
5
+ * Support configurable rubygems version
6
+ * Upgrade to latest Phusion base image
7
+
1
8
  ### Version 0.2.7
2
9
  2014-10-23
3
10
 
@@ -12,6 +12,7 @@ module Conjure
12
12
  @rails_env = rails_env
13
13
  @nginx_directives = options[:nginx_directives] || {}
14
14
  @system_packages = options[:system_packages] || []
15
+ @rubygems_version = options[:rubygems_version]
15
16
  end
16
17
 
17
18
  def start
@@ -21,19 +22,22 @@ module Conjure
21
22
  private
22
23
 
23
24
  def start_options
24
- {:run_options => "-p 80:80 -p 2222:22"}
25
+ {:run_options => "-p 80:80 -p 443:443 -p 2222:22"}
25
26
  end
26
27
 
27
28
  def dockerfile
28
29
  public_key = File.expand_path("~/.ssh/id_rsa.pub")
29
30
  raise "Error: ~/.ssh/id_rsa.pub must exist." unless File.exist?(public_key)
30
- file = Docker::Template.new("conjure/passenger-ruby21:1.0.1")
31
+ file = Docker::Template.new("conjure/passenger-ruby21:1.0.2")
31
32
  file.run apt_command if apt_command
33
+ file.run rubygems_command if rubygems_command
32
34
  file.add_file public_key, "/root/.ssh/authorized_keys"
33
35
  file.add_file public_key, "/home/app/.ssh/authorized_keys"
34
36
  file.run "chown app.app /home/app/.ssh/authorized_keys"
35
37
  file.run "chown root.root /root/.ssh/authorized_keys"
36
- file.add_file_data nginx_conf, "/etc/nginx/sites-enabled/application.conf"
38
+ file.add_file_data nginx_conf, "/etc/nginx/sites-available/application-no-ssl.conf"
39
+ file.add_file_data nginx_ssl_conf, "/etc/nginx/sites-available/application-ssl.conf"
40
+ file.run "ln -s /etc/nginx/sites-available/application-no-ssl.conf /etc/nginx/sites-enabled/application.conf"
37
41
  file.add_file_data database_yml, "/home/app/application/shared/config/database.yml"
38
42
  file.add_file_data secrets_yml, "/home/app/application/shared/config/secrets.yml"
39
43
  file
@@ -45,6 +49,13 @@ module Conjure
45
49
  end
46
50
  end
47
51
 
52
+ def rubygems_command
53
+ if @rubygems_version
54
+ target_source = "/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb"
55
+ "sed -i '23d' #{target_source} && gem update --system #{@rubygems_version}"
56
+ end
57
+ end
58
+
48
59
  def database_yml
49
60
  {@rails_env => @database.rails_config}.to_yaml
50
61
  end
@@ -54,15 +65,17 @@ module Conjure
54
65
  end
55
66
 
56
67
  def nginx_conf
57
- options = {
58
- :listen => "80",
59
- :root => "/home/app/application/current/public",
60
- :passenger_enabled => "on",
61
- :passenger_user => "app",
62
- :passenger_ruby => "/usr/bin/ruby2.1",
63
- :passenger_app_env => @rails_env,
64
- }.merge @nginx_directives
65
- "server {\n" + options.map{|k, v| " #{k} #{v};"}.join("\n") + "\n}\n"
68
+ render_template "application-no-ssl.conf"
69
+ end
70
+
71
+ def nginx_ssl_conf
72
+ render_template "application-ssl.conf"
73
+ end
74
+
75
+ def render_template(name)
76
+ template_path = File.join File.dirname(__FILE__), "templates", "#{name}.erb"
77
+ template_data = File.read template_path
78
+ Erubis::Eruby.new(template_data).result :rails_env => @rails_env
66
79
  end
67
80
  end
68
81
  end
@@ -0,0 +1,8 @@
1
+ server {
2
+ listen 80;
3
+ root /home/app/application/current/public;
4
+ passenger_enabled on;
5
+ passenger_user app;
6
+ passenger_ruby /usr/bin/ruby2.1;
7
+ passenger_app_env <%= rails_env %>;
8
+ }
@@ -0,0 +1,27 @@
1
+ server {
2
+ listen 80;
3
+ return 301 https://$host$request_uri;
4
+ }
5
+
6
+ server {
7
+ listen 443 ssl;
8
+ root /home/app/application/current/public;
9
+ passenger_enabled on;
10
+ passenger_user app;
11
+ passenger_ruby /usr/bin/ruby2.1;
12
+ passenger_app_env <%= rails_env %>;
13
+
14
+ ssl_certificate /etc/ssl/certs/application.crt;
15
+ ssl_certificate_key /etc/ssl/private/application.key;
16
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
17
+ ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
18
+ ssl_prefer_server_ciphers on;
19
+
20
+ proxy_set_header X-SSL-Subject $ssl_client_s_dn;
21
+ proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
22
+ proxy_set_header X-Forwarded-Proto https;
23
+ proxy_set_header X-Real-IP $remote_addr;
24
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25
+ proxy_set_header Host $http_host;
26
+ proxy_redirect off;
27
+ }
@@ -1,3 +1,3 @@
1
1
  module Conjure
2
- VERSION = "0.2.7" unless defined?(VERSION)
2
+ VERSION = "0.2.8" 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.7
4
+ version: 0.2.8
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-10-23 00:00:00.000000000 Z
12
+ date: 2014-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: erubis
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: guard-rspec
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +180,8 @@ files:
164
180
  - lib/conjure/provision/docker/host.rb
165
181
  - lib/conjure/provision/docker/template.rb
166
182
  - lib/conjure/provision/docker/image.rb
183
+ - lib/conjure/provision/templates/application-ssl.conf.erb
184
+ - lib/conjure/provision/templates/application-no-ssl.conf.erb
167
185
  - lib/conjure/provision/local_docker.rb
168
186
  - lib/conjure/command.rb
169
187
  - lib/conjure/data_set.rb