portok 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/.dockerignore +10 -0
- package/Dockerfile +41 -0
- package/README.md +606 -0
- package/bench/baseline.bench.mjs +73 -0
- package/bench/connections.bench.mjs +70 -0
- package/bench/keepalive.bench.mjs +248 -0
- package/bench/latency.bench.mjs +47 -0
- package/bench/run.mjs +211 -0
- package/bench/switching.bench.mjs +96 -0
- package/bench/throughput.bench.mjs +44 -0
- package/bench/validate.mjs +260 -0
- package/docker-compose.yml +62 -0
- package/examples/api.env +30 -0
- package/examples/web.env +27 -0
- package/package.json +39 -0
- package/portok.mjs +793 -0
- package/portok@.service +62 -0
- package/portokd.mjs +793 -0
- package/test/cli.test.mjs +220 -0
- package/test/drain.test.mjs +249 -0
- package/test/helpers/mock-server.mjs +305 -0
- package/test/metrics.test.mjs +328 -0
- package/test/proxy.test.mjs +223 -0
- package/test/rollback.test.mjs +344 -0
- package/test/security.test.mjs +256 -0
- package/test/switching.test.mjs +261 -0
package/portok@.service
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Portok systemd template unit for multi-instance deployments
|
|
2
|
+
# Place this file at /etc/systemd/system/portok@.service
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# systemctl start portok@api # Start instance "api"
|
|
6
|
+
# systemctl enable portok@web # Enable instance "web" at boot
|
|
7
|
+
# systemctl status portok@api # Check status
|
|
8
|
+
# journalctl -u portok@api -f # View logs
|
|
9
|
+
#
|
|
10
|
+
# Each instance reads its config from /etc/portok/%i.env
|
|
11
|
+
|
|
12
|
+
[Unit]
|
|
13
|
+
Description=Portok Zero-Downtime Proxy (%i)
|
|
14
|
+
After=network.target
|
|
15
|
+
Documentation=https://github.com/your-org/portok
|
|
16
|
+
|
|
17
|
+
[Service]
|
|
18
|
+
Type=simple
|
|
19
|
+
User=www-data
|
|
20
|
+
Group=www-data
|
|
21
|
+
|
|
22
|
+
# Instance configuration from env file
|
|
23
|
+
EnvironmentFile=/etc/portok/%i.env
|
|
24
|
+
|
|
25
|
+
# Set instance name automatically from systemd specifier
|
|
26
|
+
Environment=INSTANCE_NAME=%i
|
|
27
|
+
|
|
28
|
+
# Working directory (for relative paths if needed)
|
|
29
|
+
WorkingDirectory=/opt/portok
|
|
30
|
+
|
|
31
|
+
# Start the daemon
|
|
32
|
+
ExecStart=/usr/bin/node /opt/portok/portokd.mjs
|
|
33
|
+
|
|
34
|
+
# Restart policy
|
|
35
|
+
Restart=always
|
|
36
|
+
RestartSec=5
|
|
37
|
+
StartLimitBurst=5
|
|
38
|
+
StartLimitIntervalSec=60
|
|
39
|
+
|
|
40
|
+
# Logging
|
|
41
|
+
StandardOutput=journal
|
|
42
|
+
StandardError=journal
|
|
43
|
+
SyslogIdentifier=portok-%i
|
|
44
|
+
|
|
45
|
+
# Security hardening
|
|
46
|
+
NoNewPrivileges=true
|
|
47
|
+
ProtectSystem=strict
|
|
48
|
+
ProtectHome=true
|
|
49
|
+
PrivateTmp=true
|
|
50
|
+
ProtectKernelTunables=true
|
|
51
|
+
ProtectKernelModules=true
|
|
52
|
+
ProtectControlGroups=true
|
|
53
|
+
|
|
54
|
+
# Allow writing to state directory
|
|
55
|
+
ReadWritePaths=/var/lib/portok
|
|
56
|
+
|
|
57
|
+
# Network access (required for proxying)
|
|
58
|
+
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
59
|
+
|
|
60
|
+
[Install]
|
|
61
|
+
WantedBy=multi-user.target
|
|
62
|
+
|