Skip to content

Commit 12f632e

Browse files
dkorunicmjuraga
authored andcommitted
BUILD/MEDIUM: goreleaser: Build apk, rpm and deb packages
Use nFPM to build APK (Alpine), RPM (RHEL/CentOS/Rocky/Alma etc.) and DEB (Ubuntu/Debian) packages. Additionally generate automatic Changelog and provide a sample config for binary archives and packages.
1 parent b4e4c45 commit 12f632e

8 files changed

+71
-4
lines changed

.goreleaser.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ before:
33
hooks:
44
- go mod download
55
- go mod tidy
6-
- make clean
7-
- mkdir build/
86
builds:
97
-
108
id: my-build
11-
main: ./cmd/dataplaneapi/main.go
12-
binary: ./build/dataplaneapi
9+
main: ./cmd/dataplaneapi
10+
binary: dataplaneapi
1311
ldflags:
1412
- -s -w -X main.GitRepo={{.GitURL}} -X main.GitTag={{.Tag}} -X main.GitCommit={{.ShortCommit}} -X main.GitDirty= -X main.BuildTime={{.Date}}
1513
env:
@@ -25,6 +23,9 @@ builds:
2523
- arm64
2624
- ppc64le
2725
- s390x
26+
changelog:
27+
sort: asc
28+
use: git
2829
archives:
2930
-
3031
id: my-archive

assets/packages/dataplaneapi.service

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=HAProxy Data Plane API
3+
After=syslog.target network-online.target
4+
5+
[Service]
6+
Environment="PIDFILE=/run/dataplaneapi.pid"
7+
EnvironmentFile=/etc/default/dataplaneapi
8+
ExecStart=/usr/sbin/dataplaneapi $SYSD_OPTIONS
9+
ExecReload=/bin/kill -s SIGUSR1 $MAINPID
10+
Type=simple
11+
PIDFile=
12+
GuessMainPID=1
13+
14+
[Install]
15+
WantedBy=multi-user.target

assets/packages/dataplaneapi.yml.dist

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
dataplaneapi:
2+
host: 0.0.0.0
3+
port: 5555
4+
userlist:
5+
userlist: dataplaneapi
6+
resources:
7+
maps_dir: /etc/haproxy/maps
8+
ssl_certs_dir: /etc/haproxy/ssl
9+
general_storage_dir: /etc/haproxy/general
10+
spoe_dir: /etc/haproxy/spoe
11+
transaction:
12+
transaction_dir: /var/lib/dataplaneapi/transactions
13+
backups_number: 10
14+
backups_dir: /var/lib/dataplaneapi/backups
15+
haproxy:
16+
config_file: /etc/haproxy/haproxy.cfg
17+
haproxy_bin: /usr/sbin/haproxy
18+
reload:
19+
reload_delay: 5
20+
service_name: haproxy
21+
reload_strategy: systemd
22+
log_targets:
23+
- log_to: file
24+
log_file: /var/log/dataplaneapi.log
25+
log_level: info
26+
log_types:
27+
- access
28+
- app

assets/packages/default

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Options for dataplaneapi
2+
3+
SYSD_OPTIONS='-f /etc/dataplaneapi/dataplaneapi.yml'

assets/packages/logrotate

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/var/log/dataplaneapi.log {
2+
missingok
3+
compress
4+
notifempty
5+
copytruncate
6+
daily
7+
rotate 7
8+
create 0640 root root
9+
}

assets/packages/post-install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
systemctl --system daemon-reload || true
4+
systemctl enable dataplaneapi || true

assets/packages/post-uninstall.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
systemctl --system daemon-reload || true

assets/packages/pre-uninstall.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
systemctl stop dataplaneapi || true
4+
systemctl disable dataplaneapi || true

0 commit comments

Comments
 (0)