diff --git a/goreleaser.yml b/goreleaser.yml index ecdba37..a9392fb 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -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 " description: "TURN and STUN server in go." license: "BSD 3-Clause" + name_template: "{{.ProjectName}}-{{.Version }}-{{ .Os }}-{{ .Arch }}" + archive: format: tar.gz format_overrides: diff --git a/provision/gortcd.service b/provision/gortcd.service new file mode 100644 index 0000000..0728ab0 --- /dev/null +++ b/provision/gortcd.service @@ -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 diff --git a/provision/postinstall.sh b/provision/postinstall.sh new file mode 100644 index 0000000..1de6586 --- /dev/null +++ b/provision/postinstall.sh @@ -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