~dricottone/huttese-apk

b850e84c7eaca0ef1e072dc1dd84a90fb24f9a6c — Drew DeVault 4 years ago 6b1111f
sachet: new aport
A sr.ht/sachet/APKBUILD => sr.ht/sachet/APKBUILD +50 -0
@@ 0,0 1,50 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=sachet
pkgver=0.2.2
pkgrel=0
pkgdesc="Prometheus Alertmanager"
url="https://github.com/messagebird/sachet"
arch="all"
license="Apache-2.0"
install="$pkgname.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/messagebird/sachet/archive/$pkgver.tar.gz
	sachet.confd
	sachet.initd
	config.yml
"
subpackages="$pkgname-openrc"

build() {
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS" \
		-tags netgo \
		./cmd/sachet
}

check() {
	go test ./...
}

package() {
	install -Dm755 sachet "$pkgdir"/usr/bin/sachet

	install -Dm755 "$srcdir"/sachet.initd \
		"$pkgdir"/etc/init.d/sachet
	install -Dm644 "$srcdir"/sachet.confd \
		"$pkgdir"/etc/conf.d/sachet

	mkdir -p "$pkgdir"/etc/sachet
	install -Dm644 "$srcdir"/config.yml \
		"$pkgdir"/etc/sachet/config.yml
	install -Dm644 examples/telegram.tmpl \
		"$pkgdir"/etc/sachet/telegram.tmpl
}

sha512sums="3684090505403cff65cd05e2c6b61cf930dd0d7e461c355963417197bdd6306b837dbc5933b34676646cc9ae480190313c1aebfa81699581d0aafff377127e92  sachet-0.2.2.tar.gz
9516a5a26ecfff4b6511084df346ee66fd923522d2750ce5deb894980c7782f5175ebd83a5a401a384f6caa28c1aa436de56660538f417fa6c71d9e4397b6bf4  sachet.confd
68fc6733011d854d5dabbc6e646774b5c9cc78fce2a79b14ab8d4eb760fad86aac62149847ed9749198e9a46cc65e8bc5a4894c8dafe3c750e4a9fe7c81b066d  sachet.initd
579dd96a930ea02d33e5d084421f873d72b125f4314d7bd7170fe6705adce742abaa626297191779e7edb25a50c03e87b25fd4250f4c08cc175e0674724f2b1e  config.yml"

A sr.ht/sachet/config.yml => sr.ht/sachet/config.yml +78 -0
@@ 0,0 1,78 @@
providers:
  messagebird:
    access_key: 'live_qKwVZ02ULV70GqabBYxLU8d5r'
    debug: true
  nexmo:
    api_key: '18e0a6e9'
    api_secret: 'ea44c2d9'
  infobip:
    token: "sasasa"
    secret: "sasasa"
  kannel:
    # url: "http://localhost:13013/cgi-bin/sendsms"
    url: "http://httpbin.org/get"
    user: "tester"
    password: "foobar"
  exotel:
    account_sid: 'sachet'
    auth_token: 'bbba3f4afc0b4ee76c93e43b7c1b2d4350d1a0e8'
  twilio:
    account_sid: 'aCb3bbaacc554b'
    auth_token: '4736473aaabbcc66'
  turbosms:
    login: 'visla'
    password: '44444'
  cm:
    producttoken: '00000000-0000-0000-0000-000000000000'
  telegram:
    token: "724679217:aa26V5mK3e2qkGsSlTT-iHreaa5FUyy3Z_0"
  otc:
    identity_endpoint: https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens
    domain_name: domain_name
    project_name: project_name
    username: username
    password: password
    project_id: project_id
  mediaburst:
    api_key: 'aa66sdfasfsda7887fdsf7sdf87fsdf7sdf7dsfd'
  freemobile:
    username: 'my-user-name'
    password: 'secret'
    url: "https://smsapi.free-mobile.fr/sendmsg"
  aspsms:
    username: 'username'
    password: 'password'
  sipgate:
    username: 'username'
    password: 'password'
  pushbullet:
    access_token: 'o.AbCdEfGhIjKlMnOpQrStUvWxYz012345'
  nowsms:
    username: 'username'
    password: 'password'

templates:
  - /etc/sachet/telegram.tmpl

receivers:
  - name: 'team-sms'
    provider: 'messagebird'
    to:
      - '+919742033616'
    from: '08039591643'
  - name: 'team-chat'
    provider: 'telegram'
    to:
      - '164451814' # the chat id of a user. Get yours at https://telegram.me/userinfobot
    text: '{{ .GroupLabels.alertname }} @ {{ .Labels.instance }}: {{ .Status | toUpper }}'
  - name: 'pushbullet'
    provider: 'pushbullet'
    to:
      - device:My Nickname
      - channel:mytag
  - name: 'nowsms'
    provider: 'nowsms'
    to:
      - '332432432'
      - '4242334534'


A sr.ht/sachet/sachet.confd => sr.ht/sachet/sachet.confd +5 -0
@@ 0,0 1,5 @@
alertmanager_config_file=/etc/alertmanager/alertmanager.yml
alertmanager_storage_path=/var/lib/alertmanager/data

output_log=/var/log/alertmanager.log
error_log=/var/log/alertmanager.log

A sr.ht/sachet/sachet.initd => sr.ht/sachet/sachet.initd +16 -0
@@ 0,0 1,16 @@
#!/sbin/openrc-run
name="alertmanager"
description="alert manager for the prometheus monitoring system"
supervisor=supervise-daemon
command=/usr/bin/prometheus
command_args="--config.file=$alertmanager_config_file \
	--storage.path=$alertmanager_storage_path"
command_user="prometheus:prometheus"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

A sr.ht/sachet/sachet.pre-install => sr.ht/sachet/sachet.pre-install +4 -0
@@ 0,0 1,4 @@
#!/bin/sh
grep '^prometheus' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null