subspace 0.4.2 → 0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90b6493c3b49faa6b3e825ba91b38ace22640fd8
4
- data.tar.gz: 37109dca55e73f582340a0d8136eb7e65ed97a22
3
+ metadata.gz: d5df2a1343e51341e96380ee4011b182a8970ef6
4
+ data.tar.gz: bcb4a135d9c459ab06eec7b892c6d695ab5fc36b
5
5
  SHA512:
6
- metadata.gz: 76fe3df3726d34278aea605e2932a35379f38eb78f9d91ba0121ad64dd4ba4ccceaa81cedce03f58d52ea9f0e1ba22b42504a48b28fa32051c222db6d33a4011
7
- data.tar.gz: 5295d6be99a5323d9d11bf98def621fcd583cb1be33b884b6082049b7a22f56b9527672328d77f793e3b9953b4071e8a137df9fdde3f677e2d7643a10a0b5b6d
6
+ metadata.gz: 92cdf7edb1a970a973a3134fed38d2405307e59dae8713408a33e2514d573633c4c625a5bbb6e7c5bd2e0541bb3172c847b77cdfe9dc7f2c4b693ee95ffe6799
7
+ data.tar.gz: 3aff151c039fb156a764d34d153e12e4a43ecf2fbc48406db5298b0495e112532c3b43d6031262cb85cb81742c473d768dd5fe82671a361c72fb3be32bff029c
data/README.md CHANGED
@@ -109,6 +109,21 @@ Apache also support canonicalizing the domain now, so if you alwyas want to redi
109
109
 
110
110
  ## collectd
111
111
 
112
+ Collectd is a super useful daemon that grabs and reports statistics about a server's health. Adding this role will make your server start reporting to a [graphite](https://graphiteapp.org/) server that you specify, and you can make cool graphs and data feeds after that using something like [Grafana](https://grafana.com/)
113
+
114
+ graphite_host: graphite.example.com
115
+ graphite_port: "2003"
116
+
117
+ Aside from basic statistics like free memory, disk, load averages, etc, we have some custom things:
118
+
119
+ 1. If Postgres and delayed job are installed, it will collect stats on number of outstanding delayed jobs.
120
+ 2. If apache is installed, it will collect stats from the /server-status page
121
+ 3. (TODO) add something for nginx
122
+ 4. (TODO) add something for pumas
123
+ 5. (TODO) add something for sidekiq
124
+ 6. (TODO) add something for memcache
125
+
126
+
112
127
  ## common
113
128
 
114
129
  ## delayed_job
@@ -172,7 +187,15 @@ Installs logrotate and lets you configure logs for automatic rotation. Example
172
187
 
173
188
  ## newrelic
174
189
 
175
- ## nginx
190
+ ## nginx-rails
191
+
192
+ Configurs nginx to look at localhost:9292 for the socket/backend connection. If you need to do fancy stuff you should simply override this role
193
+
194
+ subspace override nginx-rails
195
+
196
+ defaults are here, we'll probably add more:
197
+
198
+ client_max_body_size: 4G
176
199
 
177
200
  ## papertrail
178
201
 
@@ -189,6 +212,10 @@ Installs logrotate and lets you configure logs for automatic rotation. Example
189
212
 
190
213
  ## puma
191
214
 
215
+ add puma gem to gemfile
216
+ add config/puma to symlinks in deploy.rb
217
+
218
+
192
219
  ## rails
193
220
 
194
221
  Provisions for a rails app. This one is probably pretty important.
@@ -1,3 +1,3 @@
1
1
  - name: restart collectd
2
2
  command: service collectd restart
3
- sudo: true
3
+ become: true
@@ -39,7 +39,7 @@
39
39
  dest: /etc/collectd/collectd.conf.d/delayed_job_postgres.conf
40
40
  become: true
41
41
  notify: restart collectd
42
- when: postgresql_installed is defined and delayed_job_installed is defined
42
+ when: (collectd_pgdj is defined) or (postgresql_installed is defined and delayed_job_installed is defined)
43
43
 
44
44
  - name: create apache2 config
45
45
  template:
@@ -49,3 +49,19 @@
49
49
  notify: restart collectd
50
50
  when: apache2_installed is defined
51
51
 
52
+ - name: create puma config
53
+ template:
54
+ src: puma-process.conf
55
+ dest: /etc/collectd/collectd.conf.d/puma-process.conf
56
+ sudo: true
57
+ notify: restart collectd
58
+ when: puma_installed is defined
59
+
60
+ - name: create nginx config
61
+ template:
62
+ src: nginx.conf
63
+ dest: /etc/collectd/collectd.conf.d/nginx.conf
64
+ sudo: true
65
+ notify: restart collectd
66
+ when: nginx_installed is defined
67
+
@@ -0,0 +1,4 @@
1
+ LoadPlugin "nginx"
2
+ <Plugin "nginx">
3
+ URL "http://localhost:{{status_port}}"
4
+ </Plugin>
@@ -0,0 +1,3 @@
1
+ <Plugin processes>
2
+ ProcessMatch puma "puma: cluster"
3
+ </Plugin>
@@ -0,0 +1 @@
1
+ rails_lograge.conf
@@ -6,7 +6,7 @@
6
6
  src: delayed-job-monit-rc
7
7
  dest: /etc/monit/conf.d/delayed_job_{{project_name}}_{{rails_env}}
8
8
  sudo: true
9
- notify: monit
9
+ notify: reload_monit
10
10
 
