2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'manifests/rails.pp', line 2
define deploy::rails(
$ensure = 'present',
$user = $name,
$ssh_key = undef,
$ssh_key_options = undef,
$deploy_to = undef,
$supervisor = undef,
$configs = undef,
$server_name = undef,
$database_url = undef,
$env = 'production',
$num_web_workers = 2,
$listen_addr = '127.0.0.1:3000',
$ssl_cert = undef,
$ssl_cert_key = undef,
$auth_basic = undef,
$puma_threads = '1,1',
$sse_enable = false
) {
include 'deploy::params'
$deploy_path = $deploy_to ? {
undef => "${deploy::params::deploy_to}/${name}",
default => $deploy_to
}
deploy::application{ $name:
ensure => 'present',
user => $user,
ssh_key => $ssh_key,
ssh_key_options => $ssh_key_options,
deploy_to => $deploy_path,
supervisor => $supervisor,
configs => $configs
}
file{
"${deploy_path}/shared/config/unicorn.rb":
ensure => 'present',
owner => $user,
group => $user,
mode => '0640',
content => template('deploy/unicorn.rb.erb'),
require => File["${deploy_path}/shared/config"];
"${deploy_path}/shared/config/puma.rb":
ensure => 'present',
owner => $user,
group => $user,
mode => '0640',
content => template('deploy/puma.rb.erb'),
require => File["${deploy_path}/shared/config"];
}
if $database_url != undef {
file { "${deploy_path}/shared/config/database.yml":
ensure => 'present',
owner => $user,
group => $user,
mode => '0640',
content => template('deploy/database.yml.erb'),
require => File["${deploy_path}/shared"]
}
}
if $server_name != undef {
$nginx_upstream = $listen_addr ? {
undef => "unix:${deploy_path}/shared/pids/web.sock",
default => $listen_addr
}
deploy::nginx::site{ $name:
ensure => 'present',
server_name => $server_name,
upstream => $nginx_upstream,
document_root => "${deploy_path}/current/public",
ssl_cert => $ssl_cert,
ssl_cert_key => $ssl_cert_key,
auth_basic => $auth_basic,
sse_enable => $sse_enable
}
}
}
|