-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from Ankurk99/systemd
package discovery-engine as a systemd service
- Loading branch information
Showing
4 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,71 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
project_name: knoxAutoPolicy | ||
|
||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=1 | ||
- binary: "opt/knoxAutoPolicy/src/knoxAutoPolicy" | ||
id: knoxAutoPolicy | ||
goos: | ||
- linux | ||
#- windows | ||
#- darwin | ||
goarch: | ||
- amd64 | ||
|
||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
- id: "knoxAutoPolicy" | ||
builds: | ||
- "knoxAutoPolicy" | ||
name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}" | ||
files: | ||
- src: ./conf/local-file.yaml | ||
dst: /opt/knoxAutoPolicy | ||
strip_parent: true | ||
- src: ./packaging/knoxAutoPolicy.service | ||
dst: /usr/lib/systemd/system | ||
strip_parent: true | ||
|
||
nfpms: | ||
- id: "knoxAutoPolicy" | ||
builds: | ||
- "knoxAutoPolicy" | ||
formats: | ||
- deb | ||
- rpm | ||
replaces: | ||
- knoxAutoPolicy | ||
maintainer: "Ankur Kothiwal <[email protected]>" | ||
description: | | ||
Auto policy discovery engine | ||
file_name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}" | ||
bindir: / | ||
contents: | ||
- dst: /opt/knoxAutoPolicy | ||
type: dir | ||
- src: ./conf/local-file.yaml | ||
dst: /opt/knoxAutoPolicy/conf/local-file.yaml | ||
type: config | ||
- src: ./packaging/knoxAutoPolicy.service | ||
dst: /usr/lib/systemd/system/knoxAutoPolicy.service | ||
type: config | ||
- src: /opt/knoxAutoPolicy/src/knoxAutoPolicy | ||
dst: /usr/local/bin/knoxAutoPolicy | ||
type: symlink | ||
scripts: | ||
postinstall: packaging/post-install.sh | ||
overrides: | ||
deb: | ||
dependencies: | ||
- make | ||
rpm: | ||
dependencies: | ||
- make | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=knoxAutoPolicy | ||
|
||
[Service] | ||
KillMode=process | ||
EnvironmentFile=/opt/knoxAutoPolicy/local-file.yaml | ||
WorkingDirectory=/opt/knoxAutoPolicy/ | ||
ExecStart=/opt/knoxAutoPolicy/src/knoxAutoPolicy | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set -e | ||
|
||
/bin/systemctl daemon-reload | ||
/bin/systemctl start knoxAutoPolicy.service |