Skip to content

Installation Guide: systemd

Mark Hughes edited this page Apr 25, 2021 · 1 revision

Wiki Home / Installation Guides / systemd


This guide is for how you can setup droppy with systemd. In a lot of newer linux distributions, systemd is used for services. Once setup, you (or anyone with sudo on your server) can be manage droppy through the systemctl command.

Configuration

By default the init.d script tries to use the safest defaults:

  • Config directory (DROPPY_CONFIG_DIR): /srv/droppy/config
  • Files directory (DROPPY_FILES_DIR): /srv/droppy/files
  • Runs as (RUNAS): droppy:droppy

You can modify these as you need, if you don't be aware that this script assumes that you have created the user droppy and those directories, and that the user droppy has access to those directories.

sudo groupadd droppy

If the group needs a specific group id (to match from say, a mounted drive) you can do so like this:

sudo groupadd -g 1234 droppy # replace 1234 with the GID you require

You also require the user droppy:

sudo useradd -r -g droppy -b /srv/droppy droppy 

You can specify a user id as well if you require:

sudo useradd -r -g droppy -b /srv/droppy -uid 1234 droppy  # replace 1234 with the UID you require

Lastly, we required the droppy directory to exist:

sudo mkdir -p /srv/droppy/config
sudo mkdir -p /srv/droppy/files
sudo chown -R droppy:droppy /srv/droppy

Installation

You can grab our service script from the droppy repo under examples: https://github.com/droppyjs/droppy/blob/canary/examples/droppy.service

You can download and put this into your /lib/systemd/system/ directory using curl or wget:

# using curl:
sudo curl -o /lib/systemd/system/droppy.service https://raw.githubusercontent.com/droppyjs/droppy/canary/examples/droppy.init.d

# using wget:
sudo wget -O /lib/systemd/system/droppy.service https://raw.githubusercontent.com/droppyjs/droppy/canary/examples/droppy.init.d

You will then want to give it the correct permissions:

sudo chmod 755 /lib/systemd/system/droppy.service

Then you can use systemctl to enable the service for startup.

sudo systemctl enable droppy

Usage

You can use the following commands:

  • start droppy: sudo systemctl start droppy
  • stop droppy: sudo systemctl stop droppy
  • restart droppy: sudo systemctl restart droppy