systemd service
Run the panel binary as a native service that restarts on boot and on failure.
Overview
In systemd mode the panel runs as the plain nasnet-panel binary managed by a
unit file, with no Docker involved. The guided installer writes this unit for
you when you pick systemd deployment; this page shows what it produces so you
can review it, reproduce it by hand, or debug a running install.
Before you start
- A systemd-based Linux distribution (
systemctlmust exist). - The
nasnet-panelbinary in place and a.envfile next to it. - A reachable database, either PostgreSQL on the host or
DB_DRIVER=sqlite.
Steps
-
Install the binary at
/usr/local/nasnet-panel/bin/nasnet-paneland put your.envat/usr/local/nasnet-panel/.env. -
Write the unit at
/etc/systemd/system/nasnet-panel.service:[Unit] Description=nasnet-panel Backend API Documentation=https://github.com/nasnet-community/nasnet-panel-linux After=network-online.target Wants=network-online.target [Service] Type=simple WorkingDirectory=/usr/local/nasnet-panel EnvironmentFile=/usr/local/nasnet-panel/.env ExecStart=/usr/local/nasnet-panel/bin/nasnet-panel serve Restart=always RestartSec=5 LimitNOFILE=65536 StandardOutput=journal StandardError=journal SyslogIdentifier=nasnet-panel [Install] WantedBy=multi-user.targetWhen PostgreSQL runs on the same host, the installer additionally adds the database unit to
After=and to aRequires=line, and setsEnvironment=DB_HOST=localhost. -
Reload systemd, then enable and start the service.
sudo systemctl daemon-reload sudo systemctl enable nasnet-panel --now -
Confirm it is running and read the logs.
systemctl is-active nasnet-panel journalctl -u nasnet-panel -n 50 -f
Reference
| Path | What it is |
|---|---|
/usr/local/nasnet-panel |
Install directory and working directory |
/usr/local/nasnet-panel/bin/nasnet-panel |
The panel binary |
/usr/local/nasnet-panel/.env |
Environment file loaded by the unit |
/etc/systemd/system/nasnet-panel.service |
The unit file |
/usr/local/nasnet-pgsql |
Install directory for the bundled PostgreSQL, when used |
nasnet-postgresql.service |
The bundled PostgreSQL unit, when used |
Troubleshooting
The service starts and immediately dies. Restart=always will keep retrying
every five seconds, so watch journalctl -u nasnet-panel -n 50 for the real
error. A short JWT_SECRET_KEY (under 32 characters) and an unreachable
database are the two most common causes.