falcon 0.35.5 → 0.35.6

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
  SHA256:
3
- metadata.gz: e83bfe3390b43efac4ff13076a198647d1b0e4da68c9341fb6253a70f03c65d3
4
- data.tar.gz: 0c915210a960b159ced61e91f807c63ffae9f3b22313e1f1b806ffa83422a529
3
+ metadata.gz: d7d2d4155e79287bfe7dd04ae2c5cc534be8133858c69c1c053ce26b04f08d43
4
+ data.tar.gz: fa93053422138e450a6f2ba8f1fbb68c62c50286d1380e727a56f9c8529a575a
5
5
  SHA512:
6
- metadata.gz: f97f776a63c1541874af780652096e5dee4e197ccaf04a1c3e2b5c4d6b72a508b29527281f5d5e6e6c64ec40fdc3c6e16a66e69dd44cafb407326c77977a503c
7
- data.tar.gz: c4aae4c9610fb77e017e5f91bab938855b24662d80a5188b199397e98c41d42c6fc84db5ad377ec13cfb01610a2819a23c9c431092d67d39cfb9f06be73d4c54
6
+ metadata.gz: eb2d35183a7dcb578cb0273a8d68b559837f9b02e5ed8202ff861a05d7af5c16b8c82a2fdf2238ca1a87a30954e515d788d53543b927038e3eb25978e802d806
7
+ data.tar.gz: 5cefb2f9b4211e7082b9ee26e869fbf160c8ff7955f2886649904d9842e1f194bb13c1fc97cf2b1773387f40dc3bf5970af4d16f91df47cd272260e0790d3361
data/README.md CHANGED
@@ -47,39 +47,16 @@ Alternatively, install in terminal:
47
47
 
48
48
  You can run `falcon serve` directly. It will load the `config.ru` and start serving on https://localhost:9292. Please [try the interactive online tutorial](https://katacoda.com/ioquatix/scenarios/falcon-introduction).
49
49
 
50
- The `falcon serve` command has the following options for you to use:
51
-
52
- ```
53
- $ falcon --help
54
- falcon [--verbose | --quiet] [-h/--help] [-v/--version] <command>
55
- An asynchronous HTTP server.
56
-
57
- [--verbose | --quiet] Verbosity of output for debugging.
58
- [-h/--help] Print out help information.
59
- [-v/--version] Print out the application version.
60
- <command> One of: serve, virtual. Default: serve
61
-
62
- serve [-b/--bind <address>] [-p/--port <number>] [-h/--hostname <hostname>] [-t/--timeout <duration>] [--reuse-port] [-c/--config <path>] [--forked | --threaded | --hybrid] [-n/--count <count>] [--forks <count>] [--threads <count>]
63
- Run an HTTP server.
64
-
65
- [-b/--bind <address>] Bind to the given hostname/address Default: https://localhost:9292
66
- [-p/--port <number>] Override the specified port
67
- [-h/--hostname <hostname>] Specify the hostname which would be used for certificates, etc.
68
- [-t/--timeout <duration>] Specify the maximum time to wait for blocking operations. Default: 60
69
- [--reuse-port] Enable SO_REUSEPORT if possible. Default: false
70
- [-c/--config <path>] Rackup configuration file to load Default: config.ru
71
- [--forked | --threaded | --hybrid] Select a specific parallelism model Default: forked
72
- [-n/--count <count>] Number of instances to start. Default: 8
73
- [--forks <count>] Number of forks (hybrid only).
74
- [--threads <count>] Number of threads (hybrid only).
75
- ```
76
-
77
50
  To run on a different port:
78
51
 
79
52
  ```
80
53
  $ falcon serve --port 3000
81
54
  ```
82
55
 
56
+ ### Production
57
+
58
+
59
+
83
60
  ### Virtual Hosts
84
61
 
85
62
  Falcon can replace Nginx as a virtual server for Ruby applications. **This is an experimental feature**.
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'falcon'
4
+ gem 'sequel'
@@ -0,0 +1,8 @@
1
+ # config.ru
2
+ require 'sequel'
3
+
4
+ # Turn on single threaded mode
5
+ Sequel.single_threaded = true
6
+ DB = Sequel.sqlite('data.sqlite3')
7
+
8
+ run(proc{|env| [200, {}, [DB[:user].get(:name)]]})
Binary file
data/falcon.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency 'samovar', "~> 2.1"
31
31
  spec.add_dependency 'localhost', "~> 1.1"
32
- spec.add_dependency 'build-environment', '~> 1.11'
32
+ spec.add_dependency 'build-environment', '~> 1.13'
33
33
 
34
34
  spec.add_dependency 'process-metrics', '~> 0.1.0'
35
35
 
@@ -70,10 +70,10 @@ module Falcon
70
70
  protocol = meta['rack.protocol']
71
71
 
72
72
  # https://tools.ietf.org/html/rfc7231#section-7.4.2
73
- # headers.add('server', "falcon/#{Falcon::VERSION}")
73
+ headers.add('server', "falcon/#{Falcon::VERSION}")
74
74
 
75
75
  # https://tools.ietf.org/html/rfc7231#section-7.1.1.2
76
- # headers.add('date', Time.now.httpdate)
76
+ headers.add('date', Time.now.httpdate)
77
77
 
78
78
  return self.new(status, headers, body, protocol)
79
79
  end
@@ -60,6 +60,8 @@ module Falcon
60
60
  buffer.puts "- To reload: kill -HUP #{Process.pid}"
61
61
  end
62
62
 
63
+ Bundler.require(:preload)
64
+
63
65
  self.controller.run
64
66
  end
65
67
  end
@@ -138,6 +138,8 @@ module Falcon
138
138
  load(full_path)
139
139
  end
140
140
 
141
+ Bundler.require(:preload)
142
+
141
143
  if GC.respond_to?(:compact)
142
144
  GC.compact
143
145
  end
@@ -25,7 +25,7 @@ load :application
25
25
  add(:rack, :application) do
26
26
  config_path {::File.expand_path("config.ru", root)}
27
27
 
28
- cache true
28
+ cache false
29
29
 
30
30
  middleware do
31
31
  app, _ = ::Rack::Builder.parse_file(config_path)
@@ -71,6 +71,7 @@ module Falcon
71
71
  def setup(container)
72
72
  container.run(name: self.name, restart: true, **@command.container_options) do |instance|
73
73
  Async do |task|
74
+ # Load one app instance per container:
74
75
  app = self.load_app
75
76
 
76
77
  task.async do
@@ -35,7 +35,8 @@ module Falcon
35
35
  end
36
36
 
37
37
  def middleware
38
- @evaluator.middleware
38
+ # In a multi-threaded container, we don't want to modify the shared evaluator's cache, so we create a new evaluator:
39
+ @environment.evaluator.middleware
39
40
  end
40
41
 
41
42
  def preload!
@@ -61,11 +62,14 @@ module Falcon
61
62
  end
62
63
 
63
64
  def setup(container)
65
+ protocol = self.protocol
66
+ scheme = self.scheme
67
+
64
68
  container.run(name: self.name, restart: true) do |instance|
65
69
  Async(logger: logger) do |task|
66
70
  Async.logger.info(self) {"Starting application server for #{self.root}..."}
67
71
 
68
- server = Server.new(self.middleware, @bound_endpoint, self.protocol, self.scheme)
72
+ server = Server.new(self.middleware, @bound_endpoint, protocol, scheme)
69
73
 
70
74
  server.run
71
75
 
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Falcon
24
- VERSION = "0.35.5"
24
+ VERSION = "0.35.6"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.5
4
+ version: 0.35.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.11'
131
+ version: '1.13'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.11'
138
+ version: '1.13'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: process-metrics
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -302,6 +302,9 @@ files:
302
302
  - examples/push/style.css
303
303
  - examples/redis/Gemfile
304
304
  - examples/redis/config.ru
305
+ - examples/sequel/Gemfile
306
+ - examples/sequel/config.ru
307
+ - examples/sequel/data.sqlite3
305
308
  - examples/sinatra/Gemfile
306
309
  - examples/sinatra/Gemfile.lock
307
310
  - examples/sinatra/config.ru