Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Systemd Installation

VirtuBox edited this page Mar 10, 2019 · 48 revisions

This is an example on how to configure a systemd service to run droppy through its own user and on system startup. All commands shall be run as root. /srv/droppy will be used to store data and configuration in this example.

Install droppy

npm install -g droppy

Add user and group

groupadd -r droppy
useradd -r -s /bin/false -d /srv/droppy -g droppy droppy
mkdir -p /srv/droppy/config /srv/droppy/files
chown -R droppy:droppy /srv/droppy
chmod 755 /srv/droppy

Create the service file

$EDITOR /lib/systemd/system/droppy.service
[Unit]
Description=droppy
After=network.target

[Service]
ExecStart=/usr/bin/droppy start -c /srv/droppy/config -f /srv/droppy/files
WorkingDirectory=/srv/droppy
Environment="NODE_ENV=production"
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=always
User=droppy
Group=droppy
SyslogIdentifier=droppy
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Note that /usr/bin/droppy might differ, depending on how npm is set up. When in doubt, run which droppy and use that path.

Edit the config, enable the service and start the server

su droppy -c 'droppy --home /srv/droppy config'
systemctl enable droppy
systemctl start droppy