zapp 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zapp/version.rb +1 -1
- metadata +3 -17
- data/.circleci/config.yml +0 -21
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.rubocop.yml +0 -51
- data/.ruby-version +0 -1
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -112
- data/Guardfile +0 -23
- data/LICENSE.txt +0 -21
- data/README.md +0 -91
- data/Rakefile +0 -8
- data/examples/config/app.rb +0 -5
- data/examples/config/puma.rb +0 -10
- data/examples/config/zapp.rb +0 -13
- data/zapp.gemspec +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6376583c1f6aa2986cd05bde3acb428b17e1eda1a7ef5a9e4369f8cc36edbb49
|
4
|
+
data.tar.gz: d291eb685e58724ec9a0f60805cab4dde979c602eff5666cb566cae894b91d44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e9d90b28c8bd661609e6f13e0bbb38ee7d96ae22482ac7490aaa1ccd752581770ad6a07963696c296b8c5ab02d3d4eafc748d1e58bce3d02817df9a4fd1f57
|
7
|
+
data.tar.gz: 1695771a852412c68aee27843d3d74fb2cd081da8897c0d2b09eb4d19a0aedb77f308271d07ca1dc0cc2561885eec046609fb06ef70febb20ea361fa4d19b4e9
|
data/lib/zapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias H Steffensen
|
@@ -97,25 +97,12 @@ dependencies:
|
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
- mathiashsteffensen@protonmail.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- zapp
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
104
|
-
- ".circleci/config.yml"
|
105
|
-
- ".gitignore"
|
106
|
-
- ".rspec"
|
107
|
-
- ".rubocop.yml"
|
108
|
-
- ".ruby-version"
|
109
|
-
- Gemfile
|
110
|
-
- Gemfile.lock
|
111
|
-
- Guardfile
|
112
|
-
- LICENSE.txt
|
113
|
-
- README.md
|
114
|
-
- Rakefile
|
115
105
|
- bin/zapp
|
116
|
-
- examples/config/app.rb
|
117
|
-
- examples/config/puma.rb
|
118
|
-
- examples/config/zapp.rb
|
119
106
|
- lib/rack/handler/zapp.rb
|
120
107
|
- lib/zapp.rb
|
121
108
|
- lib/zapp/cli.rb
|
@@ -135,7 +122,6 @@ files:
|
|
135
122
|
- lib/zapp/worker.rb
|
136
123
|
- lib/zapp/worker/request_processor.rb
|
137
124
|
- lib/zapp/worker_pool.rb
|
138
|
-
- zapp.gemspec
|
139
125
|
homepage: https://github.com/mathiashsteffensen/zapp
|
140
126
|
licenses:
|
141
127
|
- MIT
|
data/.circleci/config.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
orbs:
|
4
|
-
ruby: circleci/ruby@0.1.2
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
test_three_zero_zero:
|
8
|
-
docker:
|
9
|
-
- image: circleci/ruby:3.0.0
|
10
|
-
executor: ruby/default
|
11
|
-
steps:
|
12
|
-
- checkout
|
13
|
-
- ruby/bundle-install
|
14
|
-
- run:
|
15
|
-
name: RSpec
|
16
|
-
command: bundle exec rspec
|
17
|
-
|
18
|
-
workflows:
|
19
|
-
test:
|
20
|
-
jobs:
|
21
|
-
- test_three_zero_zero
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 3.0.0
|
3
|
-
EnabledByDefault: true
|
4
|
-
NewCops: enable
|
5
|
-
Exclude:
|
6
|
-
- examples/**/*
|
7
|
-
|
8
|
-
Gemspec/RequireMFA:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
Style/DocumentationMethod:
|
12
|
-
Enabled: false
|
13
|
-
Style/MissingElse:
|
14
|
-
Enabled: false
|
15
|
-
Style/StringLiterals:
|
16
|
-
EnforcedStyle: double_quotes
|
17
|
-
Style/InlineComment:
|
18
|
-
Enabled: false
|
19
|
-
Style/Copyright:
|
20
|
-
Enabled: false
|
21
|
-
Style/ConstantVisibility:
|
22
|
-
Enabled: false
|
23
|
-
Style/MethodCallWithArgsParentheses:
|
24
|
-
IgnoreMacros: false
|
25
|
-
Style/MethodCalledOnDoEndBlock:
|
26
|
-
Enabled: false
|
27
|
-
Style/DisableCopsWithinSourceCodeDirective:
|
28
|
-
Enabled: false
|
29
|
-
Style/Send:
|
30
|
-
Enabled: false
|
31
|
-
Style/ClassMethodsDefinitions:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Lint/ConstantResolution:
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
Bundler/GemComment:
|
38
|
-
Enabled: false
|
39
|
-
|
40
|
-
Layout/MultilineAssignmentLayout:
|
41
|
-
Enabled: false
|
42
|
-
Layout/RedundantLineBreak:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Metrics/BlockLength:
|
46
|
-
Exclude:
|
47
|
-
- spec/**/*_spec.rb
|
48
|
-
Metrics/MethodLength:
|
49
|
-
Max: 25
|
50
|
-
Metrics/AbcSize:
|
51
|
-
Max: 30
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.0
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source("https://rubygems.org")
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in zap.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
group(:development) do
|
9
|
-
gem("guard", "~> 2.18.0")
|
10
|
-
gem("guard-rspec", "~> 4.7.3")
|
11
|
-
gem("guard-rubocop", "~> 1.5.0")
|
12
|
-
gem("simplecov", "~> 0.21.2")
|
13
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
zapp (0.2.1)
|
5
|
-
concurrent-ruby (~> 1.1.9)
|
6
|
-
puma (~> 5.5.2)
|
7
|
-
rack (~> 2.2.3)
|
8
|
-
rake (~> 13.0)
|
9
|
-
rspec (~> 3.0)
|
10
|
-
webrick
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
ast (2.4.2)
|
16
|
-
coderay (1.1.3)
|
17
|
-
concurrent-ruby (1.1.10)
|
18
|
-
diff-lcs (1.4.4)
|
19
|
-
docile (1.4.0)
|
20
|
-
ffi (1.15.4)
|
21
|
-
formatador (0.3.0)
|
22
|
-
guard (2.18.0)
|
23
|
-
formatador (>= 0.2.4)
|
24
|
-
listen (>= 2.7, < 4.0)
|
25
|
-
lumberjack (>= 1.0.12, < 2.0)
|
26
|
-
nenv (~> 0.1)
|
27
|
-
notiffany (~> 0.0)
|
28
|
-
pry (>= 0.13.0)
|
29
|
-
shellany (~> 0.0)
|
30
|
-
thor (>= 0.18.1)
|
31
|
-
guard-compat (1.2.1)
|
32
|
-
guard-rspec (4.7.3)
|
33
|
-
guard (~> 2.1)
|
34
|
-
guard-compat (~> 1.1)
|
35
|
-
rspec (>= 2.99.0, < 4.0)
|
36
|
-
guard-rubocop (1.5.0)
|
37
|
-
guard (~> 2.0)
|
38
|
-
rubocop (< 2.0)
|
39
|
-
listen (3.7.0)
|
40
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
41
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
42
|
-
lumberjack (1.2.8)
|
43
|
-
method_source (1.0.0)
|
44
|
-
nenv (0.3.0)
|
45
|
-
nio4r (2.5.8)
|
46
|
-
notiffany (0.1.3)
|
47
|
-
nenv (~> 0.1)
|
48
|
-
shellany (~> 0.0)
|
49
|
-
parallel (1.21.0)
|
50
|
-
parser (3.0.2.0)
|
51
|
-
ast (~> 2.4.1)
|
52
|
-
pry (0.14.1)
|
53
|
-
coderay (~> 1.1)
|
54
|
-
method_source (~> 1.0)
|
55
|
-
puma (5.5.2)
|
56
|
-
nio4r (~> 2.0)
|
57
|
-
rack (2.2.4)
|
58
|
-
rainbow (3.0.0)
|
59
|
-
rake (13.0.6)
|
60
|
-
rb-fsevent (0.11.0)
|
61
|
-
rb-inotify (0.10.1)
|
62
|
-
ffi (~> 1.0)
|
63
|
-
regexp_parser (2.1.1)
|
64
|
-
rexml (3.2.5)
|
65
|
-
rspec (3.10.0)
|
66
|
-
rspec-core (~> 3.10.0)
|
67
|
-
rspec-expectations (~> 3.10.0)
|
68
|
-
rspec-mocks (~> 3.10.0)
|
69
|
-
rspec-core (3.10.1)
|
70
|
-
rspec-support (~> 3.10.0)
|
71
|
-
rspec-expectations (3.10.1)
|
72
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
73
|
-
rspec-support (~> 3.10.0)
|
74
|
-
rspec-mocks (3.10.2)
|
75
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
-
rspec-support (~> 3.10.0)
|
77
|
-
rspec-support (3.10.3)
|
78
|
-
rubocop (1.21.0)
|
79
|
-
parallel (~> 1.10)
|
80
|
-
parser (>= 3.0.0.0)
|
81
|
-
rainbow (>= 2.2.2, < 4.0)
|
82
|
-
regexp_parser (>= 1.8, < 3.0)
|
83
|
-
rexml
|
84
|
-
rubocop-ast (>= 1.9.1, < 2.0)
|
85
|
-
ruby-progressbar (~> 1.7)
|
86
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
87
|
-
rubocop-ast (1.11.0)
|
88
|
-
parser (>= 3.0.1.1)
|
89
|
-
ruby-progressbar (1.11.0)
|
90
|
-
shellany (0.0.1)
|
91
|
-
simplecov (0.21.2)
|
92
|
-
docile (~> 1.1)
|
93
|
-
simplecov-html (~> 0.11)
|
94
|
-
simplecov_json_formatter (~> 0.1)
|
95
|
-
simplecov-html (0.12.3)
|
96
|
-
simplecov_json_formatter (0.1.3)
|
97
|
-
thor (1.1.0)
|
98
|
-
unicode-display_width (2.1.0)
|
99
|
-
webrick (1.7.0)
|
100
|
-
|
101
|
-
PLATFORMS
|
102
|
-
x86_64-linux
|
103
|
-
|
104
|
-
DEPENDENCIES
|
105
|
-
guard (~> 2.18.0)
|
106
|
-
guard-rspec (~> 4.7.3)
|
107
|
-
guard-rubocop (~> 1.5.0)
|
108
|
-
simplecov (~> 0.21.2)
|
109
|
-
zapp!
|
110
|
-
|
111
|
-
BUNDLED WITH
|
112
|
-
2.3.0.dev
|
data/Guardfile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
%w[lib spec].select { |d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist") }
|
4
|
-
|
5
|
-
guard(:rspec, cmd: "bundle exec rspec --format progress") do
|
6
|
-
require("guard/rspec/dsl")
|
7
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
8
|
-
|
9
|
-
# RSpec files
|
10
|
-
rspec = dsl.rspec
|
11
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
12
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
13
|
-
watch(rspec.spec_files)
|
14
|
-
|
15
|
-
# Ruby files
|
16
|
-
ruby = dsl.ruby
|
17
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
18
|
-
end
|
19
|
-
|
20
|
-
guard(:rubocop) do
|
21
|
-
watch(/.+\.rb$/)
|
22
|
-
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
23
|
-
end
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2021 Mathias H Steffensen
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# Zapp
|
2
|
-
|
3
|
-
![CircleCI](https://circleci.com/gh/mathiashsteffensen/zapp/tree/master.svg?style=shield)
|
4
|
-
|
5
|
-
Zapp is an experimental web server for Rack-based Ruby applications. It is based on the lightning fast [Puma](https://puma.io/) HTTP parser implemented in C,
|
6
|
-
and the new parallelism implementation introduced with CRuby 3.0.0, [Ractors](https://github.com/ruby/ruby/blob/master/doc/ractor.md)
|
7
|
-
|
8
|
-
This is an experimental project as Ractors are very very new and the Ractor API may change at any moment. While I would not recommend using this server in production for that reason,
|
9
|
-
if you do decide to do so, pin your ruby version to one of the versions this project is tested against (Currently only version 3.0.0).
|
10
|
-
|
11
|
-
Why is it named Zapp with 2 p's you may ask? Because Zap with 1 p was taken.
|
12
|
-
|
13
|
-
Also it's meant to be pretty fast
|
14
|
-
|
15
|
-
## Installation
|
16
|
-
|
17
|
-
As a stand-alone ruby executable
|
18
|
-
```bash
|
19
|
-
gem install zapp
|
20
|
-
```
|
21
|
-
|
22
|
-
Or using Bundler, add the following to your gemfile
|
23
|
-
```ruby
|
24
|
-
gem("zapp")
|
25
|
-
```
|
26
|
-
|
27
|
-
And then run
|
28
|
-
```bash
|
29
|
-
bundle
|
30
|
-
```
|
31
|
-
|
32
|
-
## Usage
|
33
|
-
|
34
|
-
The CLI tool is meant to be dead simple, and all configuration should be done through a configuration file.
|
35
|
-
By default Zapp will look for a config file located at ./config/zapp.rb from where the command is run.
|
36
|
-
To change this you can provide the optional -c flag when running the command.
|
37
|
-
|
38
|
-
To use a config file at ./configuration/server.rb:
|
39
|
-
```bash
|
40
|
-
bundle exec zapp -c ./configuration/server.rb
|
41
|
-
```
|
42
|
-
|
43
|
-
An example config file using Zapp's DSL may look like the following
|
44
|
-
```ruby
|
45
|
-
# frozen_string_literal: true
|
46
|
-
|
47
|
-
# A simple web server
|
48
|
-
class App
|
49
|
-
def self.call(_env)
|
50
|
-
[200, {}, ["Hello from Zapp"]]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Register the app
|
55
|
-
app(App)
|
56
|
-
|
57
|
-
# Launch 2 parallel Zapp workers
|
58
|
-
parallelism(2)
|
59
|
-
|
60
|
-
# Have Zapp be quiet
|
61
|
-
# (by default Zapp workers time requests and log when they have been processed)
|
62
|
-
log_requests(false)
|
63
|
-
|
64
|
-
# Let's bind to 0.0.0.0 instead of localhost
|
65
|
-
# since we may run the server from a Docker container
|
66
|
-
host("0.0.0.0")
|
67
|
-
|
68
|
-
# Use port 8080 (3000 is the default)
|
69
|
-
port(8080)
|
70
|
-
```
|
71
|
-
|
72
|
-
Run the app
|
73
|
-
```bash
|
74
|
-
bundle exec zapp
|
75
|
-
```
|
76
|
-
|
77
|
-
## Implementation details
|
78
|
-
|
79
|
-
* Parsing is done in a single thread
|
80
|
-
* Puma's HTTP Parser can not be shared between Ractors, and it cannot be copied to a Ractor so parsing can be done in parallel, I have a suspicion this is due to it being a C extension.
|
81
|
-
If you have any suggestions for how to implement parallel parsing, please file a PR or an issue.
|
82
|
-
* Request processing is done in parallel using the Ractor API
|
83
|
-
|
84
|
-
## TODO
|
85
|
-
|
86
|
-
* Add way more tests to all parts of the library
|
87
|
-
* Resolve Rails/Ractor compatibility issues
|
88
|
-
* Add thread pool per worker
|
89
|
-
* Add some benchmarks against Puma, quite interesting to see how Ractors perform
|
90
|
-
* PID file support
|
91
|
-
* Support for rack_options
|
data/Rakefile
DELETED
data/examples/config/app.rb
DELETED
data/examples/config/puma.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require_relative("app")
|
2
|
-
|
3
|
-
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
|
4
|
-
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
5
|
-
threads(min_threads_count, max_threads_count)
|
6
|
-
worker_timeout(3600) if ENV.fetch("RAILS_ENV", "development") == "development"
|
7
|
-
port(ENV.fetch("PORT", 3000))
|
8
|
-
environment(ENV.fetch("RAILS_ENV", "development"))
|
9
|
-
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
10
|
-
app(App)
|
data/examples/config/zapp.rb
DELETED
data/zapp.gemspec
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative("lib/zapp/version")
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "zapp"
|
7
|
-
spec.version = Zapp::VERSION
|
8
|
-
spec.authors = ["Mathias H Steffensen"]
|
9
|
-
spec.email = ["mathiashsteffensen@protonmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "A Web Server based on Ractors, for Rack-based Ruby applications"
|
12
|
-
spec.homepage = "https://github.com/mathiashsteffensen/zapp"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
15
|
-
|
16
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/mathiashsteffensen/zapp"
|
18
|
-
spec.metadata["changelog_uri"] = "https://github.com/mathiashsteffensen/zapp/blob/master/CHANGELOG.md"
|
19
|
-
|
20
|
-
# Which files should be added to the gem when it is released.
|
21
|
-
spec.files =
|
22
|
-
Dir.chdir(File.expand_path(__dir__)) do
|
23
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:spec|example)/}) }
|
24
|
-
end
|
25
|
-
spec.bindir = "bin"
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
|
28
|
-
# This is of course a web server for Rack applications
|
29
|
-
spec.add_dependency("rack", "~> 2.2.3")
|
30
|
-
|
31
|
-
# Use Puma's C-based HttpParser, it's fast as hell
|
32
|
-
spec.add_dependency("puma", "~> 5.5.2")
|
33
|
-
|
34
|
-
spec.add_dependency("webrick")
|
35
|
-
|
36
|
-
# Concurrent ruby for managing Thread pools
|
37
|
-
spec.add_dependency("concurrent-ruby", "~> 1.1.9")
|
38
|
-
|
39
|
-
# Rake for task running
|
40
|
-
spec.add_dependency("rake", "~> 13.0")
|
41
|
-
|
42
|
-
# RSpec for testing
|
43
|
-
spec.add_dependency("rspec", "~> 3.0")
|
44
|
-
end
|