daddy 0.5.20 → 0.5.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 445dd5a5d4fda8391b21cd6897679a59f1fd9e23
4
- data.tar.gz: c51526e5e37adfc961d6b913932b6b5103515a0c
3
+ metadata.gz: e3e37f408daf36b49fe3f3ec991af423d79263c3
4
+ data.tar.gz: 818f4b4e2dd45c072fd7147e22178986bb5de9ea
5
5
  SHA512:
6
- metadata.gz: '0669a19fd38c75ae0e60f31f479ff4d5ebcb0c4b647fe96662a7c0bebda2dd966731f7b3b945c73553aa884573af8452af58d94426ea7a2eeb1a47042b08a8c5'
7
- data.tar.gz: bd56b2dee5328661252d4392c1a73009da2a346a0aa8b287892644f5b027b19abf38c6a27c0e51e7a3e72bfdcad5993685893b2cc3d6af43da2d51a65f0c3da4
6
+ metadata.gz: 91810e27737dd3d6be68afa4184626a462944ca3411afee94e21b22e7a299f191bf542fa4abcad3d17f892b779205825b0fc7999c78a16029cecbd34a845de21
7
+ data.tar.gz: 60b195876dd319239b05c0e51d7d748cc4fd65fb018996292d1f60dc54c20d78fed0f106ff2746b6a8063746643ff48e6d2baf5c47b30f7beee8411a5d4ac773
@@ -0,0 +1,15 @@
1
+ require 'daddy/itamae'
2
+
3
+ %w{ epel-release yum-utils }.each do |name|
4
+ package name do
5
+ user 'root'
6
+ end
7
+ end
8
+
9
+ execute 'yum-config-manager --enable epel' do
10
+ user 'root'
11
+ end
12
+
13
+ execute 'yum clean all && yum update -y' do
14
+ user 'root'
15
+ end
@@ -13,13 +13,6 @@ directory '/opt/letsencrypt' do
13
13
  mode '755'
14
14
  end
15
15
 
16
- directory '/opt/letsencrypt/certbot' do
17
- user 'root'
18
- owner ENV['USER']
19
- group ENV['USER']
20
- mode '755'
21
- end
22
-
23
16
  git '/opt/letsencrypt/certbot' do
24
17
  repository 'https://github.com/certbot/certbot'
25
18
  end
@@ -7,8 +7,8 @@ directory '/etc/nginx/conf.d/servers' do
7
7
  mode '755'
8
8
  end
9
9
 
10
- template "/etc/nginx/conf.d/servers/#{ENV['APP_NAME']}.conf" do
11
- source 'templates/app.conf.erb'
10
+ template "/etc/nginx/conf.d/servers/#{ENV['SERVER_NAME']}.conf" do
11
+ source 'templates/passenger.conf.erb'
12
12
  user 'root'
13
13
  owner 'root'
14
14
  group 'root'
@@ -19,3 +19,12 @@ template "/etc/nginx/conf.d/servers/#{ENV['APP_NAME']}.conf" do
19
19
  :rails_root => ENV['RAILS_ROOT'],
20
20
  :behind_load_balancer => false
21
21
  end
22
+
23
+ if ENV['RAILS_ROOT'].start_with?("/home/#{ENV['USER']}/")
24
+ directory "/home/#{ENV['USER']}" do
25
+ user 'root'
26
+ owner ENV['USER']
27
+ group ENV['USER']
28
+ mode '755'
29
+ end
30
+ end
@@ -1,6 +1,7 @@
1
1
  require 'daddy/itamae'
2
2
 
3
3
  dad_nginx_checksum = File.join(File.dirname(__FILE__), 'sha256sum.txt')
4
+ dad_nginx_version = '1.12.0'
4
5
 
5
6
  directory 'tmp'
6
7
 
@@ -8,41 +9,48 @@ directory 'tmp'
8
9
  execute 'download nginx' do
9
10
  cwd 'tmp'
10
11
  command <<-EOF
11
- wget https://nginx.org/download/nginx-1.11.10.tar.gz
12
+ wget https://nginx.org/download/nginx-#{dad_nginx_version}.tar.gz
12
13
  EOF
