orats 0.9.2 → 0.9.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: cbccb8c00361dea723d301183745797447eeeb4f
4
- data.tar.gz: dbad0eeb8335a5757768e2caa618c58bbcd3a6a4
3
+ metadata.gz: 83d8c43283eef490327ff90675b0e529a7357bab
4
+ data.tar.gz: 9a1776f981cc18005e89c35e44aa83801038e777
5
5
  SHA512:
6
- metadata.gz: 65e9bbdc2b9213da36d70496563f408862a6e9f5e6c70298df9a143d80c59d9b1db1cb5f1adac574838551a74513e01b4f79e33fe7eabfbbb2ce577b64769da9
7
- data.tar.gz: 3921fb46ed73e72dadbbd4a49c647165141671de60b866f1c159fc0a44b1a4c667b2a19c5eae473ac7a977b5566d43c42a650a3c3f224211d9aae5cf7d976a65
6
+ metadata.gz: a2682482822e5a30a57568a0696a44b00afc750d2bc2907e01e2399d29208b8525fe287db1ef59b3dc307f422a6be2daee586ba65c6cf2f2c8cbd0da8ba27bad
7
+ data.tar.gz: 355f88e955b843ab9d1f7bcb4b890e42c93551d3587dc00474101045dc1b546b131f4efa5d5c6843d42ddfcba43c319164a98fcb5fc99dd79c5d974c452bd6d3
data/README.md CHANGED
@@ -145,6 +145,7 @@ All of the changes have git commits to go with them. After generating a project
145
145
  - Add disqus
146
146
  - **Public**:
147
147
  - Add 404, 422, 500 and 502 pages so they can be served directly from your reverse proxy
148
+ - Add a deploy page that could be swapped in/out during server deploys
148
149
  - Add all of the favicons output by the favicon generator
149
150
 
150
151
  #### Try the base template
@@ -358,15 +358,16 @@ def add_layout_partials
358
358
  commit 'Add layout partials'
359
359
  end
360
360
 
361
- def add_http_error_pages
361
+ def add_public_html_pages
362
362
  task __method__
363
363
 
364
364
  orats_to_local 'public/404.html'
365
365
  orats_to_local 'public/422.html'
366
366
  orats_to_local 'public/500.html'
367
367
  orats_to_local 'public/502.html'
368
+ orats_to_local 'public/deploy.html'
368
369
 
369
- commit 'Add http status code pages'
370
+ commit 'Add public html pages'
370
371
  end
371
372
 
372
373
  def update_sass
@@ -517,7 +518,7 @@ add_favicon_task
517
518
  add_helpers
518
519
  add_layout
519
520
  add_layout_partials
520
- add_http_error_pages
521
+ add_public_html_pages
521
522
  update_sass
522
523
  update_coffeescript
523
524
  remove_unused_files_from_git
@@ -29,6 +29,9 @@ ACTION_MAILER_DEFAULT_TO: 'me@app_name.com'
29
29
  DATABASE_URL: 'postgresql://db_user@db_location:db_port/app_name?encoding=utf8&pool=5&timeout=5000'
30
30
  CACHE_URL: 'redis://cache_location:cache_port/0'
31
31
 
32
+ # listen on a tcp port or unix socket
33
+ LISTEN_ON: '0.0.0.0:3000'
34
+
32
35
  # try setting these to 0/16 in production and tweak from there
33
36
  # in development mode you should use 0/1 ( multi-threaded + debugging = :< )
34
37
  # these only apply if you're using puma
@@ -1,26 +1,37 @@
1
- environment ENV['RAILS_ENV']
2
-
1
+ # Feel free to experiment with this, 0/16 is a good starting point.
3
2
  threads ENV['THREADS_MIN'].to_i, ENV['THREADS_MAX'].to_i
3
+
4
+ # Go with at least 1 per CPU core, a higher amount will usually help for fast
5
+ # responses such as reading from a cache.
4
6
  workers ENV['WORKERS'].to_i
5
7
 
6
- if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'
7
- bind 'tcp://0.0.0.0:3000'
8
+ # Listen on a tcp port or unix socket.
9
+ if ENV['LISTEN_ON'].include?(':')
10
+ bind "tcp://#{ENV['LISTEN_ON']}"
8
11
  else
9
- bind "unix:#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}"
12
+ bind "unix:#{ENV['LISTEN_ON']}"
10
13
  end
11
14
 
15
+ # The path where the pid file will be written to.
12
16
  pidfile "#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}.pid"
13
17
 
18
+ # Use a shorter timeout instead of the 60s default. If you are handling large
19
+ # uploads you may want to increase this.
14
20
  worker_timeout 30
15
21
 
22
+ # The paths to where logs will be written to.
16
23
  stdout_redirect "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}.access.log",
17
24
  "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}.error.log"
18
25
 
26
+ # Preload the application before starting the workers.
19
27
  preload_app!
