shuttlebay 0.2.0 → 0.2.1

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: 65929907b2e26eb80f96fbb87c41903626e320d301d8cc0e0bd36ddbe29228ae
4
- data.tar.gz: c4ce7ea0de33c5acb37315645b895a25654f51699c283533aa07bb75a01ce408
3
+ metadata.gz: 3e58d1e24092ae4ba3e6a37a5ad342d55497d1ac4dc13eaef5cf2751f3f33f7d
4
+ data.tar.gz: f24f366d0b6e785e8c5a7e65806586de4e246f1116e69e421a6ca84c08d9607e
5
5
  SHA512:
6
- metadata.gz: 3258cb81038a1687dfccf846fceb21fd517ff4bf89f383fcf5668de0b558da2834d8be5be9c0f61f8b23e4eb01cec508f6637407665f7ebb520b0335be0c36e1
7
- data.tar.gz: 9986d6fa8615b58f4e08b7f205e2cdee43e5dbae170f7287cf6ef842dd3cfe991900b78ee724f57d74cfcd528502a66853b8b786864878c721012ebf3185c68f
6
+ metadata.gz: 2d26f2bb11c9f9494133822a9a05485c1111af4a89c360407f74134611c72a1e06ee74ff1bbe1047c2568e7fb7921258ae18bd9bfe627302d87bea237adaa683
7
+ data.tar.gz: ebabfa9fc4c2a6bf9a791e93affb9b110da1d0ca09b8119c30beca81e08b21ae65bc0e7f2c68b921cf0039680bc6f3e2548bd232c99ff19df2cc770239d1d6c9
data/Cargo.lock CHANGED
@@ -79,6 +79,12 @@ version = "0.3.4"
79
79
  source = "registry+https://github.com/rust-lang/crates.io-index"
80
80
  checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
81
81
 
82
+ [[package]]
83
+ name = "harel-machines"
84
+ version = "0.3.0"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "c55c0689200ba712a0c4360a54ec8bac72ba928bc3229e558b1ebb1ea01a49d7"
87
+
82
88
  [[package]]
83
89
  name = "itertools"
84
90
  version = "0.13.0"
@@ -319,7 +325,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
319
325
 
320
326
  [[package]]
321
327
  name = "shuttlebay"