13
14
  not_if "sha256sum -c #{dad_nginx_checksum}"
14
15
  end
15
16
 
16
- # nginx-rtmp-module source
17
- directory '/opt/nginx-rtmp-module' do
18
- user 'root'
19
- owner ENV['USER']
20
- group ENV['USER']
21
- mode '755'
22
- end
23
- git '/opt/nginx-rtmp-module/v1.1.11' do
24
- repository 'https://github.com/arut/nginx-rtmp-module.git'
25
- revision 'v1.1.11'
26
- end
17
+ # module sources
18
+ include_recipe 'modules/nginx-rtmp-module'
19
+ include_recipe 'modules/passenger'
27
20
 
28
21
  # build
29
22
  execute 'build nginx' do
30
23
  cwd 'tmp'
31
24
  command <<-EOF
32
- rm -Rf nginx-1.11.10
33
- tar zxf nginx-1.11.10.tar.gz
34
- cd nginx-1.11.10
35
- ./configure \
36
- --prefix=/opt/nginx-1.11.10 \
25
+ rm -Rf nginx-#{dad_nginx_version}
26
+ tar zxf nginx-#{dad_nginx_version}.tar.gz
27
+ cd nginx-#{dad_nginx_version}
28
+ sudo ./configure \
29
+ --prefix=/opt/nginx-#{dad_nginx_version} \
37
30
  --conf-path=/etc/nginx/nginx.conf \
38
31
  --pid-path=/run/nginx.pid \
39
32
  --with-http_ssl_module \
40
- --add-module=/opt/nginx-rtmp-module/v1.1.11
33
+ --add-dynamic-module=/opt/nginx-rtmp-module/v1.1.11 \
34
+ --add-dynamic-module=$(passenger-config --nginx-addon-dir)
35
+ sudo chown -R #{ENV['USER']}:#{ENV['USER']} ./
41
36
  make
42
37
  sudo make install
43
- sudo ln -snf /opt/nginx-1.11.10 /opt/nginx
44
38
  EOF
45
- not_if "test -e /opt/nginx"
39
+ not_if "test -e /opt/nginx-#{dad_nginx_version}"
40
+ end
41
+
42
+ link 'nginx' do
43
+ user 'root'
44
+ cwd '/opt'
45
+ to "nginx-#{dad_nginx_version}"
46
+ force true
47
+ end
48
+
49
+ template '/etc/nginx/nginx.conf' do
50
+ user 'root'
51
+ owner 'root'
52
+ group 'root'
53
+ mode '644'
46
54
  end
47
55
 
48
56
  directory '/etc/nginx/conf.d' do
@@ -52,8 +60,19 @@ directory '/etc/nginx/conf.d' do
52
60
  mode '755'
53
61
  end
54
62
 
55
- template '/etc/nginx/nginx.conf' do
63
+ template '/etc/nginx/conf.d/default.conf' do
56
64
  user 'root'
65
+ owner 'root'
66
+ group 'root'
67
+ mode '644'
68
+ variables :passenger_root => `sudo passenger-config about root`
69
+ end
70
+
71
+ directory '/etc/nginx/conf.d/servers' do
72
+ user 'root'
73
+ owner 'root'
74
+ group 'root'
75
+ mode '755'
57
76
  end
58
77
 
59
78
  template '/lib/systemd/system/nginx.service' do
