aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/systemd/meshbay-hub.service
blob: 1a3ca44ca32871b1a40c5a8540f5131568c100eb (plain) (blame)
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
[Unit]
Description=MeshBay Hub — identity authority and group registry
Documentation=https://meshbay.org/docs
After=network-online.target postgresql.service
Wants=network-online.target
Requires=postgresql.service

[Service]
Type=simple
User=meshbay
Group=meshbay
WorkingDirectory=/var/lib/meshbay/hub

# Environment — override in /etc/meshbay/hub.env
EnvironmentFile=-/etc/meshbay/hub.env
Environment=MESHBAY_DATABASE_URL=postgresql+asyncpg://meshbay:CHANGEME@localhost/meshbay_hub
Environment=MESHBAY_HUB_KEY=/etc/meshbay/hub_private.pem

# The hub's own command, not `alembic -c <a path>`. That path was
# /opt/meshbay-hub/migrations/alembic.ini, where `%(here)s/src/meshbay_hub/db/…`
# resolves to a directory the package does not install — the migrations ship
# inside meshbay_hub itself, in the shared venv. So this line could never
# succeed, and a hub installed from the RPM or the DEB would not start at all.
# `migrate` asks the installed package where its own migrations are, which is
# correct for the package, a venv, and a checkout alike.
ExecStartPre=/opt/meshbay-common/venv/bin/meshbay-hub migrate --config /etc/meshbay/hub.toml
ExecStart=/opt/meshbay-common/venv/bin/meshbay-hub --config /etc/meshbay/hub.toml
Restart=always
RestartSec=5
TimeoutStopSec=30

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/meshbay/hub /var/log/meshbay
CapabilityBoundingSet=
AmbientCapabilities=

[Install]
WantedBy=multi-user.target