dust-deploy 0.16.2 → 0.16.3
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.md +16 -0
- data/lib/dust/recipes/nginx.rb +39 -0
- data/lib/dust/server.rb +1 -1
- data/lib/dust/version.rb +1 -1
- metadata +2 -2
data/changelog.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
Changelog
|
2
2
|
=============
|
3
3
|
|
4
|
+
0.16.3
|
5
|
+
------------
|
6
|
+
|
7
|
+
- get_gid() is now more efficient
|
8
|
+
- nginx recipe now creates needed directories
|
9
|
+
- adds certificate support to nginx recipe
|
10
|
+
it will copy over certificates from templates/nginx/certs to /etc/nginx/certs
|
11
|
+
|
12
|
+
recipes:
|
13
|
+
nginx:
|
14
|
+
certs:
|
15
|
+
- www.example.com.key
|
16
|
+
- www.example.com.crt
|
17
|
+
- { cert-in-templates-dir: target-filename }
|
18
|
+
|
19
|
+
|
4
20
|
0.16.2
|
5
21
|
------------
|
6
22
|
|
data/lib/dust/recipes/nginx.rb
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
1
3
|
class Nginx < Recipe
|
2
4
|
desc 'nginx:deploy', 'installs and configures nginx web server'
|
3
5
|
def deploy
|
4
6
|
# default package to install
|
5
7
|
@config['package'] ||= 'nginx'
|
8
|
+
@config['user'] ||= 'nginx' if @node.uses_rpm?
|
9
|
+
@config['user'] ||= 'www-data' if @node.uses_apt?
|
6
10
|
|
7
11
|
@config['package'].to_array.each do |package|
|
8
12
|
return unless @node.install_package(package)
|
9
13
|
end
|
10
14
|
|
15
|
+
@node.mkdir('/etc/nginx')
|
16
|
+
@node.mkdir('/etc/nginx/sites-enabled')
|
17
|
+
@node.mkdir('/etc/nginx/sites-available')
|
18
|
+
|
11
19
|
@node.deploy_file("#{@template_path}/nginx.conf", '/etc/nginx/nginx.conf', :binding => binding)
|
12
20
|
|
13
21
|
# remove old sites that may be present
|
@@ -27,6 +35,37 @@ class Nginx < Recipe
|
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
38
|
+
# deploy ssl certificates to /etc/nginx/certs
|
39
|
+
@config['certs'] ||= []
|
40
|
+
Array(@config['certs']).each do |file|
|
41
|
+
# file can either be
|
42
|
+
# a string 'file': file is just copied over
|
43
|
+
# a hash { 'source': 'target' } when source and target filename differ
|
44
|
+
|
45
|
+
if file.is_a? String
|
46
|
+
source = "#{@template_path}/certs/#{file}"
|
47
|
+
destination = "/etc/nginx/certs/#{File.basename(file)}"
|
48
|
+
|
49
|
+
elsif file.is_a? Hash
|
50
|
+
source = "#{@template_path}/certs/#{File.basename(file.keys.first)}"
|
51
|
+
destination = "/etc/nginx/certs/#{File.basename(file.values.first)}"
|
52
|
+
|
53
|
+
else
|
54
|
+
return @node.messages.add("#{file.inspect} is neither String nor Hash!").failed
|
55
|
+
end
|
56
|
+
|
57
|
+
unless File.exists?(source)
|
58
|
+
@node.messages.add("#{source} not found. skipping.").warning
|
59
|
+
next
|
60
|
+
end
|
61
|
+
|
62
|
+
@node.mkdir(File.dirname(destination))
|
63
|
+
@node.deploy_file(source, destination)
|
64
|
+
@node.chown("#{@config['user']}:#{@node.get_gid(@config['user'])}", destination)
|
65
|
+
@node.chmod('0600', destination)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
30
69
|
# check configuration and restart nginx
|
31
70
|
msg = @node.messages.add('checking nginx configuration')
|
32
71
|
ret = @node.exec('/etc/init.d/nginx configtest')
|
data/lib/dust/server.rb
CHANGED
@@ -823,7 +823,7 @@ module Dust
|
|
823
823
|
options = default_options(:quiet => true).merge(options)
|
824
824
|
|
825
825
|
msg = messages.add("getting primary gid of #{user}", options)
|
826
|
-
ret = exec("
|
826
|
+
ret = exec("id -g #{user}")
|
827
827
|
if msg.parse_result(ret[:exit_code])
|
828
828
|
return ret[:stdout].chomp
|
829
829
|
else
|
data/lib/dust/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dust-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.3
|
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: 2012-
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|