-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelrelay-worker@.service
More file actions
49 lines (40 loc) · 1.38 KB
/
modelrelay-worker@.service
File metadata and controls
49 lines (40 loc) · 1.38 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
# ModelRelay — modelrelay-worker systemd template unit
#
# This is an instantiated (template) unit. The instance name (%i) is used as
# the worker name, so you can run multiple workers on the same host:
#
# sudo systemctl enable --now modelrelay-worker@gpu0
# sudo systemctl enable --now modelrelay-worker@gpu1
#
# Each instance loads its own env file at /etc/modelrelay/worker-%i.env
# (e.g. worker-gpu0.env, worker-gpu1.env), falling back to the shared
# worker.env if the per-instance file doesn't exist.
#
# Install:
# sudo cp modelrelay-worker@.service /etc/systemd/system/
# sudo cp worker.env.example /etc/modelrelay/worker-gpu0.env # edit values
# sudo systemctl daemon-reload
# sudo systemctl enable --now modelrelay-worker@gpu0
[Unit]
Description=ModelRelay worker daemon (%i)
Documentation=https://github.com/ericflo/modelrelay
After=network.target
[Service]
Type=simple
User=modelrelay
Group=modelrelay
WorkingDirectory=/var/lib/modelrelay
# Per-instance env file takes precedence; shared file is the fallback.
EnvironmentFile=-/etc/modelrelay/worker.env
EnvironmentFile=-/etc/modelrelay/worker-%i.env
# The %i instance name (e.g. "gpu0") becomes the worker name.
ExecStart=/usr/local/bin/modelrelay-worker --worker-name %i
Restart=on-failure
RestartSec=5
# Hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target