From ddd02b3ba11d7cd40eff9d5222680312f249c560 Mon Sep 17 00:00:00 2001 From: Ada Date: Sun, 10 Mar 2024 01:19:19 +0100 Subject: [PATCH] :package: Make packaging --- .gitignore | 2 ++ .goreleaser.yaml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ plakken.service | 33 ++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 .goreleaser.yaml create mode 100644 plakken.service diff --git a/.gitignore b/.gitignore index 087b7b6..e0c5b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ plakken # Go workspace file go.work .idea/discord.xml + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..26e2a00 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,78 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + +builds: + - + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm + - arm64 + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +nfpms: + - + id: plakken + package_name: plakken + file_name_template: "{{ .ConventionalFileName }}" + vendor: GnousEU + homepage: https://git.gnous.eu/plakken/ + maintainer: Ada + description: A light paste server + license: AGPLv3 + formats: + - apk + - deb + - rpm + - archlinux + umask: 0o002 + provides: + - plakken + suggests: + - redis + contents: + - src: .env + dst: /etc/plakken/env + - src: plakken.service + dst: /usr/lib/systemd/system/plakken.service + +checksum: + algorithm: sha256 + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/plakken.service b/plakken.service new file mode 100644 index 0000000..0e063ba --- /dev/null +++ b/plakken.service @@ -0,0 +1,33 @@ +[Unit] +Description=A paste server +After=network.target + +[Service] +Type=simple +User=plakken + +ExecStart=/usr/bin/plakken + +EnvironmentFile=/etc/plakken/env + +NoNewPrivileges=yes +ProtectSystem=strict +ProtectHome=true +RestrictNamespaces=true +PrivateTmp=true +PrivateDevices=true +ProtectClock=true +ProtectControlGroups=true +ProtectKernelTunables=true +ProtectKernelLogs=true +ProtectKernelModules=true +LockPersonality=true +RestrictSUIDSGID=true +RemoveIPC=true +RestrictRealtime=true +SystemCallFilter=@system-service +SystemCallArchitectures=native +MemoryDenyWriteExecute=true + +[Install] +WantedBy=multi-user.target \ No newline at end of file