Skip to content

Commit

Permalink
[eclipse-kanto#85] Provide RPM support
Browse files Browse the repository at this point in the history
Added RPM packaging and relevant resources - scripts, builds, packaging config.

Signed-off-by: Konstantina Gramatova <[email protected]>
  • Loading branch information
konstantina-gramatova committed Sep 15, 2022
1 parent d32a03f commit 25c3434
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 16 deletions.
39 changes: 23 additions & 16 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-local-digital-twins-deb
- id: build-local-digital-twins-pkg
dir: ./build-tmp/local-digital-twins
main: ./cmd/twins
binary: local-digital-twins
Expand Down Expand Up @@ -315,7 +315,7 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-suite-bootstrapping-deb
- id: build-suite-bootstrapping-pkg
dir: ./build-tmp/suite-bootstrapping
main: ./cmd/bootstrapping
binary: suite-bootstrapping
Expand Down Expand Up @@ -362,7 +362,7 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-file-backup-deb
- id: build-file-backup-pkg
dir: ./build-tmp/file-backup
main: ./
binary: file-backup
Expand Down Expand Up @@ -409,7 +409,7 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-system-metrics-deb
- id: build-system-metrics-pkg
dir: ./build-tmp/system-metrics
main: ./cmd/metrics
binary: system-metrics
Expand Down Expand Up @@ -519,10 +519,10 @@ nfpms:
- build-container-management-cli-pkg
- build-file-upload-pkg
- build-software-update-pkg
- build-local-digital-twins-deb
- build-suite-bootstrapping-deb
- build-file-backup-deb
- build-system-metrics-deb
- build-local-digital-twins-pkg
- build-suite-bootstrapping-pkg
- build-file-backup-pkg
- build-system-metrics-pkg
bindir: /usr/bin
replacements:
amd64: x86_64
Expand All @@ -536,22 +536,29 @@ nfpms:
formats:
- deb
- rpm
scripts:
postinstall: "build/postinst"
preremove: "build/prerm"
postremove: "build/postrm"
overrides:
deb:
dependencies:
- containerd.io | containerd
- mosquitto
- iptables
scripts:
postinstall: "build/postinst"
preremove: "build/prerm"
postremove: "build/postrm"
rpm:
dependencies:
- containerd
- mosquitto
- iptables
scripts:
postinstall: "build/postinst_rpm"
contents:
# kanto systemd preset file
- src: ./build/80-kanto.preset
dst: /usr/lib/systemd/system-preset/80-kanto.preset
file_info:
mode: 0644
# suite-connector additional resources
- src: ./build-tmp/suite-connector/resources/suite-connector.service
dst: /etc/systemd/system/suite-connector.service
Expand Down Expand Up @@ -650,7 +657,7 @@ nfpms:
dst: /usr/share/doc/software-update/LICENSE
file_info:
mode: 0644
# local-digital-twins additional resources
# local-digital-twins additional resources
- src: ./build-tmp/local-digital-twins/resources/local-digital-twins.service
dst: /etc/systemd/system/local-digital-twins.service
file_info:
Expand All @@ -677,7 +684,7 @@ nfpms:
dst: /usr/share/doc/local-digital-twins/LICENSE
file_info:
mode: 0644
# suite-bootstrapping additional resources
# suite-bootstrapping additional resources
- src: ./build-tmp/suite-bootstrapping/resources/suite-bootstrapping.service
dst: /etc/systemd/system/suite-bootstrapping.service
file_info:
Expand All @@ -704,7 +711,7 @@ nfpms:
dst: /usr/share/doc/suite-bootstrapping/LICENSE
file_info:
mode: 0644
# file-backup additional resources
# file-backup additional resources
- src: ./build-tmp/file-backup/resources/file-backup.service
dst: /etc/systemd/system/file-backup.service
file_info:
Expand All @@ -726,7 +733,7 @@ nfpms:
dst: /usr/share/doc/file-backup/LICENSE
file_info:
mode: 0644
# system-metrics additional resources
# system-metrics additional resources
- src: ./build-tmp/system-metrics/resources/system-metrics.service
dst: /etc/systemd/system/system-metrics.service
file_info:
Expand Down
13 changes: 13 additions & 0 deletions build/80-kanto.preset
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Enable all Kanto-related services

# Enable containerd and mosquitto
enable containerd.service
enable mosquitto.service

# Enable the Kanto services
enable suite-connector.service
enable container-management.service
enable file-upload.service
enable software-update.service
enable file-backup.service
enable system-metrics.service
18 changes: 18 additions & 0 deletions build/postinst_rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

echo "include_dir /etc/mosquitto/conf.d" >> /etc/mosquitto/mosquitto.conf

# use "systemctl preset"
# instead of "systemctl enable"
# as per Fedora's guidelines

# containerd and mosquitto
systemctl preset containerd.service
systemctl preset mosquitto.service

# the Kanto services
systemctl preset suite-connector.service
systemctl preset container-management.service
systemctl preset file-upload.service
systemctl preset software-update.service
systemctl preset file-backup.service
systemctl preset system-metrics.service

0 comments on commit 25c3434

Please sign in to comment.