@rip-lang/server 0.8.2 → 1.0.0
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.
- package/README.md +23 -19
- package/package.json +5 -1
- package/server.rip +3 -8
package/README.md
CHANGED
|
@@ -2,28 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
# Rip Server - @rip-lang/server
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **A production-grade application server with multi-worker processes, hot reload, HTTPS, and mDNS — written entirely in Rip**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Rip Server is a self-contained application server that turns any
|
|
8
|
+
[@rip-lang/api](https://github.com/shreeve/rip-lang/tree/main/packages/api)
|
|
9
|
+
app into a production-ready service. It handles multi-worker process management,
|
|
10
|
+
rolling restarts, automatic TLS certificates, mDNS service discovery, and
|
|
11
|
+
request load balancing — all in a single 1,200-line file with zero external
|
|
12
|
+
dependencies.
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
## Features
|
|
10
15
|
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
**
|
|
14
|
-
|
|
15
|
-
### Key Features
|
|
16
|
-
|
|
17
|
-
- **Multi-Worker Architecture** — Automatic worker spawning based on CPU cores
|
|
18
|
-
- **Hot Module Reloading** — File-watch based reloading in development
|
|
19
|
-
- **Directory Watching** — Watch all `.rip` files with `-w` flag for instant reload
|
|
20
|
-
- **Rolling Restarts** — Zero-downtime deployments
|
|
16
|
+
- **Multi-worker architecture** — Automatic worker spawning based on CPU cores
|
|
17
|
+
- **Hot module reloading** — File-watch based reloading with `-w` flag
|
|
18
|
+
- **Rolling restarts** — Zero-downtime deployments
|
|
21
19
|
- **Automatic HTTPS** — TLS with mkcert or self-signed certificates
|
|
22
|
-
- **mDNS
|
|
23
|
-
- **Request
|
|
24
|
-
- **
|
|
20
|
+
- **mDNS discovery** — `.local` hostname advertisement
|
|
21
|
+
- **Request queue** — Built-in request buffering and load balancing
|
|
22
|
+
- **Built-in dashboard** — Server status UI at `rip.local`
|
|
23
|
+
- **Powered by @rip-lang/api** — Runs any Rip API app
|
|
24
|
+
|
|
25
|
+
| File | Lines | Role |
|
|
26
|
+
|------|-------|------|
|
|
27
|
+
| `server.rip` | ~1,210 | Complete server: CLI, workers, load balancing, TLS, mDNS |
|
|
28
|
+
| `server.html` | ~420 | Built-in dashboard UI |
|
|
25
29
|
|
|
26
|
-
> **See Also**: For the API framework, see [@rip-lang/api](../api/README.md).
|
|
30
|
+
> **See Also**: For the API framework, see [@rip-lang/api](../api/README.md). For the DuckDB server, see [@rip-lang/db](../db/README.md).
|
|
27
31
|
|
|
28
32
|
## Quick Start
|
|
29
33
|
|
|
@@ -424,8 +428,8 @@ Most settings are configured via CLI flags, but environment variables provide an
|
|
|
424
428
|
| `RIP_MAX_REQUESTS` | `r:N,...` | `10000` | Max requests before worker recycle |
|
|
425
429
|
| `RIP_MAX_SECONDS` | `r:...,Ns` | `3600` | Max seconds before worker recycle |
|
|
426
430
|
| `RIP_MAX_QUEUE` | `--max-queue=` | `512` | Request queue limit |
|
|
427
|
-
| `RIP_QUEUE_TIMEOUT_MS` | `--queue-timeout-ms=` | `
|
|
428
|
-
| `RIP_CONNECT_TIMEOUT_MS` | `--connect-timeout-ms=` | `
|
|
431
|
+
| `RIP_QUEUE_TIMEOUT_MS` | `--queue-timeout-ms=` | `30000` | Queue wait timeout (ms) |
|
|
432
|
+
| `RIP_CONNECT_TIMEOUT_MS` | `--connect-timeout-ms=` | `2000` | Reserved for future use |
|
|
429
433
|
| `RIP_READ_TIMEOUT_MS` | `--read-timeout-ms=` | `30000` | Worker read timeout (ms) |
|
|
430
434
|
|
|
431
435
|
## Dashboard
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Pure Rip application server — multi-worker, hot reload, HTTPS, mDNS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server.rip",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
39
39
|
"license": "MIT",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"rip-lang": "^2.9.0",
|
|
42
|
+
"@rip-lang/api": "workspace:*"
|
|
43
|
+
},
|
|
40
44
|
"files": [
|
|
41
45
|
"bin/",
|
|
42
46
|
"server.rip",
|
package/server.rip
CHANGED
|
@@ -340,8 +340,8 @@ parseFlags = (argv) ->
|
|
|
340
340
|
reload
|
|
341
341
|
socketPrefix
|
|
342
342
|
maxQueue: coerceInt(getKV('--max-queue='), coerceInt(process.env.RIP_MAX_QUEUE, 512))
|
|
343
|
-
queueTimeoutMs: coerceInt(getKV('--queue-timeout-ms='), coerceInt(process.env.RIP_QUEUE_TIMEOUT_MS,
|
|
344
|
-
connectTimeoutMs: coerceInt(getKV('--connect-timeout-ms='), coerceInt(process.env.RIP_CONNECT_TIMEOUT_MS,
|
|
343
|
+
queueTimeoutMs: coerceInt(getKV('--queue-timeout-ms='), coerceInt(process.env.RIP_QUEUE_TIMEOUT_MS, 30000))
|
|
344
|
+
connectTimeoutMs: coerceInt(getKV('--connect-timeout-ms='), coerceInt(process.env.RIP_CONNECT_TIMEOUT_MS, 2000))
|
|
345
345
|
readTimeoutMs: coerceInt(getKV('--read-timeout-ms='), coerceInt(process.env.RIP_READ_TIMEOUT_MS, 30000))
|
|
346
346
|
jsonLogging: has('--json-logging')
|
|
347
347
|
accessLog: not has('--no-access-log')
|
|
@@ -876,20 +876,15 @@ class Server
|
|
|
876
876
|
forwardOnce: (req, socketPath) ->
|
|
877
877
|
inUrl = new URL(req.url)
|
|
878
878
|
forwardUrl = "http://localhost#{inUrl.pathname}#{inUrl.search}"
|
|
879
|
-
controller = new AbortController()
|
|
880
|
-
connectTimer = setTimeout (-> controller.abort()), @flags.connectTimeoutMs
|
|
881
879
|
readTimeoutMs = @flags.readTimeoutMs
|
|
882
880
|
|
|
883
881
|
try
|
|
884
|
-
|
|
885
|
-
fetchPromise = fetch(forwardUrl, { method: req.method, headers: req.headers, body: req.body, unix: socketPath, signal: controller.signal })
|
|
882
|
+
fetchPromise = fetch(forwardUrl, { method: req.method, headers: req.headers, body: req.body, unix: socketPath })
|
|
886
883
|
readGuard = new Promise (_, rej) ->
|
|
887
884
|
setTimeout (-> rej(new Error('Upstream timeout'))), readTimeoutMs
|
|
888
885
|
res = Promise.race!([fetchPromise, readGuard])
|
|
889
|
-
clearTimeout(connectTimer)
|
|
890
886
|
res
|
|
891
887
|
catch err
|
|
892
|
-
clearTimeout(connectTimer)
|
|
893
888
|
if err.message is 'Upstream timeout'
|
|
894
889
|
return new Response('Gateway timeout', { status: 504 })
|
|
895
890
|
throw err
|