Module: Kotoshu::Server
- Defined in:
- lib/kotoshu/server.rb,
lib/kotoshu/server/app.rb,
lib/kotoshu/server/version.rb
Defined Under Namespace
Classes: App, ModelConfigError
Constant Summary collapse
- VERSION =
"1.0.1"
Class Method Summary collapse
-
.run!(port: ENV.fetch("KOTOSHU_SERVER_PORT", 9292), bind: ENV.fetch("KOTOSHU_SERVER_BIND", "0.0.0.0")) ⇒ Object
Boot the server.
Class Method Details
.run!(port: ENV.fetch("KOTOSHU_SERVER_PORT", 9292), bind: ENV.fetch("KOTOSHU_SERVER_BIND", "0.0.0.0")) ⇒ Object
Boot the server.
Pre-warm starts in a detached thread and never blocks: Puma binds and serves within seconds regardless of how long resource setup (cold-cache downloads) takes. KOTOSHU_SERVER_LAZY=1 skips the pre-warm entirely; /v1/health reports readiness while it runs.
Semantic-model env vars (KOTOSHU_SERVER_MODEL_LANGS / _TIER) are validated before the bind, so an unsatisfiable model config fails fast with a clear error instead of surprising per-request failures. Unset, boot is exactly as before.
19 20 21 22 23 24 25 |
# File 'lib/kotoshu/server.rb', line 19 def self.run!(port: ENV.fetch("KOTOSHU_SERVER_PORT", 9292), bind: ENV.fetch("KOTOSHU_SERVER_BIND", "0.0.0.0")) App.validate_model_config! unless ENV.fetch("KOTOSHU_SERVER_LAZY", "0") == "1" App.prewarm_async!(App.configured_languages) end App.run!(port: port.to_i, bind: bind) end |