-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move configuration logic/environments to
Async::Service
. (#226)
- Loading branch information
Showing
52 changed files
with
967 additions
and
1,271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Changes | ||
|
||
# Unreleased | ||
|
||
## Falcon Host | ||
|
||
`async-service` is a new gem that exposes a generic service interface on top of `async-container`. Previously, `falcon host` used `async-container` directly and `build-environment` for configuration. In order to allow for more generic service definitions and configuration, `async-service` now provides a similar interface to `build-environment` and exposes this in a way that can be used for services other tha falcon. This makes it simpler to integrate multiple services into a single application. | ||
|
||
The current configuration format uses definitions like this: | ||
|
||
```ruby | ||
rack 'hello.localhost', :self_signed_tls | ||
``` | ||
|
||
This changes to: | ||
|
||
```ruby | ||
service 'hello.localhost' do | ||
include Falcon::Environment::Rack | ||
include Falcon::Environment::SelfSignedTLS | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env async-service | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2024, by Samuel Williams. | ||
|
||
require 'falcon/environment/server' | ||
|
||
service "hello-server" do | ||
include Falcon::Environment::Server | ||
|
||
middleware do | ||
::Protocol::HTTP::Middleware::HelloWorld | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Async::Service | ||
|
||
Async::Service provides a generic service layer for managing the lifecycle of services. | ||
|
||
Falcon provides several services which are managed by the service layer, including: | ||
|
||
- `Falcon::Service::Server`: An HTTP server. | ||
- `Falcon::Service::Supervisor`: A process supervisor (memory usage, etc). | ||
|
||
The service layer can support multiple different services, and can be used to manage the lifecycle of any service, or group of services. | ||
|
||
This simple example shows how to use `async-service` to start a web server. | ||
|
||
``` shell | ||
$ bundle exec async-service ./hello.rb | ||
``` | ||
|
||
This will start a web server on port 9292 which responds with "Hello World!" to all requests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
require 'async' | ||
|
||
Console.logger.debug! | ||
# Console.logger.debug! | ||
|
||
class RequestLogger | ||
def initialize(app) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2020-2023, by Samuel Williams. | ||
# Copyright, 2020-2024, by Samuel Williams. | ||
|
||
if GC.respond_to?(:compact) | ||
Console.logger.warn(self, "Compacting the mainframe...") | ||
GC.compact | ||
Console.logger.warn(self, "Compacting done...") | ||
end | ||
# $stderr.puts "Preloading..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.