-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3f9d25
commit 05b1372
Showing
17 changed files
with
440 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/dist | ||
/coverageout | ||
/.idea | ||
*.iml |
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 |
---|---|---|
|
@@ -4,3 +4,7 @@ extension-prometheus.iml | |
/e2e/e2e-coverage-docker.out | ||
/licenses | ||
/snyk.sarif | ||
/gpg.key | ||
/dist | ||
/extension | ||
|
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,83 @@ | ||
project_name: steadybit-extension-prometheus | ||
version: 2 | ||
before: | ||
hooks: | ||
- go mod download | ||
- make licenses-report | ||
|
||
release: | ||
prerelease: "false" | ||
|
||
git: | ||
ignore_tags: | ||
- steadybit-extension-prometheus-* | ||
|
||
builds: | ||
- binary: extension-prometheus | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
flags: | ||
- -cover={{ if index .Env "BUILD_WITH_COVERAGE" }}{{ .Env.BUILD_WITH_COVERAGE }}{{ else }}false{{ end }} | ||
- -covermode=atomic | ||
ldflags: | ||
- -s -w | ||
- -X github.com/steadybit/extension-kit/extbuild.ExtensionName={{.ProjectName}} | ||
- -X github.com/steadybit/extension-kit/extbuild.Version={{.Version}} | ||
- -X github.com/steadybit/extension-kit/extbuild.Revision={{.Commit}} | ||
|
||
archives: | ||
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
nfpms: | ||
- package_name: "steadybit-extension-prometheus" | ||
file_name_template: "{{ .ConventionalFileName }}" | ||
formats: | ||
- deb | ||
- rpm | ||
maintainer: "Johannes Edmeier <[email protected]>" | ||
description: | | ||
Steadybit Extension Prometheus | ||
vendor: "steadybit GmbH" | ||
homepage: "https://steadybit.com" | ||
license: "Steadybit license" | ||
builds: | ||
- steadybit-extension-prometheus | ||
bindir: /opt/steadybit/extension-prometheus | ||
contents: | ||
- src: ./linuxpkg/systemd | ||
dst: /usr/lib/systemd/system | ||
- src: ./linuxpkg/init.d | ||
dst: /etc/init.d | ||
- src: ./linuxpkg/config | ||
dst: /etc | ||
type: config | ||
- src: ./licenses | ||
dst: /opt/steadybit/extension-prometheus/licenses | ||
scripts: | ||
preinstall: ./linuxpkg/scripts/preinstall.sh | ||
postinstall: ./linuxpkg/scripts/postinstall.sh | ||
preremove: ./linuxpkg/scripts/preremove.sh | ||
postremove: ./linuxpkg/scripts/postremove.sh | ||
|
||
rpm: | ||
signature: | ||
key_file: ./gpg.key | ||
deb: | ||
signature: | ||
key_file: ./gpg.key |
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
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
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,8 @@ | ||
/var/log/steadybit-extension-prometheus.log { | ||
copytruncate | ||
size 10m | ||
create 700 steadybit steadybit | ||
dateext | ||
rotate 5 | ||
compress | ||
} |
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,3 @@ | ||
STEADYBIT_LOG_LEVEL=info | ||
STEADYBIT_LOG_FORMAT=text | ||
STEADYBIT_EXTENSION_UNIX_SOCKET=/run/steadybit/extension-prometheus.sock |
4 changes: 4 additions & 0 deletions
4
linuxpkg/config/steadybit/extensions.d/extension-prometheus.yaml
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 @@ | ||
unixSocket: /run/steadybit/extension-prometheus.sock | ||
types: | ||
- ACTION | ||
- DISCOVERY |
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,99 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright 2024 steadybit GmbH. All rights reserved. | ||
# | ||
|
||
### BEGIN INIT INFO | ||
# Provides: steadybit-extension-prometheus | ||
# Required-Start: $local_fs $network $named $time $syslog | ||
# Required-Stop: $local_fs $network $named $time $syslog | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Description: Steadybit Extension Prometheus | ||
# chkconfig: 2345 99 01 | ||
### END INIT INFO | ||
|
||
SCRIPT=/opt/steadybit/extension-prometheus/extension-prometheus | ||
RUNAS=steadybit | ||
|
||
PIDFILE=/var/run/steadybit-extension-prometheus.pid | ||
LOGFILE=/var/log/steadybit-extension-prometheus.log | ||
ENVFILE=/etc/steadybit/extension-prometheus | ||
|
||
start() { | ||
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then | ||
echo 'Service already running' >&2 | ||
return 1 | ||
fi | ||
echo 'Starting service...' >&2 | ||
|
||
if [ ! -e "$LOGFILE" ]; then | ||
touch "$LOGFILE" | ||
if [ -n "$RUNAS" ]; then | ||
chown "$RUNAS" "$LOGFILE" | ||
fi | ||
fi | ||
|
||
if [ -f "$ENVFILE" ]; then | ||
export $(grep -v "^#" "$ENVFILE" | xargs) | ||
fi | ||
|
||
su -s /bin/sh -c "$SCRIPT > \"$LOGFILE\" 2>&1 & echo \$!" $RUNAS >"$PIDFILE" | ||
PID=$(cat "$PIDFILE") | ||
sleep 1 | ||
|
||
if [ -z "$PID" ] || ! kill -0 "$PID" 2>/dev/null; then | ||
echo "Service failed to start" >&2 | ||
tail -n 10 "$LOGFILE" | ||
return 1 | ||
fi | ||
echo 'Service started' >&2 | ||
} | ||
|
||
stop() { | ||
if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then | ||
echo 'Service not running' >&2 | ||
return 1 | ||
fi | ||
echo 'Stopping service...' >&2 | ||
kill -15 "$(cat "$PIDFILE")" && rm -f "$PIDFILE" | ||
echo 'Service stopped' >&2 | ||
} | ||
|
||
status() { | ||
if [ ! -f "$PIDFILE" ]; then | ||
echo 'Service not running'. >&2 | ||
return 3 | ||
fi | ||
PID=$(cat "$PIDFILE") | ||
if ! kill -0 "$PID" 2>/dev/null; then | ||
echo "Service not running: process $PID not found." >&2 | ||
return 1 | ||
fi | ||
|
||
echo 'Service running'. >&2 | ||
return 0 | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
status) | ||
status | ||
;; | ||
stop) | ||
stop | ||
;; | ||
force-reload) | ||
stop | ||
start | ||
;; | ||
restart) | ||
stop | ||
start | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|status|restart}" | ||
;; | ||
esac |
Oops, something went wrong.