itsi 0.1.11 → 0.1.12

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.
Files changed (293) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +1535 -45
  3. data/{sandbox/itsi_itsi_file/Itsi.rb → Itsi.rb} +19 -13
  4. data/Rakefile +8 -7
  5. data/crates/itsi_error/src/lib.rs +9 -0
  6. data/crates/itsi_rb_helpers/Cargo.toml +1 -0
  7. data/crates/itsi_rb_helpers/src/heap_value.rs +18 -0
  8. data/crates/itsi_rb_helpers/src/lib.rs +34 -7
  9. data/crates/itsi_server/Cargo.toml +69 -30
  10. data/crates/itsi_server/src/lib.rs +79 -147
  11. data/crates/itsi_server/src/{body_proxy → ruby_types/itsi_body_proxy}/big_bytes.rs +10 -5
  12. data/crates/itsi_server/src/{body_proxy/itsi_body_proxy.rs → ruby_types/itsi_body_proxy/mod.rs} +22 -3
  13. data/crates/itsi_server/src/ruby_types/itsi_grpc_request.rs +147 -0
  14. data/crates/itsi_server/src/ruby_types/itsi_grpc_response.rs +19 -0
  15. data/crates/itsi_server/src/ruby_types/itsi_grpc_stream/mod.rs +216 -0
  16. data/{gems/server/ext/itsi_server/src/request/itsi_request.rs → crates/itsi_server/src/ruby_types/itsi_http_request.rs} +101 -117
  17. data/crates/itsi_server/src/{response/itsi_response.rs → ruby_types/itsi_http_response.rs} +72 -41
  18. data/crates/itsi_server/src/ruby_types/itsi_server/file_watcher.rs +225 -0
  19. data/crates/itsi_server/src/ruby_types/itsi_server/itsi_server_config.rs +355 -0
  20. data/crates/itsi_server/src/ruby_types/itsi_server.rs +82 -0
  21. data/crates/itsi_server/src/ruby_types/mod.rs +55 -0
  22. data/crates/itsi_server/src/server/bind.rs +13 -5
  23. data/crates/itsi_server/src/server/byte_frame.rs +32 -0
  24. data/crates/itsi_server/src/server/cache_store.rs +74 -0
  25. data/crates/itsi_server/src/server/itsi_service.rs +172 -0
  26. data/crates/itsi_server/src/server/lifecycle_event.rs +3 -0
  27. data/crates/itsi_server/src/server/listener.rs +102 -2
  28. data/crates/itsi_server/src/server/middleware_stack/middleware.rs +153 -0
  29. data/crates/itsi_server/src/server/middleware_stack/middlewares/allow_list.rs +47 -0
  30. data/crates/itsi_server/src/server/middleware_stack/middlewares/auth_api_key.rs +58 -0
  31. data/crates/itsi_server/src/server/middleware_stack/middlewares/auth_basic.rs +82 -0
  32. data/crates/itsi_server/src/server/middleware_stack/middlewares/auth_jwt.rs +321 -0
  33. data/crates/itsi_server/src/server/middleware_stack/middlewares/cache_control.rs +139 -0
  34. data/crates/itsi_server/src/server/middleware_stack/middlewares/compression.rs +300 -0
  35. data/crates/itsi_server/src/server/middleware_stack/middlewares/cors.rs +287 -0
  36. data/crates/itsi_server/src/server/middleware_stack/middlewares/deny_list.rs +48 -0
  37. data/crates/itsi_server/src/server/middleware_stack/middlewares/error_response.rs +127 -0
  38. data/crates/itsi_server/src/server/middleware_stack/middlewares/etag.rs +191 -0
  39. data/crates/itsi_server/src/server/middleware_stack/middlewares/grpc_service.rs +72 -0
  40. data/crates/itsi_server/src/server/middleware_stack/middlewares/header_interpretation.rs +85 -0
  41. data/crates/itsi_server/src/server/middleware_stack/middlewares/intrusion_protection.rs +195 -0
  42. data/crates/itsi_server/src/server/middleware_stack/middlewares/log_requests.rs +82 -0
  43. data/crates/itsi_server/src/server/middleware_stack/middlewares/mod.rs +82 -0
  44. data/crates/itsi_server/src/server/middleware_stack/middlewares/proxy.rs +216 -0
  45. data/crates/itsi_server/src/server/middleware_stack/middlewares/rate_limit.rs +124 -0
  46. data/crates/itsi_server/src/server/middleware_stack/middlewares/redirect.rs +76 -0
  47. data/crates/itsi_server/src/server/middleware_stack/middlewares/request_headers.rs +43 -0
  48. data/crates/itsi_server/src/server/middleware_stack/middlewares/response_headers.rs +34 -0
  49. data/crates/itsi_server/src/server/middleware_stack/middlewares/ruby_app.rs +93 -0
  50. data/crates/itsi_server/src/server/middleware_stack/middlewares/static_assets.rs +162 -0
  51. data/crates/itsi_server/src/server/middleware_stack/middlewares/string_rewrite.rs +158 -0
  52. data/crates/itsi_server/src/server/middleware_stack/middlewares/token_source.rs +12 -0
  53. data/crates/itsi_server/src/server/middleware_stack/mod.rs +315 -0
  54. data/crates/itsi_server/src/server/mod.rs +8 -1
  55. data/crates/itsi_server/src/server/process_worker.rs +38 -12
  56. data/crates/itsi_server/src/server/rate_limiter.rs +565 -0
  57. data/crates/itsi_server/src/server/request_job.rs +11 -0
  58. data/crates/itsi_server/src/server/serve_strategy/cluster_mode.rs +119 -42
  59. data/crates/itsi_server/src/server/serve_strategy/mod.rs +9 -6
  60. data/crates/itsi_server/src/server/serve_strategy/single_mode.rs +256 -111
  61. data/crates/itsi_server/src/server/signal.rs +19 -0
  62. data/crates/itsi_server/src/server/static_file_server.rs +984 -0
  63. data/crates/itsi_server/src/server/thread_worker.rs +139 -94
  64. data/crates/itsi_server/src/server/types.rs +43 -0
  65. data/crates/itsi_server/test.md +14 -0
  66. data/crates/itsi_tracing/Cargo.toml +1 -0
  67. data/crates/itsi_tracing/src/lib.rs +216 -45
  68. data/docs/.gitignore +7 -0
  69. data/docs/.gitpod.yml +15 -0
  70. data/docs/Itsi.rb +17 -0
  71. data/docs/content/_index.md +17 -0
  72. data/docs/content/about.md +6 -0
  73. data/docs/content/docs/_index.md +18 -0
  74. data/docs/content/docs/first-page.md +9 -0
  75. data/docs/content/docs/folder/_index.md +10 -0
  76. data/docs/content/docs/folder/leaf.md +7 -0
  77. data/docs/go.mod +5 -0
  78. data/docs/go.sum +2 -0
  79. data/docs/hugo.yaml +77 -0
  80. data/examples/static_assets_example.rb +83 -0
  81. data/gems/_index.md +18 -0
  82. data/gems/scheduler/CODE_OF_CONDUCT.md +7 -0
  83. data/gems/scheduler/Cargo.lock +75 -14
  84. data/gems/scheduler/README.md +5 -0
  85. data/gems/scheduler/_index.md +7 -0
  86. data/gems/scheduler/itsi-scheduler.gemspec +4 -1
  87. data/gems/scheduler/lib/itsi/scheduler/version.rb +1 -1
  88. data/gems/scheduler/lib/itsi/scheduler.rb +2 -2
  89. data/gems/scheduler/test/test_file_io.rb +0 -1
  90. data/gems/scheduler/test/test_itsi_scheduler.rb +1 -1
  91. data/gems/server/CHANGELOG.md +5 -0
  92. data/gems/server/CODE_OF_CONDUCT.md +7 -0
  93. data/gems/server/Cargo.lock +1536 -45
  94. data/gems/server/README.md +4 -0
  95. data/gems/server/_index.md +6 -0
  96. data/gems/server/exe/itsi +33 -74
  97. data/gems/server/itsi-server.gemspec +3 -2
  98. data/gems/server/lib/itsi/{request.rb → http_request.rb} +29 -5
  99. data/gems/server/lib/itsi/http_response.rb +39 -0
  100. data/gems/server/lib/itsi/server/Itsi.rb +11 -19
  101. data/gems/server/lib/itsi/server/config/dsl.rb +506 -0
  102. data/gems/server/lib/itsi/server/config.rb +103 -8
  103. data/gems/server/lib/itsi/server/default_app/default_app.rb +38 -0
  104. data/gems/server/lib/itsi/server/grpc_interface.rb +213 -0
  105. data/gems/server/lib/itsi/server/rack/handler/itsi.rb +8 -17
  106. data/gems/server/lib/itsi/server/rack_interface.rb +23 -4
  107. data/gems/server/lib/itsi/server/scheduler_interface.rb +1 -1
  108. data/gems/server/lib/itsi/server/scheduler_mode.rb +4 -0
  109. data/gems/server/lib/itsi/server/signal_trap.rb +7 -1
  110. data/gems/server/lib/itsi/server/version.rb +1 -1
  111. data/gems/server/lib/itsi/server.rb +74 -63
  112. data/gems/server/lib/itsi/standard_headers.rb +86 -0
  113. data/gems/server/test/helpers/test_helper.rb +12 -12
  114. data/gems/server/test/test_itsi_server.rb +2 -2
  115. data/lib/itsi/version.rb +1 -1
  116. data/sandbox/itsi_file/Gemfile +11 -0
  117. data/sandbox/itsi_file/Gemfile.lock +69 -0
  118. data/sandbox/itsi_file/Itsi.rb +276 -0
  119. data/sandbox/itsi_file/error.html +2 -0
  120. data/sandbox/itsi_file/organisations_controller.rb +20 -0
  121. data/sandbox/itsi_file/public/assets/image.png +0 -0
  122. data/sandbox/itsi_file/public/assets/index.html +1 -0
  123. data/sandbox/itsi_sandbox_hanami/Gemfile.lock +2 -2
  124. data/sandbox/itsi_sandbox_rack/Gemfile.lock +2 -2
  125. data/sandbox/itsi_sandbox_rack/config.ru +2 -15
  126. data/sandbox/itsi_sandbox_rails/.dockerignore +2 -5
  127. data/sandbox/itsi_sandbox_rails/.github/workflows/ci.yml +1 -1
  128. data/sandbox/itsi_sandbox_rails/.gitignore +2 -1
  129. data/sandbox/itsi_sandbox_rails/Dockerfile +6 -9
  130. data/sandbox/itsi_sandbox_rails/Gemfile +16 -22
  131. data/sandbox/itsi_sandbox_rails/Gemfile.lock +100 -225
  132. data/sandbox/itsi_sandbox_rails/app/assets/config/manifest.js +4 -0
  133. data/sandbox/itsi_sandbox_rails/app/assets/stylesheets/application.css +11 -6
  134. data/sandbox/itsi_sandbox_rails/app/channels/application_cable/channel.rb +4 -0
  135. data/sandbox/itsi_sandbox_rails/app/channels/application_cable/connection.rb +4 -0
  136. data/sandbox/itsi_sandbox_rails/app/controllers/live_controller.rb +7 -8
  137. data/sandbox/itsi_sandbox_rails/app/controllers/uploads_controller.rb +0 -3
  138. data/sandbox/itsi_sandbox_rails/app/views/layouts/application.html.erb +2 -7
  139. data/sandbox/itsi_sandbox_rails/bin/docker-entrypoint +3 -4
  140. data/sandbox/itsi_sandbox_rails/bin/setup +8 -5
  141. data/sandbox/itsi_sandbox_rails/config/application.rb +1 -35
  142. data/sandbox/itsi_sandbox_rails/config/cable.yml +3 -10
  143. data/sandbox/itsi_sandbox_rails/config/credentials.yml.enc +1 -1
  144. data/sandbox/itsi_sandbox_rails/config/database.yml +9 -19
  145. data/sandbox/itsi_sandbox_rails/config/environment.rb +1 -1
  146. data/sandbox/itsi_sandbox_rails/config/environments/development.rb +21 -12
  147. data/sandbox/itsi_sandbox_rails/config/environments/production.rb +49 -34
  148. data/sandbox/itsi_sandbox_rails/config/environments/test.rb +19 -5
  149. data/sandbox/itsi_sandbox_rails/config/initializers/assets.rb +5 -0
  150. data/sandbox/itsi_sandbox_rails/config/initializers/filter_parameter_logging.rb +1 -1
  151. data/sandbox/itsi_sandbox_rails/config/initializers/permissions_policy.rb +13 -0
  152. data/sandbox/itsi_sandbox_rails/config/puma.rb +2 -9
  153. data/sandbox/itsi_sandbox_rails/config.ru +0 -1
  154. data/sandbox/itsi_sandbox_rails/db/migrate/20250301041554_create_posts.rb +1 -1
  155. data/sandbox/itsi_sandbox_rails/db/schema.rb +2 -2
  156. data/sandbox/itsi_sandbox_rails/lib/assets/.keep +0 -0
  157. data/sandbox/itsi_sandbox_rails/public/404.html +66 -113
  158. data/sandbox/itsi_sandbox_rails/public/406-unsupported-browser.html +65 -113
  159. data/sandbox/itsi_sandbox_rails/public/422.html +66 -113
  160. data/sandbox/itsi_sandbox_rails/public/500.html +65 -113
  161. data/sandbox/itsi_sandbox_rails/public/icon.png +0 -0
  162. data/sandbox/itsi_sandbox_rails/public/icon.svg +2 -2
  163. data/sandbox/itsi_sandbox_rails/test/channels/application_cable/connection_test.rb +13 -0
  164. data/sandbox/itsi_sandbox_roda/Gemfile.lock +3 -10
  165. data/tasks.txt +72 -35
  166. metadata +89 -139
  167. data/crates/itsi_server/src/body_proxy/mod.rs +0 -2
  168. data/crates/itsi_server/src/request/itsi_request.rs +0 -298
  169. data/crates/itsi_server/src/request/mod.rs +0 -1
  170. data/crates/itsi_server/src/response/mod.rs +0 -1
  171. data/crates/itsi_server/src/server/itsi_server.rs +0 -288
  172. data/gems/scheduler/ext/itsi_error/Cargo.lock +0 -368
  173. data/gems/scheduler/ext/itsi_error/Cargo.toml +0 -11
  174. data/gems/scheduler/ext/itsi_error/src/from.rs +0 -68
  175. data/gems/scheduler/ext/itsi_error/src/lib.rs +0 -24
  176. data/gems/scheduler/ext/itsi_instrument_entry/Cargo.toml +0 -15
  177. data/gems/scheduler/ext/itsi_instrument_entry/src/lib.rs +0 -31
  178. data/gems/scheduler/ext/itsi_rb_helpers/Cargo.lock +0 -355
  179. data/gems/scheduler/ext/itsi_rb_helpers/Cargo.toml +0 -10
  180. data/gems/scheduler/ext/itsi_rb_helpers/src/heap_value.rs +0 -121
  181. data/gems/scheduler/ext/itsi_rb_helpers/src/lib.rs +0 -201
  182. data/gems/scheduler/ext/itsi_scheduler/Cargo.toml +0 -24
  183. data/gems/scheduler/ext/itsi_scheduler/extconf.rb +0 -6
  184. data/gems/scheduler/ext/itsi_scheduler/src/itsi_scheduler/io_helpers.rs +0 -56
  185. data/gems/scheduler/ext/itsi_scheduler/src/itsi_scheduler/io_waiter.rs +0 -44
  186. data/gems/scheduler/ext/itsi_scheduler/src/itsi_scheduler/timer.rs +0 -44
  187. data/gems/scheduler/ext/itsi_scheduler/src/itsi_scheduler.rs +0 -308
  188. data/gems/scheduler/ext/itsi_scheduler/src/lib.rs +0 -38
  189. data/gems/scheduler/ext/itsi_server/Cargo.lock +0 -2956
  190. data/gems/scheduler/ext/itsi_server/Cargo.toml +0 -50
  191. data/gems/scheduler/ext/itsi_server/extconf.rb +0 -6
  192. data/gems/scheduler/ext/itsi_server/src/body_proxy/big_bytes.rs +0 -104
  193. data/gems/scheduler/ext/itsi_server/src/body_proxy/itsi_body_proxy.rs +0 -122
  194. data/gems/scheduler/ext/itsi_server/src/body_proxy/mod.rs +0 -2
  195. data/gems/scheduler/ext/itsi_server/src/env.rs +0 -43
  196. data/gems/scheduler/ext/itsi_server/src/lib.rs +0 -180
  197. data/gems/scheduler/ext/itsi_server/src/request/itsi_request.rs +0 -298
  198. data/gems/scheduler/ext/itsi_server/src/request/mod.rs +0 -1
  199. data/gems/scheduler/ext/itsi_server/src/response/itsi_response.rs +0 -357
  200. data/gems/scheduler/ext/itsi_server/src/response/mod.rs +0 -1
  201. data/gems/scheduler/ext/itsi_server/src/server/bind.rs +0 -174
  202. data/gems/scheduler/ext/itsi_server/src/server/bind_protocol.rs +0 -37
  203. data/gems/scheduler/ext/itsi_server/src/server/io_stream.rs +0 -104
  204. data/gems/scheduler/ext/itsi_server/src/server/itsi_server.rs +0 -288
  205. data/gems/scheduler/ext/itsi_server/src/server/lifecycle_event.rs +0 -9
  206. data/gems/scheduler/ext/itsi_server/src/server/listener.rs +0 -318
  207. data/gems/scheduler/ext/itsi_server/src/server/mod.rs +0 -11
  208. data/gems/scheduler/ext/itsi_server/src/server/process_worker.rs +0 -203
  209. data/gems/scheduler/ext/itsi_server/src/server/serve_strategy/cluster_mode.rs +0 -260
  210. data/gems/scheduler/ext/itsi_server/src/server/serve_strategy/mod.rs +0 -27
  211. data/gems/scheduler/ext/itsi_server/src/server/serve_strategy/single_mode.rs +0 -276
  212. data/gems/scheduler/ext/itsi_server/src/server/signal.rs +0 -74
  213. data/gems/scheduler/ext/itsi_server/src/server/thread_worker.rs +0 -399
  214. data/gems/scheduler/ext/itsi_server/src/server/tls/locked_dir_cache.rs +0 -132
  215. data/gems/scheduler/ext/itsi_server/src/server/tls.rs +0 -265
  216. data/gems/scheduler/ext/itsi_tracing/Cargo.lock +0 -274
  217. data/gems/scheduler/ext/itsi_tracing/Cargo.toml +0 -16
  218. data/gems/scheduler/ext/itsi_tracing/src/lib.rs +0 -58
  219. data/gems/server/ext/itsi_error/Cargo.lock +0 -368
  220. data/gems/server/ext/itsi_error/Cargo.toml +0 -11
  221. data/gems/server/ext/itsi_error/src/from.rs +0 -68
  222. data/gems/server/ext/itsi_error/src/lib.rs +0 -24
  223. data/gems/server/ext/itsi_instrument_entry/Cargo.toml +0 -15
  224. data/gems/server/ext/itsi_instrument_entry/src/lib.rs +0 -31
  225. data/gems/server/ext/itsi_rb_helpers/Cargo.lock +0 -355
  226. data/gems/server/ext/itsi_rb_helpers/Cargo.toml +0 -10
  227. data/gems/server/ext/itsi_rb_helpers/src/heap_value.rs +0 -121
  228. data/gems/server/ext/itsi_rb_helpers/src/lib.rs +0 -201
  229. data/gems/server/ext/itsi_scheduler/Cargo.toml +0 -24
  230. data/gems/server/ext/itsi_scheduler/extconf.rb +0 -6
  231. data/gems/server/ext/itsi_scheduler/src/itsi_scheduler/io_helpers.rs +0 -56
  232. data/gems/server/ext/itsi_scheduler/src/itsi_scheduler/io_waiter.rs +0 -44
  233. data/gems/server/ext/itsi_scheduler/src/itsi_scheduler/timer.rs +0 -44
  234. data/gems/server/ext/itsi_scheduler/src/itsi_scheduler.rs +0 -308
  235. data/gems/server/ext/itsi_scheduler/src/lib.rs +0 -38
  236. data/gems/server/ext/itsi_server/Cargo.lock +0 -2956
  237. data/gems/server/ext/itsi_server/Cargo.toml +0 -50
  238. data/gems/server/ext/itsi_server/extconf.rb +0 -6
  239. data/gems/server/ext/itsi_server/src/body_proxy/big_bytes.rs +0 -104
  240. data/gems/server/ext/itsi_server/src/body_proxy/itsi_body_proxy.rs +0 -122
  241. data/gems/server/ext/itsi_server/src/body_proxy/mod.rs +0 -2
  242. data/gems/server/ext/itsi_server/src/env.rs +0 -43
  243. data/gems/server/ext/itsi_server/src/lib.rs +0 -180
  244. data/gems/server/ext/itsi_server/src/request/mod.rs +0 -1
  245. data/gems/server/ext/itsi_server/src/response/itsi_response.rs +0 -357
  246. data/gems/server/ext/itsi_server/src/response/mod.rs +0 -1
  247. data/gems/server/ext/itsi_server/src/server/bind.rs +0 -174
  248. data/gems/server/ext/itsi_server/src/server/bind_protocol.rs +0 -37
  249. data/gems/server/ext/itsi_server/src/server/io_stream.rs +0 -104
  250. data/gems/server/ext/itsi_server/src/server/itsi_server.rs +0 -288
  251. data/gems/server/ext/itsi_server/src/server/lifecycle_event.rs +0 -9
  252. data/gems/server/ext/itsi_server/src/server/listener.rs +0 -318
  253. data/gems/server/ext/itsi_server/src/server/mod.rs +0 -11
  254. data/gems/server/ext/itsi_server/src/server/process_worker.rs +0 -203
  255. data/gems/server/ext/itsi_server/src/server/serve_strategy/cluster_mode.rs +0 -260
  256. data/gems/server/ext/itsi_server/src/server/serve_strategy/mod.rs +0 -27
  257. data/gems/server/ext/itsi_server/src/server/serve_strategy/single_mode.rs +0 -276
  258. data/gems/server/ext/itsi_server/src/server/signal.rs +0 -74
  259. data/gems/server/ext/itsi_server/src/server/thread_worker.rs +0 -399
  260. data/gems/server/ext/itsi_server/src/server/tls/locked_dir_cache.rs +0 -132
  261. data/gems/server/ext/itsi_server/src/server/tls.rs +0 -265
  262. data/gems/server/ext/itsi_tracing/Cargo.lock +0 -274
  263. data/gems/server/ext/itsi_tracing/Cargo.toml +0 -16
  264. data/gems/server/ext/itsi_tracing/src/lib.rs +0 -58
  265. data/gems/server/lib/itsi/server/options_dsl.rb +0 -401
  266. data/gems/server/lib/itsi/stream_io.rb +0 -38
  267. data/location_dsl.rb +0 -381
  268. data/sandbox/itsi_sandbox_rails/.kamal/hooks/docker-setup.sample +0 -3
  269. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-app-boot.sample +0 -3
  270. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-deploy.sample +0 -14
  271. data/sandbox/itsi_sandbox_rails/.kamal/hooks/post-proxy-reboot.sample +0 -3
  272. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-app-boot.sample +0 -3
  273. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-build.sample +0 -51
  274. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-connect.sample +0 -47
  275. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-deploy.sample +0 -109
  276. data/sandbox/itsi_sandbox_rails/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  277. data/sandbox/itsi_sandbox_rails/.kamal/secrets +0 -17
  278. data/sandbox/itsi_sandbox_rails/bin/dev +0 -2
  279. data/sandbox/itsi_sandbox_rails/bin/jobs +0 -6
  280. data/sandbox/itsi_sandbox_rails/bin/kamal +0 -27
  281. data/sandbox/itsi_sandbox_rails/bin/thrust +0 -5
  282. data/sandbox/itsi_sandbox_rails/config/cache.yml +0 -16
  283. data/sandbox/itsi_sandbox_rails/config/deploy.yml +0 -116
  284. data/sandbox/itsi_sandbox_rails/config/queue.yml +0 -18
  285. data/sandbox/itsi_sandbox_rails/config/recurring.yml +0 -10
  286. data/sandbox/itsi_sandbox_rails/db/cable_schema.rb +0 -11
  287. data/sandbox/itsi_sandbox_rails/db/cache_schema.rb +0 -14
  288. data/sandbox/itsi_sandbox_rails/db/queue_schema.rb +0 -129
  289. data/sandbox/itsi_sandbox_rails/public/400.html +0 -114
  290. data/sandbox/itsi_sandbox_rails/test/fixtures/posts.yml +0 -9
  291. data/sandbox/itsi_sandbox_rails/test/models/post_test.rb +0 -7
  292. /data/{sandbox/itsi_sandbox_rails/script/.keep → crates/_index.md} +0 -0
  293. /data/gems/server/lib/itsi/{index.html → server/default_app/index.html} +0 -0
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: ../../gems/scheduler
3
+ specs:
4
+ itsi-scheduler (0.1.11)
5
+ rb_sys (~> 0.9.91)
6
+
7
+ PATH
8
+ remote: ../../gems/server
9
+ specs:
10
+ itsi-server (0.1.11)
11
+ rack (>= 1.6)
12
+ rb_sys (~> 0.9.91)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ bigdecimal (3.1.9)
18
+ date (3.4.1)
19
+ debug (1.10.0)
20
+ irb (~> 1.10)
21
+ reline (>= 0.3.8)
22
+ google-protobuf (4.30.2)
23
+ bigdecimal
24
+ rake (>= 13)
25
+ google-protobuf (4.30.2-arm64-darwin)
26
+ bigdecimal
27
+ rake (>= 13)
28
+ googleapis-common-protos-types (1.19.0)
29
+ google-protobuf (>= 3.18, < 5.a)
30
+ grpc (1.71.0)
31
+ google-protobuf (>= 3.25, < 5.0)
32
+ googleapis-common-protos-types (~> 1.0)
33
+ grpc (1.71.0-arm64-darwin)
34
+ google-protobuf (>= 3.25, < 5.0)
35
+ googleapis-common-protos-types (~> 1.0)
36
+ io-console (0.8.0)
37
+ irb (1.15.1)
38
+ pp (>= 0.6.0)
39
+ rdoc (>= 4.0.0)
40
+ reline (>= 0.4.2)
41
+ pp (0.6.2)
42
+ prettyprint
43
+ prettyprint (0.2.0)
44
+ psych (5.2.3)
45
+ date
46
+ stringio
47
+ rack (3.1.12)
48
+ rake (13.2.1)
49
+ rake-compiler-dock (1.9.1)
50
+ rb_sys (0.9.111)
51
+ rake-compiler-dock (= 1.9.1)
52
+ rdoc (6.12.0)
53
+ psych (>= 4.0.0)
54
+ reline (0.6.0)
55
+ io-console (~> 0.5)
56
+ stringio (3.1.5)
57
+
58
+ PLATFORMS
59
+ arm64-darwin-23
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ debug
64
+ grpc
65
+ itsi-scheduler!
66
+ itsi-server!
67
+
68
+ BUNDLED WITH
69
+ 2.6.3
@@ -0,0 +1,276 @@
1
+ workers 1
2
+ threads 1
3
+
4
+ preload false
5
+
6
+ bind 'http://localhost:3000'
7
+ bind 'http://0.0.0.0:8000'
8
+
9
+ shutdown_timeout 3
10
+ multithreaded_reactor true
11
+
12
+ watch '*.rb', [%w[bundle exec itsi restart]]
13
+
14
+ def user_serve(request)
15
+ response = request.response
16
+ response.status = 200
17
+ response.add_header('Content-Type', 'text/plain')
18
+ response << 'Hello, user!'
19
+ response.close
20
+ end
21
+
22
+ def user_create(request)
23
+ response = request.response
24
+ response.status = 201
25
+ response.add_header('Content-Type', 'text/plain')
26
+ response << 'User created!'
27
+ response.close
28
+ end
29
+
30
+ location "/etag-test" do
31
+ etag type: 'strong', algorithm: 'sha256', min_body_size: 0
32
+
33
+ get '/' do |req|
34
+ # Fixed content that will generate the same ETag each time
35
+ content = "This is a fixed response that will always have the same ETag."
36
+
37
+ # Add a timestamp as a comment to see the response is fresh
38
+ resp = req.response
39
+ req.respond("Content: #{content}.# Generated at: #{Time.now}")
40
+ end
41
+ end
42
+
43
+
44
+ location "/cached-with-etag" do
45
+ # Set up caching parameters
46
+ cache_control max_age: 3600, public: true, vary: ['Accept-Encoding']
47
+
48
+ # Add ETags for cache validation
49
+ etag type: 'weak', algorithm: 'md5', min_body_size: 0
50
+
51
+ get '/' do |req|
52
+ req.respond("This response will have both cache headers and an ETag.")
53
+ end
54
+ end
55
+
56
+
57
+ location "/" do
58
+ intrusion_protection banned_time_seconds: 5, banned_url_patterns: [/\/admin/, /\/secret/], store_config: { redis: { connection_url: 'redis://localhost:6379/0' } }, error_response: { plaintext: 'no way', code: 403, default: 'plaintext' }
59
+
60
+ # Example for API endpoints with ETags
61
+ location "/api" do
62
+ etag type: 'weak', algorithm: 'md5', min_body_size: 0
63
+ get '/users/id' do |req|
64
+ user_id = 5
65
+ req.respond("User data for #{user_id}")
66
+ end
67
+ end
68
+
69
+ location "/hey" do
70
+ location "/world*" do
71
+ request_headers additions: {"X-Custom-Req" => ["Foo", "Bar", "Baz"]}, removals: [""]
72
+ response_headers additions: {"X-Custom-Resp" => ["Foo", "Bar"]}, removals: []
73
+ rate_limit requests: 5, seconds: 30, key: 'address', store_config: { redis: { connection_url: 'redis://localhost:6379/0' } }, error_response: { plaintext: 'no way', code: 429, default: 'plaintext' }
74
+ post '/' do |req|
75
+ puts "I'm a post!"
76
+ req.respond("Post successful!")
77
+ end
78
+ get '/' do |req|
79
+ puts "Headers are", "#{req["foo"]}"
80
+ req.respond("Is this still fast?")
81
+ end
82
+ end
83
+ end
84
+
85
+ # Add a new location with cache_control middleware
86
+ location "/cached" do
87
+ cache_control max_age: 3600, public: true, vary: ['Accept-Encoding']
88
+ get '/' do |req|
89
+ req.respond("This content is cached for 1 hour.")
90
+ end
91
+ end
92
+
93
+ location "/etag" do
94
+ etag enabled: true, etag_type: 'strong', hash_algorithm: 'sha256', min_body_size: 0
95
+ get '/' do |req|
96
+ # Create a response large enough to be worth ETagging
97
+ content = "This content will have ETags. " * 20
98
+ req.respond(content)
99
+ end
100
+ end
101
+ end
102
+
103
+
104
+
105
+ # For an assets example
106
+ location "/assets" do
107
+ cache_control max_age: 604800, s_max_age: 2592000,
108
+ stale_while_revalidate: 86400,
109
+ public: true, immutable: true
110
+
111
+ get "/:file" do |req|
112
+ file_name = req.params["file"]
113
+ req.respond("Pretending to serve #{file_name} with long-lived caching")
114
+ end
115
+ end
116
+
117
+ # location '' do
118
+
119
+ # location '/spa' do
120
+ # # Serve static files from the "public/assets" directory
121
+ # log_requests before: { format: "REQUEST_ID={request_id} METHOD={method} PATH={path} QUERY={query} HOST={host} PORT={port} START_TIME={start_time}" , level: 'INFO'}, after: { format: "REQUEST_ID={request_id} RESPONSE_TIME={response_time}", level: 'INFO' }
122
+ # allow_list allowed_patterns: [/127.*/], error_response: { plaintext: 'no way', code: 401, default: 'plaintext' }
123
+ # static_assets\
124
+ # relative_path: true,
125
+ # root_dir: 'spa/dist',
126
+ # # # Only allow certain file extensions
127
+ # # allowed_extensions: %w[css js jpg jpeg png gif svg ico woff woff2 ttf
128
+ # # otf html],
129
+ # # Return a 404 error if file is not found
130
+ # not_found_behavior: { index: 'index.html' },
131
+ # # Enable auto-indexing of directories
132
+ # auto_index: true,
133
+ # # Try adding .html extension to extensionless URLs
134
+ # try_html_extension: true,
135
+ # # Files under this size are cached in memory
136
+ # max_file_size_in_memory: 1024 * 1024, # 1MB
137
+ # # Maximum number of files to keep in memory cache
138
+ # max_files_in_memory: 1000,
139
+ # # Check for file modifications every 5 seconds
140
+ # file_check_interval: 5,
141
+ # # Add custom headers to all responses
142
+ # headers: {
143
+ # 'Cache-Control' => 'public, max-age=86400',
144
+ # 'X-Content-Type-Options' => 'nosniff'
145
+ # }
146
+ # compress algorithms: ['zstd'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
147
+ # end
148
+ # end
149
+
150
+ # location "/cors_test" do
151
+ # cors allowed_origins: ["http://127.0.0.1:8000"], allowed_methods: ["GET", "PATCH", "POST"], allowed_headers: ['Content-Type'], exposed_headers: ['X-Custom-Header'], allow_credentials: true
152
+ # get "/user/:id" do |req|
153
+ # req.respond("You've been CORSed!")
154
+ # end
155
+ # end
156
+
157
+ # location "/basic" do
158
+ # auth_basic realm: 'My Realm', credential_pairs: { 'user' => 'password' }
159
+ # end
160
+
161
+ # location "/jwt" do
162
+ # auth_jwt token_source: { header: { name: 'Authorization', prefix: 'Bearer ' } }, verifiers: {'hs256' => ["1V6nZzztO/F6Y3XAYXJ1I37AAXCJ/V7EVHJoVnD8lr4="]
163
+ # }, error_response: { code: 401, plaintext: 'Unauthorized', default: 'plaintext' }
164
+ # get "/" do |req|
165
+ # req.respond('Hello, JWT user!')
166
+ # end
167
+ # end
168
+
169
+ # location '/proxy_as_foo_com' do
170
+ # compress algorithms: ['zstd'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
171
+ # proxy to: 'http://foo.com/zstd', backends: ['http://127.0.0.1:3000'], headers: { 'Host' => { 'value' => 'foo.com' } },
172
+ # verify_ssl: false, timeout: 100, tls_sni: true
173
+ # end
174
+
175
+ # location '/proxy_as_bar_com' do
176
+ # proxy to: 'http://bar.com', backends: ['http://127.0.0.1:3000'], headers: { 'Host' => { 'value' => 'bar.com' } },
177
+ # verify_ssl: false, timeout: 100, tls_sni: true
178
+ # end
179
+
180
+ # location '/', hosts: ['foo.com'] do
181
+ # get '/' do |req|
182
+ # req.respond('I am foo.com')
183
+ # end
184
+ # end
185
+
186
+ # location '/', hosts: ['bar.com'] do
187
+ # get '/' do |req|
188
+ # req.respond('I am bar.com')
189
+ # end
190
+ # end
191
+
192
+ # location '/admin*' do
193
+ # auth_api_key valid_keys: %w[one two], token_source: { header: { name: 'Authorization', prefix: 'Bearer ' } },
194
+ # error_response: { code: 401, plaintext: 'Unauthorized', default: 'plaintext' }
195
+ # run lambda { |env|
196
+ # [200, {}, 'Oh look, it also. Clusters!']
197
+ # }
198
+ # end
199
+
200
+ # location '/br' do
201
+ # compress algorithms: ['brotli'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
202
+ # get '/' do |req|
203
+ # req.respond("Hello world. I'm brotli'd!")
204
+ # end
205
+ # end
206
+
207
+ # location '/zstd' do
208
+ # compress algorithms: ['zstd'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
209
+ # get '/' do |req|
210
+ # req.respond("Hello world. I'm zstd'd!")
211
+ # end
212
+ # end
213
+
214
+ # location 'gzip' do
215
+ # compress algorithms: ['gzip'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
216
+ # get '/' do |req|
217
+ # req.respond("Hello world. I'm gzip'd!")
218
+ # end
219
+ # end
220
+
221
+ # location 'deflate' do
222
+ # compress algorithms: ['deflate'], min_size: 0, compress_streams: true, mime_types: ['all'], level: 'fastest'
223
+ # get '/' do |req|
224
+ # req.respond("Hello world. I'm deflated!")
225
+ # end
226
+ # end
227
+
228
+ # get '/hey' do |req|
229
+ # req.respond("This is a test")
230
+ # end
231
+
232
+
233
+ # location '*', protocols: :http do
234
+ # location 'foo' do
235
+ # redirect to: 'https://{host}:3001{path}'
236
+ # end
237
+ # end
238
+
239
+ # location '*', hosts: ['127.0.0.1'], ports: [3001] do
240
+ # proxy to: ['https://docs.rs{path}{query}'],
241
+ # headers: { 'Host' => { value: 'docs.rs' }, 'Origin' => { value: 'https://docs.rs' } }, verify_ssl: false, timeout: 5
242
+ # end
243
+
244
+ # location '*', hosts: ['127.0.0.1'], ports: [3002] do
245
+ # proxy to: ['https://httpbin.org{path}{query}'],
246
+ # headers: { 'Host' => { value: 'docs.rs' }, 'Origin' => { value: 'https://docs.rs' } }, verify_ssl: false, timeout: 5
247
+ # end
248
+
249
+ # location '/app' do
250
+ # location '/users' do
251
+ # get '/:id', :user_serve
252
+ # post '/:id', :user_create
253
+ # end
254
+
255
+ # include 'organisations_controller'
256
+
257
+ # location '/admin*' do
258
+ # auth_api_key valid_keys: %w[one two], token_source: { header: { name: 'Authorization', prefix: 'Bearer ' } },
259
+ # error_response: { code: 401, plaintext: 'Unauthorized', default: 'plaintext' }
260
+ # end
261
+ # end
262
+ # foo
263
+ # foo
264
+
265
+ # Example of using ETag middleware
266
+ # location "/with-etag" do
267
+ # etag
268
+ # get '/' do |req|
269
+ # req.respond("This response will have an ETag header based on content hash.")
270
+ # end
271
+ # end
272
+
273
+ # Example with both caching and ETags
274
+
275
+
276
+ # Simple ETag test endpoint with predictable content
@@ -0,0 +1,2 @@
1
+ <h1>I've updated the content</h1>
2
+ <p>Here's some content</p>
@@ -0,0 +1,20 @@
1
+ class OrganisationsController
2
+ def organisation_serve(request)
3
+ response = request.response
4
+ response.status = 200
5
+ response.add_header('Content-Type', 'text/plain')
6
+ response << 'Serve Organisation!'
7
+ response.close
8
+ end
9
+
10
+ def organisation_create(request)
11
+ puts 'Create organisation'
12
+ request.close
13
+ end
14
+ end
15
+
16
+ location '/organisations' do
17
+ controller OrganisationsController.new
18
+ get '/:id', :organisation_serve
19
+ post '/:id', :organisation_create
20
+ end
@@ -0,0 +1 @@
1
+ <h1>Hello World!</h1>
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: ../../gems/scheduler
3
3
  specs:
