Skip to content

Commit

Permalink
Merge pull request #86 from terwey/linux
Browse files Browse the repository at this point in the history
Adds a Linux systemd file and an install script
  • Loading branch information
maddox committed Jan 30, 2018
2 parents f28df09 + 79d517a commit 72fe0ec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ variable to use your own port.

### Forever
harmony-api has support for [Forever](https://github.com/foreverjs/forever). It uses
`launchd` on OS X to kick it off so that it starts on boot. There is no `init.d`
or other Linux support of this type. Pull requests would be welcome for this though.
`launchd` on OS X to kick it off so that it starts on boot.

### Development
You can simply run it by calling `script/server`. This will run it in development
Expand All @@ -76,6 +75,10 @@ mode with logging to standard out.

script/install

### Install as systemd unit on Linux

sudo script/install-linux

### Docker
Installation with Docker is straightforward. Adjust the following command so that
`/path/to/your/config` points to the folder where your want to store your config and run it:
Expand Down
12 changes: 12 additions & 0 deletions config/harmony-api-server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=A simple server allowing you to query/control multiple local Harmony Home Hubs over HTTP or MQTT
After=network.target

[Service]
ExecStart=/var/lib/harmony-api/script/server
SyslogIdentifier=harmony-api
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions script/install-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -x

set -e

cd "$(dirname "$0")/.."

INSTALL_PATH=/var/lib/harmony-api
CONF_PATH=/etc/harmony-api

echo "Installing harmony-api for Linux..."
mkdir -p ${INSTALL_PATH}
cp -R * ${INSTALL_PATH}
ln -sf ${INSTALL_PATH}/config ${CONF_PATH}
ln -sf ${INSTALL_PATH}/config/harmony-api-server.service /etc/systemd/system/
systemctl enable harmony-api-server.service

0 comments on commit 72fe0ec

Please sign in to comment.