Skip to content

Debian Installation (Pre Jessie)

silverwind edited this page Mar 18, 2017 · 5 revisions

This is an example configuration on a Debian system. It runs 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 a user

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 init script

$EDITOR /etc/init.d/droppy
#!/bin/sh

### BEGIN INIT INFO
# Provides:          droppy
# Required-Start:    $network $remote_fs $local_fs
# Required-Stop:     $network $remote_fs $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: droppy
# Description:       droppy
### END INIT INFO

PROCESS="droppy"
RUNAS="droppy:droppy"
CMD="/usr/bin/env droppy start -c /srv/droppy/config -f /srv/droppy/files"

do_start() {
    start-stop-daemon --start --background -c $RUNAS --name $PROCESS --exec $CMD 
}

do_stop() {
    start-stop-daemon --stop --name $PROCESS
}

case "$1" in
  start)
    do_start
  ;;
  stop)
    do_stop
  ;;
  restart)
    do_stop
    do_start
  ;;
  *)
    echo "Usage: "$1" {start|stop|restart}"
    exit 1
  ;;
esac

exit 0

Enable the script

chmod 755 /etc/init.d/droppy
update-rc.d droppy defaults

Allow node to listen on ports < 1024 (optional)

apt-get install libcap2-bin
setcap 'cap_net_bind_service=+ep' $(which node)

Edit the config and start the server

su droppy -c 'droppy config'
service droppy start
You can’t perform that action at this time.