4
- itsi-scheduler (0.1.7)
4
+ itsi-scheduler (0.1.11)
5
5
  rb_sys (~> 0.9.91)
6
6
 
7
7
  PATH
8
8
  remote: ../../gems/server
9
9
  specs:
10
- itsi-server (0.1.7)
10
+ itsi-server (0.1.11)
11
11
  rack (>= 1.6)
12
12
  rb_sys (~> 0.9.91)
13
13
 
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: ../../gems/scheduler
3
3
  specs:
4
- itsi-scheduler (0.1.10)
4
+ itsi-scheduler (0.1.11)
5
5
  rb_sys (~> 0.9.91)
6
6
 
7
7
  PATH
8
8
  remote: ../../gems/server
9
9
  specs:
10
- itsi-server (0.1.10)
10
+ itsi-server (0.1.11)
11
11
  rack (>= 1.6)
12
12
  rb_sys (~> 0.9.91)
13
13
 
@@ -1,18 +1,5 @@
1
1
  require 'itsi/scheduler'
2
- require 'async'
3
- require 'debug'
4
- def looper
5
- i = 0
6
- loop do
7
- i += 1
8
- yield "#{i}\n"
9
- end
10
- end
11
-
12
- require 'itsi/server'
13
-
14
- memory_leak = []
15
-
2
+ response = [200, { 'Content-Type' => 'text/plain' }, ['foo']].freeze
16
3
  run lambda { |env|
17
- [200, { 'Content-Type' => 'text/plain' }, ['foo']]
4
+ response
18
5
  }
