From 5dafbb54dea0498fe7160fe51838005c62a6d76b Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Thu, 5 Mar 2020 23:26:47 +0100 Subject: [PATCH] macOS: add basic instructions to run SFTPGo as service --- docs/service.md | 30 ++++++++++++++++++++++++++++ init/com.github.drakkan.sftpgo.plist | 10 ++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/docs/service.md b/docs/service.md index cf82b682..cc15d82f 100644 --- a/docs/service.md +++ b/docs/service.md @@ -8,6 +8,36 @@ For Linux, a `systemd` sample [service](../init/sftpgo.service "systemd service" For macOS, a `launchd` sample [service](../init/com.github.drakkan.sftpgo.plist "launchd plist") can be found inside the source tree. The `launchd` plist assumes that SFTPGo has `/usr/local/opt/sftpgo` as base directory. +Here are some basic instructions to run SFTPGo as service, please run the following commands from the directory where you downloaded SFTPGo: + +```bash +# create the required directories +sudo mkdir -p /usr/local/opt/sftpgo/init \ + /usr/local/opt/sftpgo/var/lib \ + /usr/local/opt/sftpgo/var/log \ + /usr/local/opt/sftpgo/etc \ + /usr/local/opt/sftpgo/bin + +# install sftpgo executable +sudo cp sftpgo /usr/local/opt/sftpgo/bin/ +# install the launchd service +sudo cp init/com.github.drakkan.sftpgo.plist /usr/local/opt/sftpgo/init +# install the default configuration file, edit it if required +sudo cp sftpgo.json /usr/local/opt/sftpgo/etc/ +# install static file and templates for the web UI +sudo cp -r static templates /usr/local/opt/sftpgo/var/lib/ +# initialize the configured data provider +sudo /usr/local/opt/sftpgo/bin/sftpgo initprovider -c /usr/local/opt/sftpgo/etc +# add sftpgo to the launch daemons +sudo ln -s /usr/local/opt/sftpgo/init/com.github.drakkan.sftpgo.plist /Library/LaunchDaemons/com.github.drakkan.sftpgo.plist +# start the service +sudo launchctl load -w /Library/LaunchDaemons/com.github.drakkan.sftpgo.plist +# verify that the service is started +sudo launchctl list com.github.drakkan.sftpgo +# optional, install the REST API CLI. It requires python-requests to run, this python module is not installed by default +sudo cp scripts/sftpgo_api_cli.py /usr/local/opt/sftpgo/bin/ +``` + ## Windows On Windows, you can register SFTPGo as Windows Service. Take a look at the CLI usage to learn how to do this: diff --git a/init/com.github.drakkan.sftpgo.plist b/init/com.github.drakkan.sftpgo.plist index 372007e4..7f0801c3 100644 --- a/init/com.github.drakkan.sftpgo.plist +++ b/init/com.github.drakkan.sftpgo.plist @@ -9,13 +9,15 @@ SFTPGO_CONFIG_DIR /usr/local/opt/sftpgo/etc SFTPGO_LOG_FILE_PATH - /usr/local/opt/sftpgo/log/sftpgo.log + /usr/local/opt/sftpgo/var/log/sftpgo.log SFTPGO_HTTPD__TEMPLATES_PATH - /usr/local/opt/sftpgo/templates + /usr/local/opt/sftpgo/var/lib/templates SFTPGO_HTTPD__STATIC_FILES_PATH - /usr/local/opt/sftpgo/static + /usr/local/opt/sftpgo/var/lib/static SFTPGO_HTTPD__BACKUPS_PATH - /usr/local/opt/sftpgo/backups + /usr/local/opt/sftpgo/var/lib/backups + SFTPGO_DATA_PROVIDER__CREDENTIALS_PATH + /usr/local/opt/sftpgo/var/lib/credentials WorkingDirectory /usr/local/opt/sftpgo/etc