/ opencodehub / deploy / opencodehub.service
swadhinbiswas feat: implement air-gapped mode, UI fixes, and project management integrations · 7/9/2026
e3bd4a1
57 lines · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
[Unit]
Description=OpenCodeHub Self-Hosted Git Platform
Documentation=https://github.com/swadhinbiswas/OpencodeHub
After=network.target postgresql.service redis.service
Wants=postgresql.service redis.service

[Service]
Type=simple
User=opencodehub
Group=opencodehub
WorkingDirectory=/opt/opencodehub

# Environment
EnvironmentFile=/opt/opencodehub/.env
Environment=NODE_ENV=production
Environment=HOST=0.0.0.0
Environment=PORT=4321

# Start the app
ExecStart=/usr/bin/node /opt/opencodehub/dist/server/entry.mjs
ExecReload=/bin/kill -HUP $MAINPID

# Graceful shutdown
TimeoutStopSec=30
KillMode=mixed
KillSignal=SIGTERM
Restart=on-failure
RestartSec=5

# Security hardening
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
ReadWritePaths=/opt/opencodehub/data
PrivateTmp=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictSUIDSGID=yes
RestrictNamespaces=yes
MemoryDenyWriteExecute=yes
LockPersonality=yes

# Resource limits
LimitNOFILE=65535
LimitNPROC=4096
MemoryMax=2G
CPUQuota=200%

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=opencodehub

[Install]
WantedBy=multi-user.target