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.
@@ -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
+