Create systemd service install script, fix service

This will check if you have have systemd installed,
copy the service file to your user directory,
and instruct the user how to enable it on login.
This commit is contained in:
Jonathan Dahan 2020-01-03 15:03:21 -05:00
parent 3e764e6d4d
commit 8ce7d76df7
4 changed files with 25 additions and 46 deletions

View File

@ -42,6 +42,14 @@ docker volume create ssb
docker run --mount source=ssb,target=/root/.ssb -p 3000:3000 --rm oasis
```
### Starting on login
This will install an oasis service for the current user.
```shell
bash contrib/install-systemd-service.bash
```
## Resources
- [Contributing](https://github.com/fraction/oasis/blob/master/docs/contributing.md)

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
test "$XDG_CONFIG_HOME" || XDG_CONFIG_HOME=$HOME/.config
test "$SYSTEMD_USER_HOME" || SYSTEMD_USER_HOME="$XDG_CONFIG_HOME"/systemd/user
mkdir -p "$SYSTEMD_USER_HOME"
test -f "$SYSTEMD_USER_HOME"/oasis.service || cp oasis.service "$SYSTEMD_USER_HOME"/
systemctl --user daemon-reload
printf "oasis service has been installed to %s" "$SYSTEMD_USER_HOME"
printf "to enable for the current user, run"
printf "\n\tsystemctl --user enable oasis"
printf "to start right now, run"
printf "\n\tsystemctl --user start oasis"
printf "\txdg-open http://localhost:4515"

View File

@ -1,8 +1,3 @@
# cp oasis.service ~/.config/systemd/user
# systemctl --user daemon-reload
# systemctl --user enable oasis
# systemctl --user start oasis
[Unit]
Description=Oasis - Friendly Scuttlebutt Web Interface
Documentation=https://github.com/fraction/oasis
@ -10,7 +5,7 @@ After=network.target
[Service]
Type=simple
ExecStart=%s -l -c 'oasis --host localhost --port 4515'
ExecStart=%s -l -c 'oasis --host localhost --port 4515 --no-open'
Restart=on-failure
[Install]

View File

@ -1,40 +0,0 @@
# Installation
## Download
### HTTP
```shell
git clone https://github.com/fraction/oasis.git
cd oasis
```
### SSH
```shell
git clone git@github.com:fraction/oasis.git
cd oasis
```
## Dependencies
### Yarn
```shell
yarn
```
### npm
```shell
npm install
```
## System service
```shell
cp contrib/oasis.service ~/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable oasis
systemctl --user start oasis
```