@@ -0,0 +1,10 @@
1
+ directory '/opt/nginx-rtmp-module' do
2
+ user 'root'
3
+ owner ENV['USER']
4
+ group ENV['USER']
5
+ mode '755'
6
+ end
7
+ git '/opt/nginx-rtmp-module/v1.1.11' do
8
+ repository 'https://github.com/arut/nginx-rtmp-module.git'
9
+ revision 'v1.1.11'
10
+ end
@@ -0,0 +1,4 @@
1
+ gem_package 'passenger' do
2
+ user 'root'
3
+ version '5.1.3'
4
+ end
@@ -1 +1 @@
1
- 778b3cabb07633f754cd9dee32fc8e22582bce22bfa407be76a806abd935533d nginx-1.11.10.tar.gz
1
+ b4222e26fdb620a8d3c3a3a8b955e08b713672e1bc5198d1e4f462308a795b30 nginx-1.12.0.tar.gz
@@ -0,0 +1,31 @@
1
+ <%-
2
+ @ssl = system("sudo test -e /etc/letsencrypt/live/#{@server_name}/fullchain.pem") &&
3
+ system("sudo test -e /etc/letsencrypt/live/#{@server_name}/privkey.pem")
4
+ -%>
5
+ server {
6
+ listen 80;
7
+ <%- if @ssl -%>
8
+ listen 443 ssl;
9
+ <%- end -%>
10
+ server_name <%= @server_name %>;
11
+ access_log /opt/nginx/logs/<%= @server_name %>_access.log ltsv;
12
+
13
+ <%- if @ssl -%>
14
+ ssl_certificate /etc/letsencrypt/live/<%= @server_name %>/fullchain.pem;
15
+ ssl_certificate_key /etc/letsencrypt/live/<%= @server_name %>/privkey.pem;
16
+ <%- end -%>
17
+
18
+ root <%= ::File.join(@rails_root, 'public') %>;
19
+ passenger_enabled on;
20
+ passenger_app_env <%= @rails_env %>;
21
+
22
+ gzip on;
23
+ gzip_http_version 1.0;
24
+ gzip_proxied any;
25
+ gzip_min_length 500;
26
+ gzip_disable "MSIE [1-6]\.";
27
+ gzip_types text/plain text/xml text/css
28
+ text/comma-separated-values
29
+ text/javascript application/x-javascript
30
+ application/atom+xml;
31
+ }
@@ -1,7 +1,41 @@
1
- server {
2
- listen 80 default_server;
3
- server_name _;
4
- deny all;
5
- }
1
+ http {
2
+ include mime.types;
3
+ default_type application/octet-stream;
4
+ ssl_protocols TLSv1.1 TLSv1.2;
5
+
6
+ log_format ltsv 'time:$time_local\t'
7
+ 'msec:$msec\t'
8
+ 'host:$remote_addr\t'
9
+ 'forwardedfor:$http_x_forwarded_for\t'
10
+ 'req:$request\t'
11
+ 'method:$request_method\t'
12
+ 'uri:$request_uri\t'
13
+ 'status:$status\t'
14
+ 'size:$body_bytes_sent\t'
15
+ 'referer:$http_referer\t'
16
+ 'ua:$http_user_agent\t'
17
+ 'reqtime:$request_time\t'
18
+ 'upsttime:$upstream_response_time\t'
19
+ 'cache:$upstream_http_x_cache\t'
20
+ 'runtime:$upstream_http_x_runtime\t'
21
+ 'vhost:$host';
22
+
23
+ access_log /opt/nginx/logs/access.log ltsv;
24
+
25
+ sendfile on;
26
+ #tcp_nopush on;
27
+
28
+ keepalive_timeout 65;
6
29
 
7
- include conf.d/servers/*.conf;
30
+ #gzip on;
31
+
32
+ passenger_root <%= @passenger_root %>;
33
+
34
+ server {
35
+ listen 80 default_server;
36
+ server_name _;
37
+ deny all;
38
+ }
39
+
40
+ include /etc/nginx/conf.d/servers/*.conf;
41
+ }
@@ -1,49 +1,11 @@
1
- user nginx;
1
+ user nobody;
2
2
  worker_processes 1;
3
3
 
4
- error_log /var/log/nginx/error.log warn;
5
- pid /var/run/nginx.pid;
6
-
4
+ load_module modules/ngx_http_passenger_module.so;
5
+ load_module modules/ngx_rtmp_module.so;
7
6
 
8
7
  events {
9
8
  worker_connections 1024;
10
9
  }
11
10
 
12
-
13
- http {
14
- include /etc/nginx/mime.types;
15
- default_type application/octet-stream;
16
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
17
-
18
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19
- '$status $body_bytes_sent "$http_referer" '
20
- '"$http_user_agent" "$http_x_forwarded_for"';
21
-
22
- log_format ltsv 'time:$time_local\t'
23
- 'msec:$msec\t'
24
- 'host:$remote_addr\t'
25
- 'forwardedfor:$http_x_forwarded_for\t'
26
- 'req:$request\t'
27
- 'method:$request_method\t'
28
- 'uri:$request_uri\t'
29
- 'status:$status\t'
30
- 'size:$body_bytes_sent\t'
31
- 'referer:$http_referer\t'
32
- 'ua:$http_user_agent\t'
33
- 'reqtime:$request_time\t'
34
- 'upsttime:$upstream_response_time\t'
35
- 'cache:$upstream_http_x_cache\t'
36
- 'runtime:$upstream_http_x_runtime\t'
37
- 'vhost:$host';
38
-
39
- access_log /var/log/nginx/access.log main;
40
-
41
- sendfile on;
42
- #tcp_nopush on;
43
-
44
- keepalive_timeout 65;
45
-
46
- #gzip on;
47
-
48
- include /etc/nginx/conf.d/*.conf;
49
- }
11
+ include /etc/nginx/conf.d/*.conf;
@@ -1,5 +1,5 @@
1
1
  ## Path: Development/Jenkins
2
- ## Description: Jenkins Continuous Integration Server
2
+ ## Description: Jenkins Automation Server
3
3
  ## Type: string
4
4
  ## Default: "/var/lib/jenkins"
5
5
  ## ServiceRestart: jenkins
@@ -102,6 +102,7 @@ JENKINS_HTTPS_KEYSTORE_PASSWORD=""
102
102
  #
103
103
  JENKINS_HTTPS_LISTEN_ADDRESS=""
104
104
 
105
+
105
106
  ## Type: integer(1:9)
106
107
  ## Default: 5
107
108
  ## ServiceRestart: jenkins
data/lib/daddy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Daddy
2
- VERSION = '0.5.20'
2
+ VERSION = '0.5.21'
3
3
  end
@@ -12,6 +12,7 @@ en:
12
12
  memcached:
13
13
  install: install mecached
14
14
  nginx:
15
+ config: setting Passenger for app to Nginx
15
16
  install: install Nginx
16
17
  obs_studio:
17
18
  install: install OBS-Studio
@@ -12,6 +12,7 @@ ja:
12
12
  memcached:
13
13
  install: memcachedをインストールします
14
14
  nginx:
15
+ config: Nginxにアプリの設定ファイルをインストールします
15
16
  install: Nginxをインストールします
16
17
  obs_studio:
17
18
  install: OBS-Studioをインストールします
data/lib/tasks/nginx.rake CHANGED
@@ -8,7 +8,7 @@ namespace :dad do
8
8
  run_itamae 'nginx/install'
9
9
  end
10
10
 
11
- desc 'Nginxにアプリの設定ファイルをインストールします。'
11
+ desc I18n.t('nginx.config')
12
12
  task :config do
13
13
  ENV['APP_NAME'] ||= app_name
14
14
  ENV['SERVER_NAME'] ||= ask('SERVER_NAME', :default => 'localhost', :required => true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.20
4
+ version: 0.5.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -256,6 +256,7 @@ files:
256
256
  - itamae/cookbooks/app_base_dir.rb
257
257
  - itamae/cookbooks/docker/install.rb
258
258
  - itamae/cookbooks/docker/registry/install.rb
259
+ - itamae/cookbooks/epel/install.rb
259
260
  - itamae/cookbooks/god/install.rb
260
261
  - itamae/cookbooks/jenkins/install.rb
261
262
  - itamae/cookbooks/jenkins/plugins/install.rb
@@ -267,10 +268,11 @@ files:
267
268
  - itamae/cookbooks/netdata/netdata-installer.sh
268
269
  - itamae/cookbooks/nginx/config.rb
269
270
  - itamae/cookbooks/nginx/install.rb
271
+ - itamae/cookbooks/nginx/modules/nginx-rtmp-module.rb
272
+ - itamae/cookbooks/nginx/modules/passenger.rb
270
273
  - itamae/cookbooks/nginx/sha256sum.txt
271
- - itamae/cookbooks/nginx/templates/app.conf.erb
272
- - itamae/cookbooks/nginx/templates/etc/nginx/nginx.conf.erb
273
- - itamae/cookbooks/nginx/templates/lib/systemd/system/nginx.service.erb
274
+ - itamae/cookbooks/nginx/templates/passenger.conf.erb
275
+ - itamae/cookbooks/nginx/templates/unicorn.conf.erb
274
276
  - itamae/cookbooks/obs_studio/install.rb
275
277
  - itamae/cookbooks/phantomjs/install.rb
276
278
  - itamae/cookbooks/redis/install.rb
@@ -292,6 +294,7 @@ files:
292
294
  - itamae/templates/etc/vsftpd/vsftpd.conf.erb
293
295
  - itamae/templates/etc/yum.repos.d/docker.repo.erb
294
296
  - itamae/templates/etc/yum.repos.d/nginx.repo.erb
297
+ - itamae/templates/lib/systemd/system/nginx.service.erb
295
298
  - lib/active_support/cache/null_store.rb
296
299
  - lib/capistrano/daddy.rb
297
300
  - lib/capistrano/tasks/update_linked_files.rake
@@ -1,119 +0,0 @@
1
-
2
- #user nobody;
3
- worker_processes 1;
4
-
5
- #error_log logs/error.log;
6
- #error_log logs/error.log notice;
7
- #error_log logs/error.log info;
8
-
9
- #pid logs/nginx.pid;
10
-
11
-
12
- events {
13
- worker_connections 1024;
14
- }
15
-
16
-
17
- http {
18
- include mime.types;
19
- default_type application/octet-stream;
20
- ssl_protocols TLSv1.1 TLSv1.2;
21
-
22
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
23
- # '$status $body_bytes_sent "$http_referer" '
24
- # '"$http_user_agent" "$http_x_forwarded_for"';
25
-
26
- #access_log logs/access.log main;
27
-
28
- sendfile on;
29
- #tcp_nopush on;
30
-
31
- #keepalive_timeout 0;
32
- keepalive_timeout 65;
33
-
34
- #gzip on;
35
-
36
- server {
37
- listen 80;
38
- server_name localhost;
39
-
40
- #charset koi8-r;
41
-
42
- #access_log logs/host.access.log main;
43
-
44
- location / {
45
- root html;
46
- index index.html index.htm;
47
- }
48
-
49
- #error_page 404 /404.html;
50
-
51
- # redirect server error pages to the static page /50x.html
52
- #
53
- error_page 500 502 503 504 /50x.html;
54
- location = /50x.html {
55
- root html;
56
- }
57
-
58
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
59
- #
60
- #location ~ \.php$ {
61
- # proxy_pass http://127.0.0.1;
62
- #}
63
-
64
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
65
- #
66
- #location ~ \.php$ {
67
- # root html;
68
- # fastcgi_pass 127.0.0.1:9000;
69
- # fastcgi_index index.php;
70
- # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
71
- # include fastcgi_params;
72
- #}
73
-
74
- # deny access to .htaccess files, if Apache's document root
75
- # concurs with nginx's one
76
- #
77
- #location ~ /\.ht {
78
- # deny all;
79
- #}
80
- }
81
-
82
-
83
- # another virtual host using mix of IP-, name-, and port-based configuration
84
- #
85
- #server {
86
- # listen 8000;
87
- # listen somename:8080;
88
- # server_name somename alias another.alias;
89
-
90
- # location / {
91
- # root html;
92
- # index index.html index.htm;
93
- # }
94
- #}
95
-
96
-
97
- # HTTPS server
98
- #
99
- #server {
100
- # listen 443 ssl;
101
- # server_name localhost;
102
-
103
- # ssl_certificate cert.pem;
104
- # ssl_certificate_key cert.key;
105
-
106
- # ssl_session_cache shared:SSL:1m;
107
- # ssl_session_timeout 5m;
108
-
109
- # ssl_ciphers HIGH:!aNULL:!MD5;
110
- # ssl_prefer_server_ciphers on;
111
-
112
- # location / {
113
- # root html;
114
- # index index.html index.htm;
115
- # }
116
- #}
117
-
118
- include conf.d/*.conf;
119
- }