322
- version = "0.1.4"
328
+ version = "0.2.0"
323
329
  dependencies = [
324
330
  "magnus",
325
331
  "mothership-docking-protocol",
@@ -330,9 +336,9 @@ dependencies = [
330
336
 
331
337
  [[package]]
332
338
  name = "state-machines"
333
- version = "0.32.1"
339
+ version = "0.35.0"
334
340
  source = "registry+https://github.com/rust-lang/crates.io-index"
335
- checksum = "f9b6f45e43f20a6eba0d7c03779b53775e0d9b40a452b89e55ea7aae87fa7a14"
341
+ checksum = "f2fb3f0428a4a79e7929cacf1186fea42291446987807a5136daae4161c13fcf"
336
342
  dependencies = [
337
343
  "state-machines-core",
338
344
  "state-machines-macro",
@@ -340,16 +346,17 @@ dependencies = [
340
346
 
341
347
  [[package]]
342
348
  name = "state-machines-core"
343
- version = "0.13.1"
349
+ version = "0.15.0"
344
350
  source = "registry+https://github.com/rust-lang/crates.io-index"
345
- checksum = "f7a38d0afcf79a49438b4342ea90beec6490664a0725b2932f6e816d83bc46fe"
351
+ checksum = "1d027fb20a763004675f678951c6c9537d9dbc2b26056c37d41cefb014e55daf"
346
352
 
347
353
  [[package]]
348
354
  name = "state-machines-macro"
349
- version = "0.32.1"
355
+ version = "0.35.0"
350
356
  source = "registry+https://github.com/rust-lang/crates.io-index"
351
- checksum = "604a644fc18fffd8845eb7f48e332d79a24750ac9d463a39d9b3cb10c44fcc28"
357
+ checksum = "c16c56f4525fd7923580b96d7066341d3b10e772aa2e679e0c65b04881ba9439"
352
358
  dependencies = [
359
+ "harel-machines",
353
360
  "proc-macro2",
354
361
  "quote",
355
362
  "syn 3.0.9",
data/docs/guide.md CHANGED
@@ -196,18 +196,59 @@ covers the rest.
196
196
  ## 8. TLS and HTTP/2
197
197
 
198
198
  Behind a CDN or Kamal proxy, they terminate TLS and speak HTTP/2 to browsers;
199
- Mothership listens on plain HTTP behind them. To terminate TLS in Mothership
200
- itself (guardship 0.2.1 and later):
199
+ Mothership listens on plain HTTP behind them, and nothing here is needed.
200
+
201
+ To terminate TLS in Mothership itself (guardship 0.2.1 and later), get a
202
+ certificate first, then add a TLS bind.
203
+
204
+ **The certificate.** Mothership serves `public/`, so certbot's webroot mode
205
+ works while the app runs on plain HTTP:
206
+
207
+ ```bash
208
+ mkdir -p public/.well-known/acme-challenge # create it before certbot runs
209
+ certbot certonly --webroot -w ./public -d example.com -d www.example.com
210
+ ```
211
+
212
+ Create `.well-known` beforehand: Mothership skips the filesystem for
213
+ top-level names it has not seen in `public/` (it re-lists the directory
214
+ about once a second), so one certbot creates on the spot can miss the
215
+ validation request. One certificate can name every domain (`-d` repeated).
216
+
217
+ **The binds.**
201
218
 
202
219
  ```toml
203
220
  [mothership.bind]
204
221
  http = "0.0.0.0:80"
205
- https = { addr = "0.0.0.0:443", tls = { cert = "/etc/letsencrypt/live/app/fullchain.pem", key = "/etc/letsencrypt/live/app/privkey.pem" } }
222
+ https = { addr = "0.0.0.0:443", tls = { cert = "/etc/letsencrypt/live/example.com/fullchain.pem", key = "/etc/letsencrypt/live/example.com/privkey.pem" } }
223
+
224
+ [[bays.http]]
225
+ name = "web"
226
+ # command, args, workers, threads as before
227
+ routes = [
228
+ { bind = "http", pattern = "/.*" },
229
+ { bind = "https", pattern = "/.*" },
230
+ ]
231
+ ```
232
+
233
+ ```ruby
234
+ # config/environments/production.rb
235
+ config.force_ssl = true # redirects HTTP to HTTPS, sends HSTS, secures cookies
206
236
  ```
207
237
 
208
- Browsers then get HTTP/2 (negotiated over ALPN), the app sees
209
- `rack.url_scheme = "https"`, and renewed certificates are picked up without a
210
- restart.
238
+ - Browsers get HTTP/2 (negotiated over ALPN). On the TLS bind the app sees
239
+ `rack.url_scheme = "https"` and `HTTPS=on`, so `force_ssl` and
240
+ `request.ssl?` work with no `assume_ssl` or forwarded headers.
241
+ - Renewals are picked up without a restart, within 30 s of certbot writing
242
+ them. A renewal that does not load is logged; the old one keeps serving.
243
+ - Let's Encrypt keys are readable by root only: run with access to them, or
244
+ have a certbot `--deploy-hook` copy the pair where the app's user can read
245
+ it. Ports 80 and 443 need `setcap cap_net_bind_service=+ep` on the binary,
246
+ `AmbientCapabilities=CAP_NET_BIND_SERVICE` under systemd, or a container.
247
+
248
+ From guardship 0.3, Mothership can also redirect HTTP to HTTPS itself
249
+ (`http = { addr = "0.0.0.0:80", https_redirect = true }`, ACME challenges
250
+ left on HTTP) and serve a certificate per domain on one bind
251
+ (`tls = [{ cert, key }, ...]`, picked by SNI); see the Mothership README.
211
252
 
212
253
  ## 9. Docker and Kamal
213
254
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "shuttlebay"
3
- version = "0.2.0" # x-release-please-version
3
+ version = "0.2.1" # x-release-please-version
4
4
  edition.workspace = true
5
5
  rust-version.workspace = true
6
6
  license.workspace = true
@@ -28,4 +28,4 @@ magnus = { version = "0.9", features = ["bytes"] }
28
28
  rb-sys = "0.9.130"
29
29
  mothership-docking-protocol = "0.3.0"
30
30
  serde_json = "1.0"
31
- state-machines = "0.32"
31
+ state-machines = "0.35"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shuttlebay
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shuttlebay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih