v0.37.3
This commit is contained in:
1 parent
5e57e48c6a
commit
df0e39b899
25 files changed
+319
-97
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# RustProxy source and documentation maintenance
|
||||
|
||||
Current source version: **0.37.2**. The Cargo package and binary are named `rust-proxy`.
|
||||
Current source version: **0.37.3**. The Cargo package and binary are named `rust-proxy`.
|
||||
|
||||
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
||||
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
|
||||
|
||||
## 0.37.3 — lower memory and CPU use with Docker agents
|
||||
|
||||
- **Docker discovery no longer rebuilds the configuration on every poll:** each agent poll (default every 5 s) used to recompile the whole runtime configuration — re-reading every certificate file, building new TLS server configurations for every vhost, re-resolving dynamic ACL names and allocating and discarding the full compiled configuration — even when nothing had changed. RustProxy now compares the generated configuration (and the size, modification time and inode of the configured certificate files) with the last applied one and only recompiles when something actually changed: a container address, port, label publication, assignment, configuration save, certificate reload or a certificate file replaced on disk. On the test machine (51 vhosts, two agents, 5 s poll) idle CPU use dropped by about 45% and process memory under 500 keep-alive TLS connections by about 12%; the effect grows with the number of vhosts, certificates and backends.
|
||||
- **Shared TLS configurations:** vhosts with the same TLS policy now share one TLS server configuration (and its session cache) instead of two per vhost, and a certificate is kept in memory once instead of once per host name it serves.
|
||||
- **Upstream clients:** unchanged backends keep their upstream client and connection pool across configuration changes without building a replacement first.
|
||||
- **Docker polling:** the poll loop no longer copies the full configuration and all agent inventories several times per poll.
|
||||
- **Compatibility:** no configuration or API changes. A certificate file replaced on disk is still picked up automatically on the next Docker poll when Docker agents are configured; otherwise use *Reload* or the certificate API as before.
|
||||
|
||||
## 0.37.2 — Docker vhost ACL and cache, compact pickers, manual dashboard layout
|
||||
|
||||
- **Docker vhosts, access control:** the agent default ACL profiles are now shown pre-selected in the service's *Access control* section (*Agent default in use: …*) and can be unchecked or changed for that service only. New **Public vhost (no agent default ACL)** publishes a service without the agent default profiles (`inherit_acl_profiles: false`); global block/allow rules still apply. The section summary shows the effective state. See [docs](docs/DOCKER_DISCOVERY.md#publish-a-discovered-application).
|
||||
|
||||
Generated
+1
-1
@@ -1943,7 +1943,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-proxy"
|
||||
version = "0.37.2"
|
||||
version = "0.37.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rust-proxy"
|
||||
version = "0.37.2"
|
||||
version = "0.37.3"
|
||||
edition = "2021"
|
||||
rust-version = "1.99.1"
|
||||
description = "RustProxy - independent reverse proxy with local administration"
|
||||
|
||||
+25
-26
@@ -1,10 +1,10 @@
|
||||
61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore
|
||||
4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example
|
||||
e76e688874828e3743d03693b1d2872b9633b4db09909673786caf30f7cfe489 .gitignore
|
||||
75a02969103a9a28563e10a9f2dd43bbbf9d9968b8d17f8ae4bb6ef11b1a9fe9 AGENTS.md
|
||||
fef44535fd191d7d9b9e38c0a98b4c545a4f3889ac13f91a0e596660ffd5f491 CHANGELOG.md
|
||||
1a21e0a1e20786445750186c221a21d5266aa16c6e8f220d4c5af1f39b572d51 Cargo.lock
|
||||
21e77407c22125c0aaebb1cd5164fd5d38eef6555ef62ef363f42ae0966683cd Cargo.toml
|
||||
a3f8a7f33789a5e3c0b9830878b825eb3f8b5d2d9adaa9a706d042694a350d01 AGENTS.md
|
||||
a2301446d4e490a4cc5230cf77d6035b8bca9758d86cfa3ccf56454ed7ce3354 CHANGELOG.md
|
||||
f91f8d0b3e588f50bec26134a73ea7e7e6c9d9ff1bbc11216ab8e582ac6e660b Cargo.lock
|
||||
39e599669ff1ea1e24e93888fcaf4cd89e09abce31a0d8c8314431004ac022eb Cargo.toml
|
||||
788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile
|
||||
0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE
|
||||
82d1dee2fc68158f0ea73259151461e64c8b18d807cd1fecfb1ed99dc30cf5f4 README.md
|
||||
@@ -28,7 +28,7 @@ e9f18b358a740f1fe16e369ed16ee37581b8ce4c94ddeb34a1a37b89a49b5a06 docker-agent/c
|
||||
b849d39e94878c5a754c3d109d8e4b5e37609cfd2a0e05601a35271f4d95271e docker-agent/install.sh
|
||||
56d6acd675c44c3a39538b321d2057cf251a6a27b0ad634d827eb7d6a20de8c0 docker-agent/main.go
|
||||
d660f46f7ef8c539dd3f5486a31d5a1254b9737be8a278c7f9352c254558f8ac docker-agent/main_test.go
|
||||
1e357eb7f91403a2887a643a1acc34a3a2abf343cde05a4d3f00bf1deb850c11 docker-agent/model.go
|
||||
0d5c31214aa70e1da86b7854e8f979a2dded345b876271812f1d489f25fe0b7d docker-agent/model.go
|
||||
e7d2ef3cc83d8089d3b5eb2154c113d82bbab5e7bac0b9077785d5ab92f48df2 docker-agent/network.go
|
||||
6e2e13136fd8198c2d64dfd0612dfc91c4a9c0a952e71b3b24c9614a72b083aa docker-agent/network_proc_test.go
|
||||
021e0799a95a7c76bc245ff464d94b4495ce0d22555ca202579bd5f45e4be794 docker-agent/provision.go
|
||||
@@ -45,13 +45,13 @@ c0940a4b323d71931cf2ad4ad24d58b6d6bfd49af90c6e3fc91fcbe2b4cf312f docs/ACCESS.md
|
||||
9c9e6c56ae9d714a5a99bffd39cb2d506991af5e67f034d41fe45210c95ac5ca docs/CONFIGURATION.md
|
||||
fec29ce846d6705eb45819d85d382f28e28a146b265feab2e4c7cce2a35e5883 docs/CUSTOM_LOCATIONS.md
|
||||
5776a6e59df079a8788df00f031cb366f12718f5336ddabd90a953aed2f8b1f7 docs/DASHBOARD.md
|
||||
66cad89e66b7b2d8bc988823e60488c6914885e87aae0cc7d91c7fb95dd14f97 docs/DOCKER_DISCOVERY.md
|
||||
40de73f749877b1a371b48be2f43422b8598c59a2e8768c9d2d986a35c693cdf docs/DOCKER_DISCOVERY.md
|
||||
bd0bb5583bf171dc2cf73b56492184f6d7a69bf33db5f25c5396ed6c3300b400 docs/FEATURES.md
|
||||
2c5f97b12be53db32c7e2888d23c0ef1d82d1742df44f7e60ea818dc801a719a docs/INSTALL.md
|
||||
6e37859bf0dced99d4a7db93790cb38fcd90191932827946d5223eaa4c784fce docs/LOGS.md
|
||||
0e9ae9509a78d00951d2c7c3f13eaf518d1f3448a29b048f5933e1f5f8440275 docs/MIGRATION.md
|
||||
a7717c4ab03417914805527e573ea1dfd5d35295bf7b347d0c098bda6d469850 docs/MONITORING.md
|
||||
364c1faf9e21849de0f7c4ae8c1e55c1fa4d3ae3a7167a33cb58651174b4bfda docs/PERFORMANCE.md
|
||||
6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md
|
||||
d5894c07c68ec4230987767198434abee13b0e525842fea21bcbe752fa82742b docs/PHP_FPM.md
|
||||
954b1602c865e157c867f1c81dca615f2beaa33c34de0b0fa8a6069db2aae7d0 docs/README.md
|
||||
490a6dbe870f2b1fd4ec7816768dde6c86fa7957fc9de2d2f075e123c9222222 docs/RESPONSE_DELIVERY.md
|
||||
@@ -100,7 +100,7 @@ c720a4426d7b4dc52048077157dd05aefa427ae78ca811afc3b7b9cbbe875cae grafana/rustpr
|
||||
e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/routeros-oci-build/.gitignore
|
||||
14025f0cad10e1b89f366977123e4cebb68ae59df892d4eed29b6171e63ae908 integrations/routeros-oci-build/Dockerfile.routeros
|
||||
7c7a3e51f43b43e1c962a4b0bb591f99c1f06977bf77f23719f7f867dfe7eb8e integrations/routeros-oci-build/Dockerfile.routeros.dockerignore
|
||||
1552e57d83d3a19140fadc7cd203e257028c9f08a0b06a0c667fcb5f816340ee integrations/routeros-oci-build/README.md
|
||||
31dc057054b2b7f2ea3b826f2c4b6bd7b43a82327781ec54486bb5072889d4be integrations/routeros-oci-build/README.md
|
||||
3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh
|
||||
3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh
|
||||
ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md
|
||||
@@ -158,7 +158,7 @@ d1dcb7bdfb7cfdc9c3b88cfb6908201c58532bc888744a13f45853079f214659 src/acme/provi
|
||||
c51fd51177a476be6462ca980e9bc13f0d0b41538f520118b80a685130f0dbf0 src/acme/runtime_bootstrap.rs
|
||||
5a684eff5f3539c7bb8f66c3b83e7fb62527c52c61da727079d3897e0943f952 src/acme/runtime_env.rs
|
||||
2f02b08d88ad3c1fc9827e5bd3ef463effba633834d9c05e9c0d6d2a0e8869c5 src/acme/runtime_versions.rs
|
||||
cfc13a293c126bb511745859669719a14c72dd7ff6be197bc9e0d0e560deebbd src/acme/tests.rs
|
||||
dabccfc0933afb8c13710ff410f4cfe3deefac6316b1af0f99f464e8ef1bf91b src/acme/tests.rs
|
||||
b28a08ea996befe10949676f40fab5f1036a274c7d0ab1175cf5c43c59849dc3 src/admin/access.rs
|
||||
f73678bfa4c4f92779cf4e8ae2feb37419de320fb1b53111c982539d5761dbcf src/admin/alerts.rs
|
||||
7e23e70451c6498a43f65751c5bd7a110c63e24da05f6126b38dbacb33c962ca src/admin/api_token_access.rs
|
||||
@@ -179,7 +179,7 @@ d58a2ed83319176de4e66790ed292447c9497ae031464ec55cfe27174acb639a src/admin/file
|
||||
77b8c05645969834cc8a58e249a7b60a57d6c47ad1c5cd92ffa5e4a9b5a8e73c src/admin/file_logs_query.rs
|
||||
743bb7436f77e04015328a0e7e7d425e43ef8aa8d61467bde157e462c1dcdc2e src/admin/logging_api.rs
|
||||
51228956c33358278ebed62941da273e1e87d0b5c5d1c40cc0d2c91aec9d7362 src/admin/mod.rs
|
||||
64f1a55c1bbba9e0f29e18838b5c8d6f098f92400261b76caa121ef219bd9edb src/admin/openapi.json
|
||||
dcfa7a6ececbb803ba48bb971fab3367eb1f97f2d68d9cbcb092b601ce6753c6 src/admin/openapi.json
|
||||
f7a356109786635dd58cba590c71c796dbf36b47f25845190c75ee5c6a9fcb86 src/admin/operations.rs
|
||||
257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs
|
||||
f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs
|
||||
@@ -244,7 +244,7 @@ faab7ea6b07cdb69cbba3b9db74cc995ce12a7ab097fdc053227ddab72b23cdb src/admin/web/
|
||||
78bf6179f769b68d518028464697e50dea5d75e33ecb1b89d88e2c2b01e86bf2 src/admin/web/dashboard-defaults.json
|
||||
355046ecb80ce6adb73ceabd29825b0cf79ca364771070cedd5eb44760fae890 src/admin/web/dashboard-widgets.json
|
||||
50d1ebcbaf4d0b2968da23bb943fc3f67131c5d32df3f61d23ff37aad9da5b81 src/admin/web/demo.html
|
||||
10f19073034f0aacff8903d44e9b4bede56cd781b568c5a47c89ec8e4b864824 src/admin/web/docker.js
|
||||
daba8b7e12333ec69d85dfbf18bd4390a5e1fdc535df72b3142063a8bf20b611 src/admin/web/docker.js
|
||||
8bf5d1f4f06d6e87536d808a680bf3d3a0c90c1637df0e58da667fd22ad4782d src/admin/web/docs.css
|
||||
aeffd403fa1823df7d9fa4c48280b4033b2d15e4cb9f66608caff89290de0a52 src/admin/web/docs.html
|
||||
306db8db9e4d651a85e09dbc15464e7f920d7fe5bd9ec9d1d8068321eb0106ab src/admin/web/docs.js
|
||||
@@ -366,12 +366,12 @@ a1132b980833b1b4ce2bba9aa681ff255a0e2d61faaa65a316860da503ea1e27 src/cache/v022
|
||||
1a2eb6684d9ea4a7e90970d936c75f7c8bbec46a4181fdf273be9bdac8eec847 src/compression/mod.rs
|
||||
8de82d9188c9c337690c6ec4afdad9fff20651c358e34602a93d8bb8c3d2489a src/compression/tests.rs
|
||||
e695079333ebdc2a6e7b3337cfabef171b3a0a01da0597b77feff70d417f833e src/config.rs
|
||||
9f138f86a8d73dfc2d28a2c66d131751c8c85af9c9ccdf22938736973c963678 src/config/backend.rs
|
||||
14a492d853f78681cdfb3ec6a8eb4ccb0155e0acd8b240ce2d7c13a4d049ddf2 src/config/compile.rs
|
||||
e0542812b82c31481e18de2bf50e0f00ec0608be47c48aeb4b2b8429dd9a6e39 src/config/backend.rs
|
||||
43c8d59e5a6f8907cae7dcd28673ff8833abba8d76740fc6e5061147a4e1048d src/config/compile.rs
|
||||
fbea01fea1213d98aea812c1b78d5db289e09200b98ae514d742235cd3fa70e1 src/config/internal_routing.rs
|
||||
c0446a45e3bc8547dcce51579ea137e5c0e1e89f17d4dada950382909ee85745 src/config/model.rs
|
||||
75839458ddbc7480ec4492a95eeb67b617ba7d62f7b67e7a767a3453b74dbcbc src/config/route_policy_tests.rs
|
||||
b07abc119aac079f4bc4715a1e0dea735f84eb50f760b97ce429fbd8cee33106 src/config/routing.rs
|
||||
0353322f4e265e1b2d36a7ac863953daff5f06072797f26c74d01b1865b44faa src/config/routing.rs
|
||||
b33c45184e6451e15ce238cc922d2116269a1bf1d72093c2cdc068c4386a35bd src/config/snapshot.rs
|
||||
477cddaa1e1c0b9b605a2f550971a04cf30287519cba70cfbb2e1860e3a93ff2 src/config/tests.rs
|
||||
f35de0ee1516ece6bbfd2b2a7db7d1e0f5048b0ec47cf2a3765dffb799abfd93 src/config/transport_tests.rs
|
||||
@@ -384,9 +384,9 @@ c05a02618d476e4670b4f9930555f199cac776cdf09edb8fcc1a675695b8f99f src/db/tests.r
|
||||
dada314e1709e960eb2e225b4d10c3cd12606c62c4bc2c0220aec1ba133e4ade src/demo.rs
|
||||
d2ef07d1565569f520a6a8eb01f4ea9bb673499d038018d52e65fe95e800bb27 src/diagnostics.rs
|
||||
045593a42a6e4f632e5052c655788f0843faa313fc929265b89509f6dfff91ed src/docker.rs
|
||||
3e3383b344e33a4a0b818f39309076c973db0a670eb4c4dc5acab63ad801c59e src/docker/client.rs
|
||||
ea041859335219773748acbb479f83245ecdd3301108972fc0e0c1ea4c95717f src/docker/client.rs
|
||||
37ba0b6efea693f3cb2b8b3b1e682b5909ca6f15af71d219fe422c5a04c0e791 src/docker/model.rs
|
||||
b60d9836f0fbde95f6d31b6ec7cf08b253774de0be0d4ea9a1f58b3670680386 src/docker/reconcile.rs
|
||||
73f053f34a013b7a92984f6a82a9d764fa26e558cd2bc0a22d3a5c1cf081a458 src/docker/reconcile.rs
|
||||
279058e42aa043dca0e4c96108125468a44ceb1a9ab49d3b7566681790b53784 src/docker/tests.rs
|
||||
34eb55a240928e98bd34e790ac63096b9ca8bf7a3008676dbbd11e1a392b8541 src/forward_auth/mod.rs
|
||||
6c25951cf69e972c47cdf815f22a5062916b2b768e39d55a26a5fc9e625a2344 src/forward_auth/tests.rs
|
||||
@@ -486,13 +486,13 @@ c85c9f05dac65cde6878bef3ef7258eb9de79ca14c26ca2492e0e13839c40fc3 src/rate_limit
|
||||
db254128c8013adaad7280f40a0edd8b196083afef299cd9e193e6db1d698b82 src/redirect/mod.rs
|
||||
811c83ae9fd0f5a13d35b5443cd37843f82b9d600bee4bb136ba9b87732a5347 src/redirect/tests.rs
|
||||
244d72b3dab36ec505c96d26a967420714fd3807268820f680fb3dcea0e88c0f src/runtime.rs
|
||||
3c71d8eef9ccb49ad93cf6014c5c27756ce0eaeddfca116048f24c483fda68e2 src/runtime/certificates.rs
|
||||
2d610dc36f746215ad3bc1d860ee624a9233886d73a019fd243e51901503fc53 src/runtime/constructors.rs
|
||||
eb2b0eeeb617cad704732d87acb667530144836e26edb0189929b1f25f35c6b5 src/runtime/docker.rs
|
||||
e2a5367eb4e9b35e58acacb2390cc859e7ee5b59379b79e302018737028a90a7 src/runtime/certificates.rs
|
||||
16f0d8f6255204b758ab5584098b220e109ffaa271d28b31d5b7f189b0b2e804 src/runtime/constructors.rs
|
||||
a868442930930eeb71aeb2e14274bb69497ecbc4d844879e3666b636c7c993d9 src/runtime/docker.rs
|
||||
18f7460e3738386e070f66932cd77240001255447a769d6e19a40573254a1473 src/runtime/external_config.rs
|
||||
5999d7e91ee4231da88c5e9c6d8a12ea9f92d20d6dcdb24319f9f90891d7253b src/runtime/tests.rs
|
||||
bab3044f4ad8957b65476a0c307bb8a364825b91d2100233b7bd6efa52e771be src/runtime/types.rs
|
||||
11e99eb425887ad12b73d949f4b497fabc6897fee8fc7647fcb3766269c2fdc0 src/runtime/updates.rs
|
||||
3eb734dcdd16eeb8585fe79df4909d36f06c057fdb2815e2d8abc7745b0a3039 src/runtime/types.rs
|
||||
f30e64fb6f4dc70602b1460f7e289be69fea0fff507d8ef47f7608a5e1fad3b9 src/runtime/updates.rs
|
||||
e3dbd60953db5a976985dd796e4268b41a0f3df59764c4664015bd41e2578058 src/secret_store/mod.rs
|
||||
b0c4a46b40b09794fd8a037afca380ee3b95941bf75a0e1102a4e520a4bd8be3 src/secret_store/tests.rs
|
||||
53bc7b1fcc1eab8860ebafccd0c9ed2aadf75363323891a4a4a22114c323b22a src/security/mod.rs
|
||||
@@ -523,9 +523,9 @@ e0676801259fb09a73825d959b89630bfa0b6f1fd1efd3006af29f60537a2fdf src/system_sta
|
||||
df98becda799b6bf4ff5e2fec7d0e0a486e6b7eca6f9f5ad49ffdafd49a4f498 src/tls.rs
|
||||
2af2164ecdf2b7fd9eef7c6e358dec053dfac9aedaa501dbb75df742d18638b2 src/tls/acme_tests.rs
|
||||
93e0576ac9077e645a72d164bad34cd75fe6032dd0516284d08bddd2fbda4b7c src/tls/certificates.rs
|
||||
5703876c4697512f714e9813e56acb6f852c921140b16d135feee3d0dd21e520 src/tls/external_paths.rs
|
||||
a71f20dbec5802dffe9d51a78b931062b5abdec2bc82ad6fe98abd9c7b5abd7b src/tls/external_paths.rs
|
||||
937b95bb8621ab98d7cad3d223e4dee305350fbd0149b7527396d3bdcc28a68b src/tls/external_paths_tests.rs
|
||||
f168dcafa7452cea9291236905f5502bf0b9a5778f219b5b30d117368601f9d9 src/tls/server_config.rs
|
||||
90ed8c34b49096cf78f50dd014f9e2968942b142ca95d28307f269e3fe5a0fc1 src/tls/server_config.rs
|
||||
2d46b183ea6ab0ef4827e7ceff4cd87c7fb5a3e987789e222a3a617b5e2bd7db src/tls/tests.rs
|
||||
90be472a03d0b1962b466afdd82b8935d98f77d2bb17bd437cbfc3a116ffa402 src/tls/types.rs
|
||||
58f01b9a6dd1095877cc71445b3ccd651d8b2a1a9c0ad543547840834ec1d91b src/traffic/mod.rs
|
||||
@@ -547,7 +547,7 @@ d13fa462d6df516a4cfaee9f4e184044c5b6345e311aeb3d9058efafe54e4c5e src/transform/
|
||||
8d38f2f7d4ca4dd453cd0e2337614ec704fbd0a36d3e2374cda43f05dfcad663 src/update_check/mod.rs
|
||||
c42d000d1d576721af3ffe930589388693001b8113554a7658f6dcbc665b5d1b src/update_check/tests.rs
|
||||
70e6cdf339da86183b4cd07567a4bb99135dccea5b0fb4a6c37c4098ec4762cd src/upstream.rs
|
||||
fe9d4deb34cea2408ac5a1030315989f29a6a7d078a46ac1b59d12aa07f67878 src/upstream/client.rs
|
||||
db8b97484f7d3faa970c3bd5f859c000040d34dbdffc8e1670164e9ab3429c7a src/upstream/client.rs
|
||||
80e9952b6a4b2241aff8ee259d286f0381b3c974032adc2c276764d14878fc67 src/upstream/client_tests.rs
|
||||
56b1e4242f8153391cd9a01fbb3017a2dbda9d02e83da6bbfb39ed44854534b5 src/upstream/protocol_tests.rs
|
||||
ae880b40197454ea3fbf4d2113984dc372098b2e54b97e87c83cc319de253377 src/upstream/tests.rs
|
||||
@@ -585,11 +585,10 @@ e5f5fbe702f66bfcbcbc1d1f3cd3d89bdbb929bb86aed94868a2a06a4b9e59e3 src/web_server
|
||||
b791762b4ab7a43c3be19df84e523faf3dfb4df055f66d02178f93edb60d2204 src/web_server/serve.rs
|
||||
714418c86ab241020a561fcf662a8fe324a6a70cc2fd3a313c56d7939c14b9e8 src/web_server/tests.rs
|
||||
f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures/argon2id.json
|
||||
ebe8f1318aa55c381062988badd09e0cc9e9b40609252435dcf4ce2b230aeaa9 tests/panel_cache_stats_contract.js
|
||||
102b83171a6429b6375d8001d6c5294702385cd58ee55727cb657b1f3566e877 tests/panel_icons_browser.py
|
||||
c4030b7d224553312012b1f25153dd3545e83de7bccff2894c0e8f7e0e84b721 tests/panel_icons_contract.js
|
||||
886c89e8517f34af5e2aef9672a8de559f94c536b028f1b9cadf2a2a7220d826 tests/panel_interface_contract.py
|
||||
5aa5e5b11d8fb65e889a720962256d4ea32b226570b1e5de76ac63c448560d4a tests/panel_refresh_contract.js
|
||||
1b07b3809ca3bb2d931dda61528d820ea21423a6642f4686985a5042663ea204 tests/panel_refresh_contract.js
|
||||
e24a0f84f1bfc46964df865ac387d651f7b384d781cbc8f3a9a5b0b60f3d69ca tests/vhost_auth_selection.js
|
||||
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 third_party/swagger-ui-5.33.1/LICENSE
|
||||
0d20d1adef18aee3f40dd258172155521ce702ac445cb5f7b7d60ed32dad2fb2 third_party/swagger-ui-5.33.1/NOTICE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package main
|
||||
|
||||
var version = "0.37.2" // overridden by the package builder using -ldflags -X main.version
|
||||
var version = "0.37.3" // overridden by the package builder using -ldflags -X main.version
|
||||
|
||||
type config struct {
|
||||
Listen string
|
||||
|
||||
@@ -126,7 +126,7 @@ A token change invalidates the previous token after service restart. The agent l
|
||||
- Usable Docker-host interface/IP addresses and each published host binding, allowing an explicit backend address selection when the host has multiple networks.
|
||||
- Default technical hostname from the Docker container name (including a Compose `container_name` or its generated container name), without image name or port suffix. Existing publications using the previous auto-generated port-suffixed name switch to the container name during reconciliation; manually selected hostnames and aliases are preserved. The agent does not install applications, change Docker network rules or deploy TLS on their behalf.
|
||||
|
||||
Agent inventory polling is separate from the panel's live status refresh. A new agent may initially show **WAITING** until the first poll, not a failure. **Refresh agents** requests an immediate agent update. Actual failures report a reason; a temporary agent outage can preserve the last successful inventory while a successful missing-service observation can lead to a generated route returning `503` until the service returns.
|
||||
Agent inventory polling is separate from the panel's live status refresh. Since 0.37.3 a poll only rebuilds the runtime configuration when the generated Docker vhosts or the configured certificate files changed; an unchanged inventory costs no recompilation, TLS rebuild or certificate read. A new agent may initially show **WAITING** until the first poll, not a failure. **Refresh agents** requests an immediate agent update. Actual failures report a reason; a temporary agent outage can preserve the last successful inventory while a successful missing-service observation can lead to a generated route returning `503` until the service returns.
|
||||
|
||||
## Publish a discovered application
|
||||
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ The mimalloc rows above were measured with 0.35.2 and a different object mix; re
|
||||
|
||||
### Where the memory goes
|
||||
|
||||
Process memory is always larger than the configured HOT cache. The HOT size already includes RustProxy's estimate of per-object bookkeeping (index, keys, headers), but not allocator rounding and fragmentation, connection and TLS buffers, the runtime, logs or GeoIP data. Enable the optional **Memory breakdown** Overview card to see the split for your workload: if the "Outside cache" trend stays flat while the cache is full, the difference is overhead or fragmentation; a steady rise points to memory that is not released. For reference, Varnish documents about 1 KiB of per-object overhead outside its storage size and notes that total use can reach about twice the configured storage.
|
||||
Process memory is always larger than the configured HOT cache. The HOT size already includes RustProxy's estimate of per-object bookkeeping (index, keys, headers), but not allocator rounding and fragmentation, connection and TLS buffers, the runtime, logs or GeoIP data. Enable the optional **Memory breakdown** Overview card to see the split for your workload: if the "Outside cache" trend stays flat while the cache is full, the difference is overhead or fragmentation; a steady rise points to memory that is not released. Since 0.37.3 Docker agent polls no longer rebuild the configuration when nothing changed, which previously allocated and discarded the compiled configuration (TLS settings, certificates, routes) every few seconds and raised both CPU use and allocator fragmentation on servers with many vhosts. For reference, Varnish documents about 1 KiB of per-object overhead outside its storage size and notes that total use can reach about twice the configured storage.
|
||||
|
||||
## Production tuning
|
||||
|
||||
|
||||
@@ -77,10 +77,10 @@ ENV_FILE=integrations/routeros-oci-build/.env \
|
||||
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
||||
```
|
||||
|
||||
For example, with RustProxy version `0.37.2` and the defaults this publishes:
|
||||
For example, with RustProxy version `0.37.3` and the defaults this publishes:
|
||||
|
||||
```text
|
||||
oci.example.net/network/rustproxy:0.37.2
|
||||
oci.example.net/network/rustproxy:0.37.3
|
||||
oci.example.net/network/rustproxy:latest
|
||||
oci.example.net/network/rustproxy:routeros
|
||||
```
|
||||
|
||||
@@ -61,6 +61,35 @@ mod renewal_regressions {
|
||||
app.tunnels.wait().await;
|
||||
app.store.close().await;
|
||||
}
|
||||
#[tokio::test]
|
||||
async fn docker_reconcile_skips_unchanged_effective_configuration() {
|
||||
let (app, directory, _original, _output) = configured(true).await;
|
||||
app.reconcile_docker().await.unwrap();
|
||||
let first = app.config.load_full();
|
||||
app.reconcile_docker().await.unwrap();
|
||||
assert!(Arc::ptr_eq(&first, &app.config.load_full()));
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
let certs = directory.path().join("certs");
|
||||
for extension in ["pem", "key"] {
|
||||
std::fs::copy(
|
||||
certs.join(format!("acme-next.{extension}")),
|
||||
certs.join(format!("acme-old.{extension}")),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
app.reconcile_docker().await.unwrap();
|
||||
let reloaded = app.config.load_full();
|
||||
assert!(!Arc::ptr_eq(&first, &reloaded));
|
||||
app.reconcile_docker().await.unwrap();
|
||||
assert!(Arc::ptr_eq(&reloaded, &app.config.load_full()));
|
||||
app.reload_certificates().await.unwrap();
|
||||
let explicit = app.config.load_full();
|
||||
assert!(!Arc::ptr_eq(&reloaded, &explicit));
|
||||
app.reconcile_docker().await.unwrap();
|
||||
assert!(Arc::ptr_eq(&explicit, &app.config.load_full()));
|
||||
stop(app).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn renewed_pair_publishes_one_revision_and_preserves_bindings_and_old_files() {
|
||||
let (app, _directory, original, output) = configured(true).await;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "RustProxy Administration API",
|
||||
"version": "0.37.2",
|
||||
"version": "0.37.3",
|
||||
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
|
||||
},
|
||||
"servers": [
|
||||
|
||||
+34
-14
@@ -4,6 +4,17 @@ pub(crate) fn compile_backend_with_timeout(
|
||||
bindings: &[SocketAddr],
|
||||
keepalive: &crate::balance::Keepalive,
|
||||
connect_timeout: std::time::Duration,
|
||||
) -> Result<CompiledBackend> {
|
||||
compile_backend_reusing(backend, policy, bindings, keepalive, connect_timeout, None)
|
||||
}
|
||||
|
||||
pub(crate) fn compile_backend_reusing(
|
||||
backend: &Backend,
|
||||
policy: &ValidationPolicy,
|
||||
bindings: &[SocketAddr],
|
||||
keepalive: &crate::balance::Keepalive,
|
||||
connect_timeout: std::time::Duration,
|
||||
reuse: Option<&CompiledBackend>,
|
||||
) -> Result<CompiledBackend> {
|
||||
ensure!(valid_id(&backend.id), "invalid backend id");
|
||||
ensure!(backend.url.len() <= 512, "backend URL too long");
|
||||
@@ -70,23 +81,32 @@ pub(crate) fn compile_backend_with_timeout(
|
||||
.as_deref()
|
||||
.map(|name| format!("{name}:{port}"))
|
||||
.unwrap_or_else(|| authority.clone());
|
||||
let client = crate::upstream::client_with_timeout(
|
||||
backend,
|
||||
address_policy.clone(),
|
||||
false,
|
||||
keepalive,
|
||||
connect_timeout,
|
||||
)?;
|
||||
let build_client = |previous: Option<&crate::upstream::ProxyClient>, websocket: bool| {
|
||||
let reusable = previous.filter(|client| {
|
||||
client.built_with(
|
||||
backend,
|
||||
&address_policy,
|
||||
websocket,
|
||||
keepalive,
|
||||
connect_timeout,
|
||||
)
|
||||
});
|
||||
match reusable {
|
||||
Some(client) => Ok(client.clone()),
|
||||
None => crate::upstream::client_with_timeout(
|
||||
backend,
|
||||
address_policy.clone(),
|
||||
websocket,
|
||||
keepalive,
|
||||
connect_timeout,
|
||||
),
|
||||
}
|
||||
};
|
||||
let client = build_client(reuse.map(|item| &item.client), false)?;
|
||||
let websocket_client = if backend.protocol == UpstreamProtocol::Http1 {
|
||||
client.clone()
|
||||
} else {
|
||||
crate::upstream::client_with_timeout(
|
||||
backend,
|
||||
address_policy.clone(),
|
||||
true,
|
||||
keepalive,
|
||||
connect_timeout,
|
||||
)?
|
||||
build_client(reuse.map(|item| &item.websocket_client), true)?
|
||||
};
|
||||
let request_origin = format!("{}://{request_authority}", url.scheme());
|
||||
let request_origin_uri: http::Uri = request_origin.parse()?;
|
||||
|
||||
@@ -353,7 +353,7 @@ pub fn compile_with_active(
|
||||
&web_services,
|
||||
previous,
|
||||
&effective_tls,
|
||||
&tls,
|
||||
(&tls, &tls_http1),
|
||||
)?;
|
||||
let quic_tls = tls
|
||||
.as_ref()
|
||||
|
||||
+45
-6
@@ -7,8 +7,18 @@ fn compile_routing(
|
||||
web_services: &HashMap<String, Arc<crate::web_server::CompiledService>>,
|
||||
previous: Option<&Snapshot>,
|
||||
effective_tls: &crate::tls::Settings,
|
||||
tls: &Option<Arc<rustls::ServerConfig>>,
|
||||
(tls, tls_http1): (
|
||||
&Option<Arc<rustls::ServerConfig>>,
|
||||
&Option<Arc<rustls::ServerConfig>>,
|
||||
),
|
||||
) -> Result<RoutingBuild> {
|
||||
let mut tls_variants: Vec<(crate::tls::ProtocolPolicy, bool, Arc<rustls::ServerConfig>)> =
|
||||
Vec::new();
|
||||
for (config, http2) in [(tls, true), (tls_http1, false)] {
|
||||
if let Some(config) = config {
|
||||
tls_variants.push((effective_tls.policy.clone(), http2, config.clone()));
|
||||
}
|
||||
}
|
||||
let mut routes: HashMap<String, Vec<Arc<CompiledRoute>>> = HashMap::new();
|
||||
let mut fallbacks: HashMap<String, Vec<Arc<CompiledRoute>>> = HashMap::new();
|
||||
let mut frontends: HashMap<String, Vec<Arc<CompiledFrontend>>> = HashMap::new();
|
||||
@@ -104,31 +114,43 @@ fn compile_routing(
|
||||
&& route.source.is_reverse_proxy()
|
||||
});
|
||||
let mut compiled_members = Vec::new();
|
||||
let previous_pool = previous.and_then(|s| s.pools.iter().find(|p| p.id == host.id));
|
||||
for definition in host.backends.iter().filter(|_| needs_proxy_pool) {
|
||||
let connect_timeout = host
|
||||
.proxy_timeouts
|
||||
.connect_timeout()
|
||||
.unwrap_or(std::time::Duration::from_secs(10));
|
||||
let mut backend = compile_backend_with_timeout(
|
||||
let member_id = format!("{}/{}", host.id, definition.id);
|
||||
let previous_backend = previous_pool.and_then(|pool| {
|
||||
pool.members
|
||||
.iter()
|
||||
.find(|member| member.backend.id == member_id)
|
||||
.map(|member| member.backend.clone())
|
||||
});
|
||||
let mut backend = compile_backend_reusing(
|
||||
&definition.backend(),
|
||||
desired_policy,
|
||||
guarded_bindings,
|
||||
&host.load_balancing.keepalive,
|
||||
connect_timeout,
|
||||
previous_backend.as_deref(),
|
||||
)
|
||||
.with_context(|| format!("vhost {} backend {}", host.id, definition.id))?;
|
||||
backend.id = format!("{}/{}", host.id, definition.id);
|
||||
backend.id = member_id;
|
||||
let health = host.load_balancing.health_for(definition);
|
||||
if health.mode != crate::balance::HealthMode::Off {
|
||||
if let Some(probe) =
|
||||
health_probe_backend(&definition.backend(), health.port)?
|
||||
{
|
||||
let mut probe = compile_backend_with_timeout(
|
||||
let mut probe = compile_backend_reusing(
|
||||
&probe,
|
||||
desired_policy,
|
||||
guarded_bindings,
|
||||
&host.load_balancing.keepalive,
|
||||
connect_timeout,
|
||||
previous_backend
|
||||
.as_ref()
|
||||
.and_then(|item| item.health_probe.as_deref()),
|
||||
)
|
||||
.with_context(|| {
|
||||
format!("vhost {} backend {} health check port", host.id, definition.id)
|
||||
@@ -193,11 +215,11 @@ fn compile_routing(
|
||||
}
|
||||
let frontend_tls = tls
|
||||
.as_ref()
|
||||
.map(|base| crate::tls::variant(base, &tls_policy, true))
|
||||
.map(|base| shared_tls_variant(&mut tls_variants, base, &tls_policy, true))
|
||||
.transpose()?;
|
||||
let frontend_tls_http1 = tls
|
||||
.as_ref()
|
||||
.map(|base| crate::tls::variant(base, &tls_policy, false))
|
||||
.map(|base| shared_tls_variant(&mut tls_variants, base, &tls_policy, false))
|
||||
.transpose()?;
|
||||
let profile_policies: Vec<crate::acl::ProfileAccess> =
|
||||
crate::acl::profile_ids(host.acl_profile_id.as_deref(), &host.acl_profile_ids)
|
||||
@@ -498,3 +520,20 @@ fn compile_routing(
|
||||
vhost_metrics,
|
||||
})
|
||||
}
|
||||
|
||||
fn shared_tls_variant(
|
||||
variants: &mut Vec<(crate::tls::ProtocolPolicy, bool, Arc<rustls::ServerConfig>)>,
|
||||
base: &Arc<rustls::ServerConfig>,
|
||||
policy: &crate::tls::ProtocolPolicy,
|
||||
http2: bool,
|
||||
) -> Result<Arc<rustls::ServerConfig>> {
|
||||
if let Some((_, _, config)) = variants
|
||||
.iter()
|
||||
.find(|(known, known_http2, _)| *known_http2 == http2 && known == policy)
|
||||
{
|
||||
return Ok(config.clone());
|
||||
}
|
||||
let config = crate::tls::variant(base, policy, http2)?;
|
||||
variants.push((policy.clone(), http2, config.clone()));
|
||||
Ok(config)
|
||||
}
|
||||
+36
-27
@@ -164,30 +164,38 @@ impl Manager {
|
||||
*active = current;
|
||||
}
|
||||
|
||||
pub async fn refresh(&self, settings: &Settings, force: bool) -> (Vec<Observation>, bool) {
|
||||
pub async fn refresh(
|
||||
&self,
|
||||
settings: &Settings,
|
||||
force: bool,
|
||||
) -> (Arc<BTreeMap<String, Observation>>, bool) {
|
||||
let now = now_ms();
|
||||
let snapshot = self.observations.read().await.clone();
|
||||
let due: Vec<_> = settings
|
||||
.agents
|
||||
.iter()
|
||||
.filter(|agent| agent.enabled)
|
||||
.filter(|agent| {
|
||||
force
|
||||
|| snapshot.get(&agent.id).is_none_or(|observation| {
|
||||
now.saturating_sub(observation.checked_at_unix_ms)
|
||||
>= agent.poll_interval_seconds.saturating_mul(1000)
|
||||
let due: Vec<_> = {
|
||||
let snapshot = self.observations.read().await;
|
||||
settings
|
||||
.agents
|
||||
.iter()
|
||||
.filter(|agent| agent.enabled)
|
||||
.filter_map(|agent| {
|
||||
let previous = snapshot.get(&agent.id);
|
||||
let due = force
|
||||
|| previous.is_none_or(|observation| {
|
||||
now.saturating_sub(observation.checked_at_unix_ms)
|
||||
>= agent.poll_interval_seconds.saturating_mul(1000)
|
||||
});
|
||||
due.then(|| {
|
||||
(
|
||||
agent.clone(),
|
||||
previous.and_then(|observation| observation.inventory.clone()),
|
||||
previous.and_then(|observation| observation.last_ok_unix_ms),
|
||||
)
|
||||
})
|
||||
})
|
||||
.cloned()
|
||||
.collect();
|
||||
let futures = due.into_iter().map(|agent| {
|
||||
let previous_inventory = snapshot
|
||||
.get(&agent.id)
|
||||
.and_then(|observation| observation.inventory.clone());
|
||||
let previous_ok = snapshot
|
||||
.get(&agent.id)
|
||||
.and_then(|observation| observation.last_ok_unix_ms);
|
||||
async move {
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
let futures = due
|
||||
.into_iter()
|
||||
.map(|(agent, previous_inventory, previous_ok)| async move {
|
||||
let checked_at_unix_ms = now_ms();
|
||||
match fetch(&agent).await {
|
||||
Ok(inventory) => Observation {
|
||||
@@ -207,8 +215,7 @@ impl Manager {
|
||||
inventory: previous_inventory,
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
let refreshed = join_all(futures).await;
|
||||
let enabled: HashSet<_> = settings
|
||||
.agents
|
||||
@@ -224,10 +231,12 @@ impl Manager {
|
||||
state.insert(observation.agent_id.clone(), observation);
|
||||
changed = true;
|
||||
}
|
||||
if changed {
|
||||
self.latest.store(Arc::new(state.clone()));
|
||||
if !changed {
|
||||
return (self.latest.load_full(), false);
|
||||
}
|
||||
(state.values().cloned().collect(), changed)
|
||||
let latest = Arc::new(state.clone());
|
||||
self.latest.store(latest.clone());
|
||||
(latest, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -647,12 +647,13 @@ pub async fn poll_loop(
|
||||
break;
|
||||
};
|
||||
let settings = app.config.load().envelope.config.docker_agents.clone();
|
||||
let had_observations = !app.docker.view().await.is_empty();
|
||||
let had_observations = !app.docker.latest().is_empty();
|
||||
if !settings.agents.is_empty() || had_observations {
|
||||
let (_, changed) = app.docker.refresh(&settings, false).await;
|
||||
let config = app.config.load().envelope.config.clone();
|
||||
let snapshot = app.config.load_full();
|
||||
app.docker
|
||||
.track_alerts(&alerts(&config, &app.docker.latest()));
|
||||
.track_alerts(&alerts(&snapshot.envelope.config, &app.docker.latest()));
|
||||
drop(snapshot);
|
||||
if changed {
|
||||
if let Err(error) = app.reconcile_docker().await {
|
||||
tracing::warn!(error = ?error, "Docker discovery reconcile failed");
|
||||
|
||||
@@ -45,6 +45,7 @@ impl App {
|
||||
let revision = previous.envelope.revision;
|
||||
let prepared = tokio::task::spawn_blocking(move || {
|
||||
let effective = crate::docker::effective_config(desired, &observed)?;
|
||||
let digest = effective_digest(&effective, policy.cert_dir.as_deref());
|
||||
let mut prepared = config::compile_with_active(
|
||||
effective,
|
||||
revision,
|
||||
@@ -58,7 +59,7 @@ impl App {
|
||||
.config
|
||||
.vhosts
|
||||
.truncate(desired_vhost_count);
|
||||
Ok::<_, anyhow::Error>(prepared)
|
||||
Ok::<_, anyhow::Error>((prepared, digest))
|
||||
})
|
||||
.await
|
||||
.map_err(|_| {
|
||||
@@ -68,7 +69,8 @@ impl App {
|
||||
)
|
||||
})?
|
||||
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, format!("{error:#}")))?;
|
||||
self.config.store(Arc::new(prepared));
|
||||
let (prepared, digest) = prepared;
|
||||
self.store_snapshot(prepared, digest);
|
||||
crate::acl::dynamic::config_changed();
|
||||
if let Some(certificate_id) = certificate_id {
|
||||
tracing::info!(
|
||||
|
||||
@@ -196,6 +196,7 @@ impl App {
|
||||
body_idle_timeout,
|
||||
config_file: Mutex::new(None),
|
||||
update_lock: Mutex::new(()),
|
||||
docker_applied: std::sync::Mutex::new(None),
|
||||
update_slots: Arc::new(Semaphore::new(8)),
|
||||
});
|
||||
let weak = Arc::downgrade(&app);
|
||||
|
||||
+53
-3
@@ -9,8 +9,20 @@ impl App {
|
||||
let defaults = self.startup_listeners;
|
||||
let active_listeners = self.active_listeners.clone();
|
||||
let revision = previous.envelope.revision;
|
||||
let previous_weak = Arc::downgrade(&previous);
|
||||
let applied = self
|
||||
.docker_applied
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|slot| slot.clone())
|
||||
.filter(|(weak, _)| weak.ptr_eq(&previous_weak))
|
||||
.map(|(_, digest)| digest);
|
||||
let prepared = tokio::task::spawn_blocking(move || {
|
||||
let effective = crate::docker::effective_config(desired, &observed)?;
|
||||
let digest = effective_digest(&effective, policy.cert_dir.as_deref());
|
||||
if digest.is_some() && applied == digest {
|
||||
return Ok::<_, anyhow::Error>((None, digest));
|
||||
}
|
||||
let mut prepared = config::compile_with_active(
|
||||
effective,
|
||||
revision,
|
||||
@@ -24,7 +36,7 @@ impl App {
|
||||
.config
|
||||
.vhosts
|
||||
.truncate(desired_vhost_count);
|
||||
Ok::<_, anyhow::Error>(prepared)
|
||||
Ok((Some(prepared), digest))
|
||||
})
|
||||
.await
|
||||
.map_err(|_| {
|
||||
@@ -34,11 +46,23 @@ impl App {
|
||||
)
|
||||
})?
|
||||
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, format!("{error:#}")))?;
|
||||
self.config.store(Arc::new(prepared));
|
||||
let (prepared, digest) = prepared;
|
||||
let Some(prepared) = prepared else {
|
||||
return Ok(());
|
||||
};
|
||||
self.store_snapshot(prepared, digest);
|
||||
crate::acl::dynamic::config_changed();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn store_snapshot(&self, prepared: Snapshot, digest: Option<[u8; 32]>) {
|
||||
let prepared = Arc::new(prepared);
|
||||
self.config.store(prepared.clone());
|
||||
if let Ok(mut slot) = self.docker_applied.lock() {
|
||||
*slot = digest.map(|digest| (Arc::downgrade(&prepared), digest));
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn refresh_docker(
|
||||
self: &Arc<Self>,
|
||||
) -> Result<Vec<crate::docker::Observation>, ApiError> {
|
||||
@@ -47,6 +71,32 @@ impl App {
|
||||
if changed {
|
||||
self.reconcile_docker().await?;
|
||||
}
|
||||
Ok(observations)
|
||||
Ok(observations.values().cloned().collect())
|
||||
}
|
||||
}
|
||||
|
||||
struct DigestWriter(sha2::Sha256);
|
||||
|
||||
impl std::io::Write for DigestWriter {
|
||||
fn write(&mut self, bytes: &[u8]) -> std::io::Result<usize> {
|
||||
sha2::Digest::update(&mut self.0, bytes);
|
||||
Ok(bytes.len())
|
||||
}
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn effective_digest(
|
||||
config: &config::Config,
|
||||
certificate_dir: Option<&std::path::Path>,
|
||||
) -> Option<[u8; 32]> {
|
||||
let mut writer = DigestWriter(<sha2::Sha256 as sha2::Digest>::new());
|
||||
serde_json::to_writer(&mut writer, config).ok()?;
|
||||
for stamp in crate::tls::certificate_file_stamps(&config.tls, certificate_dir) {
|
||||
for value in stamp {
|
||||
sha2::Digest::update(&mut writer.0, value.to_le_bytes());
|
||||
}
|
||||
}
|
||||
Some(sha2::Digest::finalize(writer.0).into())
|
||||
}
|
||||
@@ -19,6 +19,8 @@ use std::{
|
||||
};
|
||||
use tokio::sync::{Mutex, Semaphore};
|
||||
|
||||
type DockerApplied = (std::sync::Weak<Snapshot>, [u8; 32]);
|
||||
|
||||
pub struct App {
|
||||
pub basic_workers: Arc<Semaphore>,
|
||||
pub basic_limits: crate::basic_auth::Limits,
|
||||
@@ -61,6 +63,7 @@ pub struct App {
|
||||
pub body_idle_timeout: Duration,
|
||||
pub config_file: Mutex<Option<(std::path::PathBuf, external_config::Fingerprint)>>,
|
||||
update_lock: Mutex<()>,
|
||||
docker_applied: std::sync::Mutex<Option<DockerApplied>>,
|
||||
update_slots: Arc<Semaphore>,
|
||||
}
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -121,8 +121,9 @@ impl App {
|
||||
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, format!("{error:#}")))?;
|
||||
crate::tls::validate_certificate_removals(&previous_config, &desired_config)
|
||||
.map_err(|error| ApiError(StatusCode::UNPROCESSABLE_ENTITY, format!("{error:#}")))?;
|
||||
let (prepared, invalidation, slot) = tokio::task::spawn_blocking(move || {
|
||||
let ((prepared, digest), invalidation, slot) = tokio::task::spawn_blocking(move || {
|
||||
let effective = crate::docker::effective_config(desired_config, &observed)?;
|
||||
let digest = effective_digest(&effective, policy.cert_dir.as_deref());
|
||||
let mut prepared = config::compile_with_active(
|
||||
effective,
|
||||
revision,
|
||||
@@ -137,7 +138,7 @@ impl App {
|
||||
.vhosts
|
||||
.truncate(desired_vhost_count);
|
||||
let invalidation = cache_invalidation(&previous_config, &prepared.envelope.config);
|
||||
Ok::<_, anyhow::Error>((prepared, invalidation, slot))
|
||||
Ok::<_, anyhow::Error>(((prepared, digest), invalidation, slot))
|
||||
})
|
||||
.await
|
||||
.map_err(|_| {
|
||||
@@ -263,7 +264,7 @@ impl App {
|
||||
this.rate_limiter.reset();
|
||||
this.logs.configure(envelope.config.logging.clone());
|
||||
crate::logging::configure_error_log(envelope.config.error_log.clone());
|
||||
this.config.store(Arc::new(prepared));
|
||||
this.store_snapshot(prepared, digest);
|
||||
crate::acl::dynamic::config_changed();
|
||||
tracing::info!(revision, "configuration applied");
|
||||
Ok(envelope)
|
||||
|
||||
@@ -156,3 +156,47 @@ fn read_pem_with_policy(
|
||||
);
|
||||
Ok(data)
|
||||
}
|
||||
|
||||
pub fn certificate_file_stamps(settings: &Settings, directory: Option<&Path>) -> Vec<[i64; 4]> {
|
||||
let Some(directory) = directory else {
|
||||
return Vec::new();
|
||||
};
|
||||
settings
|
||||
.certificates
|
||||
.iter()
|
||||
.flat_map(|item| [item.cert_file.as_str(), item.key_file.as_str()])
|
||||
.map(|value| {
|
||||
configured_certificate_path(directory, value)
|
||||
.ok()
|
||||
.and_then(|path| fs::metadata(path).ok())
|
||||
.map(|meta| file_stamp(&meta))
|
||||
.unwrap_or([-1; 4])
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn file_stamp(meta: &fs::Metadata) -> [i64; 4] {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
[
|
||||
meta.mtime(),
|
||||
meta.mtime_nsec(),
|
||||
meta.size() as i64,
|
||||
meta.ino() as i64,
|
||||
]
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn file_stamp(meta: &fs::Metadata) -> [i64; 4] {
|
||||
let modified = meta
|
||||
.modified()
|
||||
.ok()
|
||||
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
|
||||
.unwrap_or_default();
|
||||
[
|
||||
modified.as_secs() as i64,
|
||||
modified.subsec_nanos() as i64,
|
||||
meta.len() as i64,
|
||||
0,
|
||||
]
|
||||
}
|
||||
@@ -396,10 +396,10 @@ pub fn compile(settings: &Settings, directory: Option<&Path>) -> Result<Option<A
|
||||
tracing::warn!(certificate = %cert.id, hostname = %host,
|
||||
"Explicitly serving a TLS certificate without hostname verification; clients may reject it");
|
||||
}
|
||||
names.insert(host, Arc::new(key.clone()));
|
||||
names.insert(host, shared.clone());
|
||||
}
|
||||
if settings.default_certificate.as_deref() == Some(cert.id.as_str()) {
|
||||
default = Some(Arc::new(key));
|
||||
default = Some(shared.clone());
|
||||
}
|
||||
}
|
||||
if settings.default_certificate.is_some() {
|
||||
|
||||
@@ -93,6 +93,22 @@ impl std::fmt::Debug for ProxyClient {
|
||||
}
|
||||
|
||||
impl ProxyClient {
|
||||
pub fn built_with(
|
||||
&self,
|
||||
backend: &Backend,
|
||||
policy: &AddressPolicy,
|
||||
websocket: bool,
|
||||
keepalive: &crate::balance::Keepalive,
|
||||
timeout: Duration,
|
||||
) -> bool {
|
||||
let factory = &self.inner.factory;
|
||||
factory.websocket == websocket
|
||||
&& factory.timeout == timeout
|
||||
&& factory.backend == *backend
|
||||
&& factory.policy == *policy
|
||||
&& factory.keepalive == *keepalive
|
||||
}
|
||||
|
||||
fn new(current: RawProxyClient, factory: ClientFactory) -> Self {
|
||||
Self {
|
||||
inner: Arc::new(RotatingClient {
|
||||
|
||||
@@ -51,5 +51,5 @@ const events = openapi.paths["/api/events"].get;
|
||||
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
||||
assert.equal(logsFlag?.schema?.type, "boolean");
|
||||
assert.equal(logsFlag?.schema?.default, true);
|
||||
assert.equal(openapi.info.version, "0.37.2");
|
||||
assert.equal(openapi.info.version, "0.37.3");
|
||||
console.log("Panel refresh/API contract checks: OK");
|
||||
Reference in new issue
Block a user