Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
dist: add systemd (fix #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jun 13, 2018
1 parent e7bd0e2 commit a446da9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,28 @@ build:
- goos: openbsd
goarch: arm
goarm: 6

sign:
artifacts: checksum

dockers:
- image: gortc/gortcd
dockerfile: release.Dockerfile

nfpm:
formats:
- deb
files:
provision/gortcd.service: /etc/systemd/system/gortcd.service
scripts:
postinstall: "provision/postinstall.sh"
vendor: "gortc.io"
homepage: "https://gortc.io/"
maintainer: "Aleksandr Razumov <[email protected]>"
description: "TURN and STUN server in go."
license: "BSD 3-Clause"
name_template: "{{.ProjectName}}-{{.Version }}-{{ .Os }}-{{ .Arch }}"

archive:
format: tar.gz
format_overrides:
Expand Down
13 changes: 13 additions & 0 deletions provision/gortcd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=TURN and STUN server in go.
Documentation=https://github.com/gortc/gortcd
After=syslog.target network.target
Wants=network-online.target

[Service]
ExecStart=/usr/local/bin/gortcd
Restart=on-failure
LimitNOFILE=65536
RestartSec=5s
PrivateTmp=yes
NotifyAccess=main
11 changes: 11 additions & 0 deletions provision/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

sysctl=$(command -v deb-systemd-invoke || echo systemctl)
$sysctl --system daemon-reload >/dev/null || true
if ! $sysctl is-enabled gortcd >/dev/null
then
$sysctl enable gortcd >/dev/null || true
$sysctl start gortcd >/dev/null || true
else
$sysctl restart gortcd >/dev/null || true
fi

0 comments on commit a446da9

Please sign in to comment.