@@ -7,8 +7,9 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
- # Ignore all environment files.
10
+ # Ignore all environment files (except templates).
11
11
  /.env*
12
+ !/.env*.erb
12
13
 
13
14
  # Ignore all default key files.
14
15
  /config/master.key
@@ -39,10 +40,6 @@
39
40
  # Ignore CI service files.
40
41
  /.github
41
42
 
42
- # Ignore Kamal files.
43
- /config/deploy*.yml
44
- /.kamal
45
-
46
43
  # Ignore development files
47
44
  /.devcontainer
48
45
 
@@ -64,7 +64,7 @@ jobs:
64
64
  # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
65
65
  steps:
66
66
  - name: Install packages
67
- run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git pkg-config google-chrome-stable
67
+ run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips sqlite3
68
68
 
69
69
  - name: Checkout code
70
70
  uses: actions/checkout@v4
@@ -7,8 +7,9 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
- # Ignore all environment files.
10
+ # Ignore all environment files (except templates).
11
11
  /.env*
12
+ !/.env*.erb
12
13
 
13
14
  # Ignore all logfiles and tempfiles.
14
15
  /log/*
@@ -1,11 +1,8 @@
1
- # syntax=docker/dockerfile:1
2
- # check=error=true
1
+ # syntax = docker/dockerfile:1
3
2
 
4
3
  # This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
5
- # docker build -t itsi_sandbox_rails .
6
- # docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name itsi_sandbox_rails itsi_sandbox_rails
7
-
8
- # For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
4
+ # docker build -t my-app .
5
+ # docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
9
6
 
10
7
  # Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11
8
  ARG RUBY_VERSION=3.4.2
@@ -67,6 +64,6 @@ USER 1000:1000
67
64
  # Entrypoint prepares the database.
68
65
  ENTRYPOINT ["/rails/bin/docker-entrypoint"]
69
66
 
70
- # Start server via Thruster by default, this can be overwritten at runtime
71
- EXPOSE 80
72
- CMD ["./bin/thrust", "./bin/rails", "server"]
67
+ # Start the server by default, this can be overwritten at runtime
68
+ EXPOSE 3000
69
+ CMD ["./bin/rails", "server"]
@@ -1,11 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4
- gem "rails", "~> 8.0.1"
5
- # The modern asset pipeline for Rails [https://github.com/rails/propshaft]
6
- gem "propshaft"
4
+ gem "rails", "~> 7.2.2"
5
+
6
+ gem "pg"
7
+ # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
8
+ gem "sprockets-rails"
7
9
  # Use sqlite3 as the database for Active Record
8
- gem "sqlite3", ">= 2.1"
10
+ gem "sqlite3", ">= 1.4"
9
11
  # Use the Puma web server [https://github.com/puma/puma]
10
12
  gem "puma", ">= 5.0"
11
13
  # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
@@ -16,28 +18,21 @@ gem "turbo-rails"
16
18
  gem "stimulus-rails"
17
19
  # Build JSON APIs with ease [https://github.com/rails/jbuilder]
18
20
  gem "jbuilder"
19
- gem "iodine"
20
- gem "pg"
21
+ # Use Redis adapter to run Action Cable in production
22
+ # gem "redis", ">= 4.0.1"
23
+
24
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
25
+ # gem "kredis"
26
+
21
27
  # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
22
28
  # gem "bcrypt", "~> 3.1.7"
23
29
 
24
30
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
25
31
  gem "tzinfo-data", platforms: %i[ windows jruby ]
26
32
 
27
- # Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
28
- gem "solid_cache"
29
- gem "solid_queue"
30
- gem "solid_cable"
31
-
32
33
  # Reduces boot times through caching; required in config/boot.rb
33
34
  gem "bootsnap", require: false
34
35
 
35
- # Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
36
- gem "kamal", require: false
37
-
38
- # Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
39
- gem "thruster", require: false
40
-
41
36
  # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
42
37
  # gem "image_processing", "~> 1.2"
43
38
 
@@ -63,10 +58,9 @@ group :test do
63
58
  gem "selenium-webdriver"
64
59
  end
65
60
 
66
-
67
- # gem "itsi", path: "../.."
68
61
  gem "itsi-scheduler", path: "../../gems/scheduler"
69
62
  gem "itsi-server", path: "../../gems/server"
70
- gem "async"
71
- gem "osprey_scheduler", path: "../../../osprey_scheduler"
72
- gem "falcon"
63
+ # gem "unicorn"
64
+ # gem "iodine"
65
+ # gem "falcon"
66
+ # gem "puma"