20
28
 
21
- restart_command 'bundle exec puma'
29
+ # The path to the puma binary without any arguments, it will inherit everything
30
+ # from the original process.
31
+ restart_command 'bin/puma'
22
32
 
23
33
  on_worker_boot do
34
+ # Don't bother having the master process hang onto older connections.
24
35
  defined?(ActiveRecord::Base) and
25
36
  ActiveRecord::Base.connection.disconnect!
26
37
 
@@ -1,30 +1,45 @@
1
- # heavily inspired by gitlab:
1
+ # Heavily inspired by gitlab:
2
2
  # https://github.com/gitlabhq/gitlabhq/blob/master/config/unicorn.rb.example
3
3
 
4
+ # Go with at least 1 per CPU core, a higher amount will usually help for fast
5
+ # responses such as reading from a cache.
4
6
  worker_processes ENV['WORKERS'].to_i
5
7
 
6
- if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'
7
- listen '0.0.0.0:3000'
8
+ # Listen on a tcp port or unix socket.
9
+ if ENV['LISTEN_ON'].include?(':')
10
+ listen ENV['LISTEN_ON']
8
11
  else
9
- listen "unix:#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}",
10
- backlog: 64
12
+ # Use a shorter socket backlog for quicker failover when busy.
13
+ listen ENV['LISTEN_ON'], backlog: 64
11
14
  end
12
15
 
16
+ # The path where the pid file will be written to.
13
17
  pid "#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}.pid"
14
18
 
19
+ # Use a shorter timeout instead of the 60s default. If you are handling large
20
+ # uploads you may want to increase this.
15
21
  timeout 30
16
22
 
23
+ # The paths to where logs will be written to.
17
24
  stdout_path "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}.access.log"
18
25
  stderr_path "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}.error.log"
19
26
 
27
+ # Combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings:
28
+ # http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
20
29
  preload_app true
21
-
22
30
  GC.respond_to?(:copy_on_write_friendly=) and
23
31
  GC.copy_on_write_friendly = true
24
32
 
33
+ # Enable this flag to have unicorn test client connections by writing the
34
+ # beginning of the HTTP headers before calling the application. This
35
+ # prevents calling the application for connections that have disconnected
36
+ # while queued. This is only guaranteed to detect clients on the same
37
+ # host unicorn runs on, and unlikely to detect disconnects even on a
38
+ # fast LAN.
25
39
  check_client_connection false
26
40
 
27
41
  before_fork do |server, worker|
42
+ # Don't bother having the master process hang onto older connections.
28
43
  defined?(ActiveRecord::Base) and
29
44
  ActiveRecord::Base.connection.disconnect!
30
45
 
@@ -45,9 +60,25 @@ before_fork do |server, worker|
45
60
  rescue Errno::ENOENT, Errno::ESRCH
46
61
  end
47
62
  end
63
+
64
+ # Throttle the master from forking too quickly by sleeping. Due
65
+ # to the implementation of standard Unix signal handlers, this
66
+ # helps (but does not completely) prevent identical, repeated signals
67
+ # from being lost when the receiving process is busy.
68
+ # sleep 1
48
69
  end
49
70
 
50
71
  after_fork do |server, worker|
72
+ # Per-process listener ports for debugging, admin, migrations, etc..
73
+ # addr = "127.0.0.1:#{9293 + worker.nr}"
74
+ # server.listen(addr, tries: -1, delay: 5, tcp_nopush: true)
75
+
51
76
  defined?(ActiveRecord::Base) and
52
77
  ActiveRecord::Base.establish_connection
78
+
79
+ # If preload_app is true, then you may also want to check and
80
+ # restart any other shared sockets/descriptors such as Memcached,
81
+ # and Redis. TokyoCabinet file handles are safe to reuse
82
+ # between any number of forked children (assuming your kernel
83
+ # correctly implements pread()/pwrite() system calls).
53
84
  end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The server is being updated</title>
5
+ <meta charset="utf-8"/>
6
+ <style>
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <h1>The server is being updated</h1>
12
+ <p>A new version of this site is being deployed right now. Please try again in about a minute or less.</p>
13
+ </body>
14
+ </html>
@@ -1,4 +1,4 @@
1
1
  # set the version of this gem
2
2
  module Orats
3
- VERSION = '0.9.2'
3
+ VERSION = '0.9.3'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Janetakis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -143,6 +143,7 @@ files:
143
143
  - lib/orats/templates/includes/new/rails/public/422.html
144
144
  - lib/orats/templates/includes/new/rails/public/500.html
145
145
  - lib/orats/templates/includes/new/rails/public/502.html
146
+ - lib/orats/templates/includes/new/rails/public/deploy.html
146
147
  - lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml
147
148
  - lib/orats/templates/includes/new/rails/test/models/account_test.rb
148
149
  - lib/orats/ui.rb