jugglite 0.0.4 → 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b8b36b0f752a876d6d10ca1661706aa5c2440cc
4
+ data.tar.gz: e13785f1c6119aba08962b54757bbdd5867c9e6f
5
+ SHA512:
6
+ metadata.gz: 734a89a4f52d0bca5a1eb9860125cd7a590d485e8ee25988903fdc64932be50088f81da4101aa6970ac29654f2fb9faca21e439d9fb86552069082f4e1989590
7
+ data.tar.gz: 046044ba7e83f763141c9010cad5df8446937e5e24e35142bcc5e7923110f4393d76f4981f9d6f46b189ed3f449fc77a2378b0044f3d37cae5eedc4021818ab4
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Server Usage
22
22
 
23
- I use jugglite as rack middleware in development and as a standalone cluster in production behind nginx.
23
+ I use jugglite as rack middleware in development and as a standalone binary behind nginx in production.
24
24
 
25
25
  ### Stand-alone binary
26
26
 
@@ -30,16 +30,66 @@ You can run the binary from any terminal like this (these options are the defaul
30
30
 
31
31
  `jugglite --address 0.0.0.0 --port 3000 --max-conns 1024`
32
32
 
33
- ### As rack middleware
33
+ ### As Rack middleware (development)
34
34
 
35
- Add it to your `config.ru` file:
36
- `use Juglite::App, path: '/stream'` (use the `path` option )
35
+ Add it to your `config.ru` file and make sure your application runs using Thin:
37
36
 
38
- ### As a cluster behind Nginx reverse proxy
37
+ ```ruby
38
+ require ::File.expand_path('../config/environment', __FILE__)
39
+ # Embed Jugglite when running in development
40
+ use Jugglite::App, path: '/stream' if ENV['RACK_ENV'] == 'development'
41
+ run MyRails::Application
42
+ ```
43
+
44
+ ### Behind Nginx (production)
39
45
 
40
46
  NOTE: because the html5 SSE implementation requires the connection to have the same hostname and port, you'll need to add a reverse proxy in front of your app and jugglite.
41
47
 
42
- TODO with Foreman?
48
+ This is an example nginx configuration with Unicorn and Jugglite. Make sure you set `proxy_buffering off;` in your Nginx configuration.
49
+
50
+ ```nginx
51
+ # Start jugglite with: jugglite --socket /tmp/jugglite.sock
52
+ upstream jugglite-example {
53
+ server unix:/tmp/jugglite.sock fail_timeout=0;
54
+ }
55
+
56
+ # Start unicorn with: unicorn --listen /tmp/unicorn.sock --config-file unicorn_conf.rb
57
+ upstream unicorn-example {
58
+ server unix:/tmp/unicorn.sock fail_timeout=0;
59
+ }
60
+
61
+ server {
62
+ listen [::]:80 deferred;
63
+ server_name example.com;
64
+ root /var/www/example/current/public;
65
+
66
+ # Let Nginx serve assets statically
67
+ location ^~ /assets/ {
68
+ gzip_static on;
69
+ expires max;
70
+ add_header Cache-Control public;
71
+ }
72
+
73
+ # Forward /stream to Jugglite and set proxy_buffering off
74
+ location ^~ /stream {
75
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
76
+ proxy_set_header Host $http_host;
77
+ proxy_redirect off;
78
+ proxy_buffering off;
79
+ proxy_pass http://jugglite-example;
80
+ }
81
+
82
+ # Forward all other requests to Unicorn
83
+ try_files $uri/index.html $uri @unicorn;
84
+ location @unicorn {
85
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
86
+ proxy_set_header Host $http_host;
87
+ proxy_redirect off;
88
+ proxy_pass http://unicorn-example;
89
+ }
90
+ }
91
+ ```
92
+
43
93
 
44
94
  ## Client Usage
45
95
 
data/lib/jugglite/app.rb CHANGED
@@ -60,7 +60,7 @@ module Jugglite
60
60
 
61
61
  def setup_redis
62
62
  @redis_channels = Set.new
63
- @async_redis = EM::Hiredis.connect
63
+ @async_redis = EM::Hiredis.connect.pubsub
64
64
  @async_redis.on(:message) do |channel, message|
65
65
  expedite_incoming_message(channel, message)
66
66
  end
@@ -1,3 +1,3 @@
1
1
  module Jugglite
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jugglite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - andruby
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thin
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: em-hiredis
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: redis
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Lightweight SSE server
@@ -83,9 +74,9 @@ executables:
83
74
  extensions: []
84
75
  extra_rdoc_files: []
85
76
  files:
86
- - .gitignore
87
- - .rspec
88
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
89
80
  - CHANGELOG
90
81
  - Gemfile
91
82
  - LICENSE.txt
@@ -103,31 +94,29 @@ files:
103
94
  - spec/spec_helper.rb
104
95
  homepage: http://github.com/andruby/jugglite
105
96
  licenses: []
97
+ metadata: {}
106
98
  post_install_message:
107
99
  rdoc_options: []
108
100
  require_paths:
109
101
  - lib
110
102
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
103
  requirements:
113
- - - ! '>='
104
+ - - ">="
114
105
  - !ruby/object:Gem::Version
115
106
  version: '0'
116
107
  required_rubygems_version: !ruby/object:Gem::Requirement
117
- none: false
118
108
  requirements:
119
- - - ! '>='
109
+ - - ">="
120
110
  - !ruby/object:Gem::Version
121
111
  version: '0'
122
112
  requirements: []
123
113
  rubyforge_project:
124
- rubygems_version: 1.8.23
114
+ rubygems_version: 2.2.1
125
115
  signing_key:
126
- specification_version: 3
116
+ specification_version: 4
127
117
  summary: Server Sent Events server written in rack on top of thin inspired by Juggernaut
128
118
  for real time push
129
119
  test_files:
130
120
  - spec/acceptance/stream_and_publish_spec.rb
131
121
  - spec/benchmark/max_connections.rb
132
122
  - spec/spec_helper.rb
133
- has_rdoc: