falcon 0.52.3 → 0.53.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/websockets.md +1 -1
- data/lib/falcon/command/serve.rb +0 -1
- data/lib/falcon/configuration.rb +1 -1
- data/lib/falcon/environment/server.rb +3 -23
- data/lib/falcon/environment/virtual.rb +2 -2
- data/lib/falcon/service/server.rb +30 -50
- data/lib/falcon/version.rb +1 -1
- data/license.md +1 -0
- data/readme.md +6 -2
- data/releases.md +6 -2
- data.tar.gz.sig +0 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a29bc2c8b56a674c1dd385f9655d454d0c792ee1c09c512cfc2019c265c3f17
|
|
4
|
+
data.tar.gz: 3a195cf6d478834756980f39ccc580d879b0b38a6272837aa51322dad8bd0cc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e9ec3a6e57f6768125efb73f99fbed1918f94665ba1635b89706fd5ca14ab074c4bcfa090f7dc290f2732142f27d94afff597a239ffcc36ce02b24278ff3a4f
|
|
7
|
+
data.tar.gz: e01aae910c60cb9bacf01949c784cedce9ecd4bd5b23c47544a0da0d347fce01a9394d9f0232abec1ed90e4f5de4a924bcf7d97c3ee81b4d569bb609292d3546
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/context/websockets.md
CHANGED
|
@@ -9,7 +9,7 @@ Falcon supports WebSockets using the [async-websocket gem](https://github.com/so
|
|
|
9
9
|
~~~ruby
|
|
10
10
|
# config.ru
|
|
11
11
|
|
|
12
|
-
require "async/websocket/
|
|
12
|
+
require "async/websocket/adapters/rack"
|
|
13
13
|
|
|
14
14
|
run do |env|
|
|
15
15
|
Async::WebSocket::Adapters::Rack.open(env, protocols: ['ws']) do |connection|
|
data/lib/falcon/command/serve.rb
CHANGED
data/lib/falcon/configuration.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
4
|
# Copyright, 2020-2025, by Samuel Williams.
|
|
5
5
|
|
|
6
|
-
require "async/service/
|
|
6
|
+
require "async/service/managed_environment"
|
|
7
7
|
require "async/http/endpoint"
|
|
8
8
|
|
|
9
9
|
require_relative "../service/server"
|
|
@@ -13,6 +13,8 @@ module Falcon
|
|
|
13
13
|
module Environment
|
|
14
14
|
# Provides an environment for hosting a web application that uses a Falcon server.
|
|
15
15
|
module Server
|
|
16
|
+
include Async::Service::ManagedEnvironment
|
|
17
|
+
|
|
16
18
|
# The service class to use for the proxy.
|
|
17
19
|
# @returns [Class]
|
|
18
20
|
def service_class
|
|
@@ -25,21 +27,6 @@ module Falcon
|
|
|
25
27
|
self.name
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
# Number of instances to start. By default (when nil), uses `Etc.nprocessors`.
|
|
29
|
-
# @returns [Integer | nil]
|
|
30
|
-
def count
|
|
31
|
-
nil
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Options to use when creating the container.
|
|
35
|
-
def container_options
|
|
36
|
-
{
|
|
37
|
-
restart: true,
|
|
38
|
-
count: self.count,
|
|
39
|
-
health_check_timeout: 30,
|
|
40
|
-
}.compact
|
|
41
|
-
end
|
|
42
|
-
|
|
43
30
|
# The host that this server will receive connections for.
|
|
44
31
|
def url
|
|
45
32
|
"http://[::]:9292"
|
|
@@ -80,13 +67,6 @@ module Falcon
|
|
|
80
67
|
::Async::HTTP::Endpoint.parse(url)
|
|
81
68
|
end
|
|
82
69
|
|
|
83
|
-
# Any scripts to preload before starting the server.
|
|
84
|
-
#
|
|
85
|
-
# @returns [Array(String)] The list of scripts to preload.
|
|
86
|
-
def preload
|
|
87
|
-
[]
|
|
88
|
-
end
|
|
89
|
-
|
|
90
70
|
# Make a server instance using the given endpoint. The endpoint may be a bound endpoint, so we take care to specify the protocol and scheme as per the original endpoint.
|
|
91
71
|
#
|
|
92
72
|
# @parameter endpoint [IO::Endpoint] The endpoint to bind to.
|
|
@@ -56,10 +56,10 @@ module Falcon
|
|
|
56
56
|
# # An endpoint suitable for connecting to the specified hostname.
|
|
57
57
|
# def host_endpoint(hostname, **options)
|
|
58
58
|
# endpoint = secure_endpoint(**options)
|
|
59
|
-
|
|
59
|
+
#
|
|
60
60
|
# url = URI.parse(bind_secure)
|
|
61
61
|
# url.hostname = hostname
|
|
62
|
-
|
|
62
|
+
#
|
|
63
63
|
# return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
|
|
64
64
|
# end
|
|
65
65
|
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Copyright, 2019-2025, by Samuel Williams.
|
|
5
5
|
# Copyright, 2020, by Daniel Evans.
|
|
6
6
|
|
|
7
|
-
require "async/service/
|
|
7
|
+
require "async/service/managed_service"
|
|
8
8
|
require "async/container/supervisor/supervised"
|
|
9
9
|
require "async/http/endpoint"
|
|
10
10
|
|
|
@@ -12,28 +12,13 @@ require_relative "../server"
|
|
|
12
12
|
|
|
13
13
|
module Falcon
|
|
14
14
|
module Service
|
|
15
|
-
class Server < Async::Service::
|
|
15
|
+
class Server < Async::Service::ManagedService
|
|
16
16
|
def initialize(...)
|
|
17
17
|
super
|
|
18
18
|
|
|
19
19
|
@bound_endpoint = nil
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
# Preload any resources specified by the environment.
|
|
23
|
-
def preload!
|
|
24
|
-
root = @evaluator.root
|
|
25
|
-
|
|
26
|
-
if scripts = @evaluator.preload
|
|
27
|
-
scripts = Array(scripts)
|
|
28
|
-
|
|
29
|
-
scripts.each do |path|
|
|
30
|
-
Console.logger.info(self) {"Preloading #{path}..."}
|
|
31
|
-
full_path = File.expand_path(path, root)
|
|
32
|
-
load(full_path)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
22
|
# Prepare the bound endpoint for the server.
|
|
38
23
|
def start
|
|
39
24
|
@endpoint = @evaluator.endpoint
|
|
@@ -42,47 +27,42 @@ module Falcon
|
|
|
42
27
|
@bound_endpoint = @endpoint.bound
|
|
43
28
|
end
|
|
44
29
|
|
|
45
|
-
preload!
|
|
46
|
-
|
|
47
30
|
Console.logger.info(self) {"Starting #{self.name} on #{@endpoint}"}
|
|
48
31
|
|
|
49
32
|
super
|
|
50
33
|
end
|
|
51
34
|
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
# Run the service logic.
|
|
36
|
+
#
|
|
37
|
+
# @parameter instance [Object] The container instance.
|
|
38
|
+
# @parameter evaluator [Environment::Evaluator] The environment evaluator.
|
|
39
|
+
# @returns [Falcon::Server] The server instance.
|
|
40
|
+
def run(instance, evaluator)
|
|
41
|
+
if evaluator.key?(:make_supervised_worker)
|
|
42
|
+
Console.warn(self, "Async::Container::Supervisor is replaced by Async::Services::Supervisor, please update your service definition.")
|
|
43
|
+
|
|
44
|
+
evaluator.make_supervised_worker(instance).run
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
server = evaluator.make_server(@bound_endpoint)
|
|
57
48
|
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
Async do |task|
|
|
50
|
+
server.run
|
|
60
51
|
|
|
61
|
-
|
|
62
|
-
if @environment.implements?(Async::Container::Supervisor::Supervised)
|
|
63
|
-
evaluator.make_supervised_worker(instance).run
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
server = evaluator.make_server(@bound_endpoint)
|
|
67
|
-
|
|
68
|
-
server.run
|
|
69
|
-
|
|
70
|
-
instance.ready!
|
|
71
|
-
|
|
72
|
-
if health_check_timeout
|
|
73
|
-
Async(transient: true) do
|
|
74
|
-
while true
|
|
75
|
-
# We only update this if the health check is enabled. Maybe we should always update it?
|
|
76
|
-
instance.name = "#{self.name} (#{server.statistics_string} L=#{Fiber.scheduler.load.round(3)})"
|
|
77
|
-
sleep(health_check_timeout / 2)
|
|
78
|
-
instance.ready!
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
task.children.each(&:wait)
|
|
84
|
-
end
|
|
52
|
+
task.children.each(&:wait)
|
|
85
53
|
end
|
|
54
|
+
|
|
55
|
+
server
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Format the process title with server statistics.
|
|
59
|
+
#
|
|
60
|
+
# @parameter evaluator [Environment::Evaluator] The environment evaluator.
|
|
61
|
+
# @parameter server [Falcon::Server] The server instance.
|
|
62
|
+
# @returns [String] The formatted process title.
|
|
63
|
+
private def format_title(evaluator, server)
|
|
64
|
+
load = Fiber.scheduler.load.round(3)
|
|
65
|
+
"#{evaluator.name} (#{server.statistics_string} L=#{load})"
|
|
86
66
|
end
|
|
87
67
|
|
|
88
68
|
# Close the bound endpoint.
|
data/lib/falcon/version.rb
CHANGED
data/license.md
CHANGED
|
@@ -27,6 +27,7 @@ Copyright, 2024, by Stefan Buhrmester.
|
|
|
27
27
|
Copyright, 2024, by Ismael Celis.
|
|
28
28
|
Copyright, 2025, by Pierre Montelle.
|
|
29
29
|
Copyright, 2025, by Jared Smith.
|
|
30
|
+
Copyright, 2025, by Yoji Shidara.
|
|
30
31
|
|
|
31
32
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
33
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
|
@@ -47,6 +47,10 @@ Please see the [project documentation](https://socketry.github.io/falcon/) for m
|
|
|
47
47
|
|
|
48
48
|
Please see the [project releases](https://socketry.github.io/falcon/releases/index) for all releases.
|
|
49
49
|
|
|
50
|
+
### v0.52.4
|
|
51
|
+
|
|
52
|
+
- Relax dependency on `async-container-supervisor` to allow `~> 0.6`.
|
|
53
|
+
|
|
50
54
|
### v0.52.0
|
|
51
55
|
|
|
52
56
|
- Modernized codebase and dropped support for Ruby v3.1.
|
|
@@ -98,13 +102,13 @@ In addition, `falcon serve` provides two new options:
|
|
|
98
102
|
The current configuration format uses definitions like this:
|
|
99
103
|
|
|
100
104
|
``` ruby
|
|
101
|
-
rack
|
|
105
|
+
rack "hello.localhost", :self_signed_tls
|
|
102
106
|
```
|
|
103
107
|
|
|
104
108
|
This changes to:
|
|
105
109
|
|
|
106
110
|
``` ruby
|
|
107
|
-
service
|
|
111
|
+
service "hello.localhost" do
|
|
108
112
|
include Falcon::Environment::Rack
|
|
109
113
|
include Falcon::Environment::SelfSignedTLS
|
|
110
114
|
end
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.52.4
|
|
4
|
+
|
|
5
|
+
- Relax dependency on `async-container-supervisor` to allow `~> 0.6`.
|
|
6
|
+
|
|
3
7
|
## v0.52.0
|
|
4
8
|
|
|
5
9
|
- Modernized codebase and dropped support for Ruby v3.1.
|
|
@@ -106,13 +110,13 @@ In addition, `falcon serve` provides two new options:
|
|
|
106
110
|
The current configuration format uses definitions like this:
|
|
107
111
|
|
|
108
112
|
``` ruby
|
|
109
|
-
rack
|
|
113
|
+
rack "hello.localhost", :self_signed_tls
|
|
110
114
|
```
|
|
111
115
|
|
|
112
116
|
This changes to:
|
|
113
117
|
|
|
114
118
|
``` ruby
|
|
115
|
-
service
|
|
119
|
+
service "hello.localhost" do
|
|
116
120
|
include Falcon::Environment::Rack
|
|
117
121
|
include Falcon::Environment::SelfSignedTLS
|
|
118
122
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: falcon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.53.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -31,6 +31,7 @@ authors:
|
|
|
31
31
|
- Stefan Buhrmester
|
|
32
32
|
- Tad Thorley
|
|
33
33
|
- Tasos Latsas
|
|
34
|
+
- Yoji Shidara
|
|
34
35
|
bindir: bin
|
|
35
36
|
cert_chain:
|
|
36
37
|
- |
|
|
@@ -98,14 +99,14 @@ dependencies:
|
|
|
98
99
|
requirements:
|
|
99
100
|
- - "~>"
|
|
100
101
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: 0.
|
|
102
|
+
version: '0.6'
|
|
102
103
|
type: :runtime
|
|
103
104
|
prerelease: false
|
|
104
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
106
|
requirements:
|
|
106
107
|
- - "~>"
|
|
107
108
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: 0.
|
|
109
|
+
version: '0.6'
|
|
109
110
|
- !ruby/object:Gem::Dependency
|
|
110
111
|
name: async-http
|
|
111
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,14 +141,14 @@ dependencies:
|
|
|
140
141
|
requirements:
|
|
141
142
|
- - "~>"
|
|
142
143
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '0.
|
|
144
|
+
version: '0.16'
|
|
144
145
|
type: :runtime
|
|
145
146
|
prerelease: false
|
|
146
147
|
version_requirements: !ruby/object:Gem::Requirement
|
|
147
148
|
requirements:
|
|
148
149
|
- - "~>"
|
|
149
150
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '0.
|
|
151
|
+
version: '0.16'
|
|
151
152
|
- !ruby/object:Gem::Dependency
|
|
152
153
|
name: bundler
|
|
153
154
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
|
Binary file
|