11
11
  - name: Remove old upstart files
12
12
  file:
@@ -0,0 +1,2 @@
1
+ ---
2
+ client_max_body_size: 4G
@@ -19,5 +19,5 @@ location /cable {
19
19
  }
20
20
 
21
21
  error_page 500 502 503 504 /500.html;
22
- client_max_body_size 4G;
22
+ client_max_body_size {{client_max_body_size}};
23
23
  keepalive_timeout 10;
@@ -2,3 +2,4 @@
2
2
  server_aliases: []
3
3
  ssl_enabled: false
4
4
  nginx_ssl_config: ""
5
+ status_port: 8081
@@ -13,6 +13,19 @@
13
13
  include_role:
14
14
  name: nginx-rails
15
15
 
16
+ - name: create nginx status config
17
+ template:
18
+ src: status
19
+ dest: /etc/nginx/sites-available/status
20
+ become: true
21
+
22
+ - name: enable nginx status
23
+ file:
24
+ src: /etc/nginx/sites-available/status
25
+ dest: /etc/nginx/sites-enabled/status
26
+ state: link
27
+ become: true
28
+
16
29
  - name: Restart nginx
17
30
  action: service name=nginx state=restarted
18
31
  become: true
@@ -0,0 +1,10 @@
1
+ server {
2
+ listen {{status_port}};
3
+ server_name localhost;
4
+ location / {
5
+ stub_status on;
6
+ access_log off;
7
+ allow 127.0.0.1;
8
+ deny all;
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ deploy ALL=(root) NOPASSWD: /usr/sbin/passenger-status
@@ -0,0 +1,5 @@
1
+ - name: Add sudoers.d file so that deploy can run passenger-status without entering password.
2
+ copy:
3
+ src: sudoers-passenger
4
+ dest: /etc/sudoers.d/passenger
5
+ become: true
@@ -0,0 +1,5 @@
1
+ ---
2
+ puma_workers: 1
3
+ puma_min_threads: 4
4
+ puma_max_threads: 16
5
+
@@ -1,3 +1,6 @@
1
+ - set_fact:
2
+ puma_installed: true
3
+
1
4
  - name: Create shared/config/puma
2
5
  file: path=/u/apps/{{project_name}}/shared/config/puma group=deploy owner=deploy state=directory
3
6
  tags: puma
@@ -1,9 +1,7 @@
1
1
  # Change to match your CPU core count
2
- workers Integer(ENV['WEB_CONCURRENCY'] || 4)
3
-
4
- threads_count = Integer(ENV['MAX_THREADS'] || 5)
2
+ workers {{puma_workers}}
5
3
  # Min and Max threads per worker
6
- threads 0, threads_count
4
+ threads {{puma_min_threads}}, {{puma_max_threads}}
7
5
 
8
6
  app_dir = "/u/apps/{{project_name}}/current"
9
7
  directory app_dir
@@ -1,3 +1,3 @@
1
1
  module Subspace
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Samson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -117,6 +117,9 @@ files:
117
117
  - ansible/roles/collectd/templates/df.conf
118
118
  - ansible/roles/collectd/templates/graphite.conf
119
119
  - ansible/roles/collectd/templates/hostname.conf
120
+ - ansible/roles/collectd/templates/nginx.conf
121
+ - ansible/roles/collectd/templates/puma-process.conf
122
+ - ansible/roles/collectd/templates/rails_lograge.conf
120
123
  - ansible/roles/common/defaults/main.yml
121
124
  - ansible/roles/common/files/sudoers-service
122
125
  - ansible/roles/common/handlers/main.yml
@@ -163,6 +166,7 @@ files:
163
166
  - ansible/roles/mysql2_gem/tasks/main.yml
164
167
  - ansible/roles/newrelic/handlers/main.yml
165
168
  - ansible/roles/newrelic/tasks/main.yml
169
+ - ansible/roles/nginx-rails/defaults/main.yml
166
170
  - ansible/roles/nginx-rails/tasks/main.yml
167
171
  - ansible/roles/nginx-rails/templates/_rails.conf
168
172
  - ansible/roles/nginx-rails/templates/_upstream.conf
@@ -171,9 +175,12 @@ files:
171
175
  - ansible/roles/nginx/defaults/main.yml
172
176
  - ansible/roles/nginx/handlers/main.yml
173
177
  - ansible/roles/nginx/tasks/main.yml
178
+ - ansible/roles/nginx/templates/status
174
179
  - ansible/roles/papertrail/tasks/main.yml
175
180
  - ansible/roles/papertrail/templates/log_files.yml
181
+ - ansible/roles/passenger/files/sudoers-passenger
176
182
  - ansible/roles/passenger/meta/main.yml
183
+ - ansible/roles/passenger/tasks/main.yml
177
184
  - ansible/roles/postgis/.gitignore
178
185
  - ansible/roles/postgis/CHANGELOG.md
179
186
  - ansible/roles/postgis/LICENSE
@@ -189,6 +196,7 @@ files:
189
196
  - ansible/roles/postgresql/tasks/backups.yml
190
197
  - ansible/roles/postgresql/tasks/main.yml
191
198
  - ansible/roles/postgresql/templates/backup.sh
199
+ - ansible/roles/puma/defaults/main.yml
192
200
  - ansible/roles/puma/meta/main.yml
193
201
  - ansible/roles/puma/tasks/main.yml
194
202
  - ansible/roles/puma/templates/etc-puma.conf