-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
152 lines (108 loc) · 4.73 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup golang 1.0
go.setup github.com/prometheus/alertmanager 0.27.0 v
github.tarball_from archive
revision 0
homepage https://prometheus.io/docs/alerting/alertmanager
description The Alertmanager handles alerts sent by client \
applications such as the Prometheus server.
long_description AlertManager takes care of deduplicating, grouping, and \
routing them to the correct receiver integration such as \
email, PagerDuty, or OpsGenie. It also takes care of \
silencing and inhibition of alerts.
categories sysutils
installs_libs no
license Apache-2
maintainers {gmail.com:herby.gillot @herbygillot} \
openmaintainer
checksums rmd160 4d7f79ff7f187c070e0daaf0d94f84b3c7566d63 \
sha256 c21ede46b0471adb4d7bd75f09e57d44d969801717a6e0ef36ee37e4cdf25dd8 \
size 2868365
depends_build-append \
port:promu
# Allow Go to fetch dependencies at build time
go.offline_build no
build.cmd make
build.target build
use_parallel_build no
set svc_name prometheus-alertmanager
set prom_user prometheus
set am_config_dir ${prefix}/etc/${svc_name}
set am_config_file ${am_config_dir}/config.yml
set am_data_dir ${prefix}/var/db/${svc_name}
set am_share_dir ${prefix}/share/${svc_name}
set am_log_dir ${prefix}/var/log/${svc_name}
set am_log_file ${am_log_dir}/${name}.log
add_users ${prom_user} \
group=${prom_user} \
realname=Prometheus
# promu will fail if it cannot capture the current user using the USER
# environment variable. So if USER is not currently set in the environment,
# we'll set it here for purposes of the build.
if {! [info exists env(USER)]} {
build.env-append "USER=${macportsuser}"
}
pre-build {
# Link promu into where the Makefile expects to find it so that it doesn't
# try to fetch and install promu again on its own.
file mkdir ${gopath}/bin
ln -s ${prefix}/bin/promu ${gopath}/bin/
}
post-extract {
copy ${filespath}/org.macports.${name}.plist \
${workpath}/org.macports.${name}.plist
}
patch {
reinplace "s|@NAME@|${name}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@USER@|${prom_user}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@GROUP@|${prom_user}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@PREFIX@|${prefix}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@LOGFILE@|${am_log_file}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@DATADIR@|${am_data_dir}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@CONFIGFILE@|${am_config_file}|g" \
${workpath}/org.macports.${name}.plist
}
destroot.keepdirs ${destroot}${am_config_dir} \
${destroot}${am_data_dir}
destroot {
xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}
xinstall -m 0755 ${worksrcpath}/amtool ${destroot}${prefix}/bin/amtool
xinstall -d -m 0755 ${destroot}${am_config_dir}
xinstall -d -m 0755 ${destroot}${am_share_dir}
xinstall -d -m 0755 -o ${prom_user} -g ${prom_user} ${destroot}${am_log_dir}
xinstall -d -m 0755 -o ${prom_user} -g ${prom_user} ${destroot}${am_data_dir}
touch ${destroot}${am_log_file}
file attributes ${destroot}${am_log_file} \
-owner ${prom_user} -group ${prom_user}
copy ${worksrcpath}/doc ${destroot}${am_share_dir}/
copy ${worksrcpath}/examples ${destroot}${am_share_dir}/
xinstall -d -m 0755 \
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}
xinstall -m 0644 -o root -W ${workpath} org.macports.${name}.plist \
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}
xinstall -d -m 0755 ${destroot}/Library/LaunchDaemons
ln -s ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist \
${destroot}/Library/LaunchDaemons/org.macports.${name}.plist
}
post-activate {
if {![file exists ${am_config_file}]} {
copy ${am_share_dir}/doc/examples/simple.yml ${am_config_file}
}
}
github.livecheck.regex {([0-9.]+)}
notes "
To enable the Prometheus AlertManager service, use `port load`, as follows:
\$ sudo port load ${name}
When enabled, the service will:
- listen by default on http://localhost:9093
- log to: ${am_log_file}
Configuration for AlertManager can be found at:
${am_config_file}
"