You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: context/deployment.md
+51-5Lines changed: 51 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,18 +56,22 @@ service "supervisor" do
56
56
end
57
57
~~~
58
58
59
-
These configuration blocks are evaluated using the [async-service](https://github.com/socketry/async-service) gem. The supervisor is an independent service which monitors the health of the application and can restart it if necessary. Other services like background job processors can be added to the configuration.
59
+
These configuration blocks are evaluated using the [async-service](https://github.com/socketry/async-service) gem. This configuration will bind Falcon to an [IPC socket](https://en.wikipedia.org/wiki/Unix_domain_socket) and is designed to be used with a reverse proxy such as [`falcon virtual`](#falcon-virtual).
60
+
61
+
The supervisor is an independent service which monitors the health of the application and can restart it if necessary. Other services like background job processors can be added to the configuration.
60
62
61
63
### Environments
62
64
63
65
The service blocks define configuration that is loaded by the service layer to control how the service is run. The `service ... do` block defines the service name and the environment in which it runs. Different modules can be included to provide different functionality, such as `Falcon::Environment::Rack` for Rack applications, or `Falcon::Environment::LetsEncryptTLS` for automatic TLS certificate management.
64
66
67
+
**NOTE**: Falcon does not provision or renew certificates automatically. Use a tool like [certbot](https://certbot.eff.org) to provision your certificate and the `LetsEncryptTLS` environment will automatically read it in.
68
+
65
69
### Application Configuration
66
70
67
71
The environment configuration is defined in the `Falcon::Environment` module. The {ruby Falcon::Environment::Application} environment supports the generic virtual host functionality, but you can customise any parts of the configuration, e.g. to bind a production host to `localhost:3000` using plaintext HTTP/2:
You can verify this is working using the [`nghttp2` client](https://nghttp2.org): `nghttp -v http://localhost:3000`. This will not work in a browser as they mandate TLS for HTTP/2 connections.
99
+
100
+
#### Self-signed certificate
101
+
102
+
You can use a self-signed certificate to test your server configuration locally. First, provision a certificate using the [`localhost` gem](https://github.com/socketry/localhost):
103
+
104
+
```
105
+
$ bundle exec bake localhost:install
106
+
```
107
+
108
+
You may be prompted for a password to install the certificate. This is the password for your local keychain.
109
+
110
+
Then, add the `SelfSignedTLS` environment to your configuration and set up the SSL context:
111
+
112
+
~~~ruby
113
+
#!/usr/bin/env falcon-host
114
+
# frozen_string_literal: true
115
+
116
+
require"falcon/environment/rack"
117
+
require"async/service/supervisor"
118
+
119
+
hostname =File.basename(__dir__)
120
+
service hostname do
121
+
includeFalcon::Environment::Rack
122
+
includeFalcon::Environment::SelfSignedTLS
123
+
124
+
endpoint do
125
+
Async::HTTP::Endpoint
126
+
.parse('https://localhost:3000')
127
+
.with(
128
+
protocol:Async::HTTP::Protocol::HTTP2,
129
+
ssl_context: ssl_context
130
+
)
85
131
end
86
132
end
87
133
@@ -90,7 +136,7 @@ service "supervisor" do
90
136
end
91
137
~~~
92
138
93
-
You can verify this is working using `nghttp -v http://localhost:3000`.
139
+
You should now be able to access your server at `https://localhost:3000` in your browser.
Copy file name to clipboardExpand all lines: guides/deployment/readme.md
+51-5Lines changed: 51 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,18 +56,22 @@ service "supervisor" do
56
56
end
57
57
~~~
58
58
59
-
These configuration blocks are evaluated using the [async-service](https://github.com/socketry/async-service) gem. The supervisor is an independent service which monitors the health of the application and can restart it if necessary. Other services like background job processors can be added to the configuration.
59
+
These configuration blocks are evaluated using the [async-service](https://github.com/socketry/async-service) gem. This configuration will bind Falcon to an [IPC socket](https://en.wikipedia.org/wiki/Unix_domain_socket) and is designed to be used with a reverse proxy such as [`falcon virtual`](#falcon-virtual).
60
+
61
+
The supervisor is an independent service which monitors the health of the application and can restart it if necessary. Other services like background job processors can be added to the configuration.
60
62
61
63
### Environments
62
64
63
65
The service blocks define configuration that is loaded by the service layer to control how the service is run. The `service ... do` block defines the service name and the environment in which it runs. Different modules can be included to provide different functionality, such as `Falcon::Environment::Rack` for Rack applications, or `Falcon::Environment::LetsEncryptTLS` for automatic TLS certificate management.
64
66
67
+
**NOTE**: Falcon does not provision or renew certificates automatically. Use a tool like [certbot](https://certbot.eff.org) to provision your certificate and the `LetsEncryptTLS` environment will automatically read it in.
68
+
65
69
### Application Configuration
66
70
67
71
The environment configuration is defined in the `Falcon::Environment` module. The {ruby Falcon::Environment::Application} environment supports the generic virtual host functionality, but you can customise any parts of the configuration, e.g. to bind a production host to `localhost:3000` using plaintext HTTP/2:
You can verify this is working using the [`nghttp2` client](https://nghttp2.org): `nghttp -v http://localhost:3000`. This will not work in a browser as they mandate TLS for HTTP/2 connections.
99
+
100
+
#### Self-signed certificate
101
+
102
+
You can use a self-signed certificate to test your server configuration locally. First, provision a certificate using the [`localhost` gem](https://github.com/socketry/localhost):
103
+
104
+
```
105
+
$ bundle exec bake localhost:install
106
+
```
107
+
108
+
You may be prompted for a password to install the certificate. This is the password for your local keychain.
109
+
110
+
Then, add the `SelfSignedTLS` environment to your configuration and set up the SSL context:
111
+
112
+
~~~ruby
113
+
#!/usr/bin/env falcon-host
114
+
# frozen_string_literal: true
115
+
116
+
require"falcon/environment/rack"
117
+
require"async/service/supervisor"
118
+
119
+
hostname =File.basename(__dir__)
120
+
service hostname do
121
+
includeFalcon::Environment::Rack
122
+
includeFalcon::Environment::SelfSignedTLS
123
+
124
+
endpoint do
125
+
Async::HTTP::Endpoint
126
+
.parse('https://localhost:3000')
127
+
.with(
128
+
protocol:Async::HTTP::Protocol::HTTP2,
129
+
ssl_context: ssl_context
130
+
)
85
131
end
86
132
end
87
133
@@ -90,7 +136,7 @@ service "supervisor" do
90
136
end
91
137
~~~
92
138
93
-
You can verify this is working using `nghttp -v http://localhost:3000`.
139
+
You should now be able to access your server at `https://localhost:3000` in your browser.
0 commit comments