Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-apps/trickster/, www-apps/trickster/files/
Date: Sat, 20 Apr 2019 23:29:17
Message-Id: 1555712000.ca573d1549829fdd82623f8e3fd5cf692db92e76.williamh@gentoo
1 commit: ca573d1549829fdd82623f8e3fd5cf692db92e76
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Fri Apr 19 22:02:59 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 19 22:13:20 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca573d15
7
8 www-apps/trickster: Dashboard Accelerator for Prometheus
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.62, Repoman-2.3.12
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 www-apps/trickster/Manifest | 2 +
15 www-apps/trickster/files/trickster.conf | 113 ++++++++++++++++++++++++++++++
16 www-apps/trickster/files/trickster.initd | 25 +++++++
17 www-apps/trickster/metadata.xml | 8 +++
18 www-apps/trickster/trickster-0.1.9.ebuild | 45 ++++++++++++
19 5 files changed, 193 insertions(+)
20
21 diff --git a/www-apps/trickster/Manifest b/www-apps/trickster/Manifest
22 new file mode 100644
23 index 00000000000..4a73b462077
24 --- /dev/null
25 +++ b/www-apps/trickster/Manifest
26 @@ -0,0 +1,2 @@
27 +DIST trickster-0.1.9-vendor.tar.gz 1748976 BLAKE2B 77ad4a91a889a8241399fe6b4199d25c0ba52e818fbe1df8186dadea0f69c1d04f9c268fc376820592465ed36104a6195ce9a9985f8a9c02636ee1b8f80114b7 SHA512 6427cb3417ae7d62e5e144cb5a1962f2175ab063c2267abd838560db00acc4c161666df4ea2065a02172b50240f17a6ad09d76973e59d9bea91ecf4a9327466f
28 +DIST trickster-0.1.9.tar.gz 1739869 BLAKE2B dc50d12acfe27f68054bbafdeada0bd1847ebb1e03847f9173c7e9b772218ce2e7ceffe25db282912f88c005c0d590e3effece6483bdd80830438a8d114f859f SHA512 82fa837d2b18143a65e22a06d2821d7a1da298fb3e9389854f8e6ad4de68f35d40d6aec2d23cca877032227d12818063953244a01b42f09bd724677d1080e84f
29
30 diff --git a/www-apps/trickster/files/trickster.conf b/www-apps/trickster/files/trickster.conf
31 new file mode 100644
32 index 00000000000..9fb255e19c5
33 --- /dev/null
34 +++ b/www-apps/trickster/files/trickster.conf
35 @@ -0,0 +1,113 @@
36 +[main]
37 +# instance_id allows you to run multiple trickster processes on the same host and log to separate files
38 +# Useful for baremetal, not so much for elastic deployments, so only uncomment if you really need it
39 +#instance_id = 1
40 +
41 +# Configuration options for the Proxy Server
42 +[proxy_server]
43 +# listen_port defines the port on which Trickster's Proxy server listens.
44 +# since this is a proxy for Prometheus, we use 9090 by default, just like Prometheus does
45 +# listen_port = 9090
46 +# listen_address defines the ip on which Trickster's Proxy server listens.
47 +# empty by default, listening on all interfaces
48 +# listen_address =
49 +
50 +[cache]
51 +# cache_type defines what kind of cache Trickster uses
52 +# options are 'boltdb', 'filesystem', 'memory', and 'redis'.
53 +# The default is 'memory'.
54 +cache_type = 'memory'
55 +
56 +# record_ttl_secs defines the relative expiration of cached queries. default is 6 hours (21600 seconds)
57 +# record_ttl_secs = 21600
58 +
59 +# reap_sleep_ms defines how long the cache reaper waits between reap cycles. Default is 1000 (1s)
60 +# reap_sleep_ms = 1000
61 +
62 +# compression determines whether the cache should be compressed. default is true
63 +# compression = true
64 +
65 + ### Configuration options when using a Redis Cache
66 + # [cache.redis]
67 + # protocol defines the protocol for connecting to redis ('unix' or 'tcp') 'tcp' is default
68 + # protocol = 'tcp'
69 + # endpoint defines the fqdn+port or path to a unix socket file for connecting to redis
70 + # default is 'redis:6379'
71 + # endpoint = 'redis:6379'
72 +
73 + ### Configuration options when using a Filesystem Cache
74 + # [cache.filesystem]
75 + # cache_path defines the directory location under which the Trickster cache will be maintained
76 + # default is '/tmp/trickster'
77 + # cache_path = '/tmp/trickster'
78 +
79 + # Configuration options when using a BoltDb Cache
80 + #[cache.boltdb]
81 +
82 + # filename defines the file where the Trickster cache will be maintained
83 + # default is 'trickster.db'
84 + # filename = 'trickster.db'
85 +
86 + # bucket defines the name of the BotlDb bucket (similar to a namespace) under which our key value store lives
87 + # default is 'trickster'
88 + # bucket = 'trickster'
89 +
90 +# Configuration options for mapping Origin(s)
91 +[origins]
92 + ### The default origin
93 + [origins.default]
94 +
95 + # origin_url defines the URL of the origin. Default is http://prometheus:9090
96 + origin_url = 'http://prometheus:9090'
97 +
98 + # timeout_secs defines how many seconds Trickster will wait before aborting and upstream http request. Default: 180s
99 + # timeout_secs = 180
100 +
101 + # api path defines the path of the Prometheus API (usually '/api/v1')
102 + api_path = '/api/v1'
103 +
104 + # ignore_no_cache_header disables a client's ability to send a no-cache to refresh a cached query. Default is false
105 + # ignore_no_cache_header = false
106 +
107 + # max_value_age_secs defines the maximum age of specific datapoints in seconds. Default is 86400 (24 hours)
108 + max_value_age_secs = 86400
109 +
110 + # fast_forward_disable, when set to true, will turn off the 'fast forward' feature for any requests proxied to this origin
111 + # fast_forward_disable = false
112 +
113 + # For multi-origin support, origins are named, and the name is the second word of the configuration section name.
114 + # In this example, an origin is named "foo". Clients can indicate this origin in their path (http://trickster.example.com:9090/foo/query_range?.....)
115 + # there are other ways for clients to indicate which origin to use in a multi-origin setup. See the documentation for more information
116 +
117 + # [origins.foo]
118 + # origin_url = 'http://prometheus-foo:9090'
119 + # api_path = '/api/v1'
120 + # default_step = 300
121 + # ignore_no_cache_header = false
122 + # max_value_age_secs = 86400
123 + # timeout_secs = 180
124 +
125 +# Configuration Options for Metrics Instrumentation
126 +[metrics]
127 +# listen_port defines the port that Trickster's metrics server listens on at /metrics
128 +listen_port = 8082
129 +# listen_address defines the ip that Trickster's metrics server listens on at /metrics
130 +# empty by default, listening on all interfaces
131 +# listen_address =
132 +
133 +# Configruation Options for Profiler
134 +[profiler]
135 +# enabled indicates whether to start the profiler server when Trickster starts up. Default: false
136 +# enabled = false
137 +# listen_port defines the port that Trickster's profiler server listens on at /debug/pprof. Default: 6060
138 +# listen_port = 6060
139 +
140 +# Configuration Options for Logging Instrumentation
141 +[logging]
142 +# log_level defines the verbosity of the logger. Possible values are 'debug', 'info', 'warn', 'error'
143 +# default is info
144 +log_level = 'info'
145 +
146 +# log_file defines the file location to store logs. These will be auto-rolled and maintained for you.
147 +# not specifying a log_file (this is the default behavior) will print logs to STDOUT
148 +log_file = '/var/log/trickster/trickster.log'
149
150 diff --git a/www-apps/trickster/files/trickster.initd b/www-apps/trickster/files/trickster.initd
151 new file mode 100644
152 index 00000000000..bdee1f57e2e
153 --- /dev/null
154 +++ b/www-apps/trickster/files/trickster.initd
155 @@ -0,0 +1,25 @@
156 +#!/sbin/openrc-run
157 +
158 +description="Dashboard Accelerator for Prometheus"
159 +command=/usr/bin/trickster
160 +command_background=yes
161 +command_user=${user:-trickster}:${group:-trickster}
162 +extra_started_commands=reload
163 +pidfile=/var/run/${RC_SVCNAME}.pid
164 +
165 +depend() {
166 + after net
167 +}
168 +
169 +reload() {
170 + ebegin "Reloading ${RC_SVCNAME}"
171 + case "${supervisor}" in
172 + supervise-daemon)
173 + supervise-daemon --signal HUP --pidfile "${pidfile}"
174 + ;;
175 + *)
176 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
177 + ;;
178 + esac
179 + eend $?
180 +}
181
182 diff --git a/www-apps/trickster/metadata.xml b/www-apps/trickster/metadata.xml
183 new file mode 100644
184 index 00000000000..c36c37139fa
185 --- /dev/null
186 +++ b/www-apps/trickster/metadata.xml
187 @@ -0,0 +1,8 @@
188 +<?xml version="1.0" encoding="UTF-8"?>
189 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
190 +<pkgmetadata>
191 + <maintainer type="person">
192 + <email>williamh@g.o</email>
193 + <name>William Hubbs</name>
194 + </maintainer>
195 +</pkgmetadata>
196
197 diff --git a/www-apps/trickster/trickster-0.1.9.ebuild b/www-apps/trickster/trickster-0.1.9.ebuild
198 new file mode 100644
199 index 00000000000..ef356ced058
200 --- /dev/null
201 +++ b/www-apps/trickster/trickster-0.1.9.ebuild
202 @@ -0,0 +1,45 @@
203 +# Copyright 1999-2019 Gentoo Authors
204 +# Distributed under the terms of the GNU General Public License v2
205 +
206 +EAPI=7
207 +
208 +inherit user systemd
209 +
210 +DESCRIPTION="Dashboard Accelerator for Prometheus"
211 +HOMEPAGE="https://github.com/Comcast/trickster"
212 +VENDOR_URI="https://dev.gentoo.org/~williamh/dist/${P}-vendor.tar.gz"
213 +SRC_URI="https://github.com/Comcast/trickster/archive/v${PV}.tar.gz -> ${P}.tar.gz
214 + ${VENDOR_URI}"
215 +
216 +LICENSE="Apache-2.0"
217 +SLOT="0"
218 +KEYWORDS="~amd64"
219 +
220 +DEPEND="dev-lang/go:="
221 +
222 +RESTRICT="strip"
223 +
224 +pkg_setup() {
225 + enewgroup ${PN}
226 + enewuser ${PN} -1 -1 -1 ${PN}
227 +}
228 +
229 +src_prepare() {
230 + default
231 + mv ../vendor .
232 +}
233 +
234 +src_compile() {
235 + GOCACHE="${T}"/go-cache go build -a -mod vendor -v || die "build failed"
236 +}
237 +
238 +src_install() {
239 + dobin ${PN}
240 +dodoc -r conf docs/*
241 + systemd_dounit conf/trickster.service
242 + keepdir /var/log/${PN}
243 + fowners ${PN}:${PN} /var/log/${PN}
244 + insinto /etc/trickster
245 + doins "${FILESDIR}"/${PN}.conf
246 + newinitd "${FILESDIR}"/${PN}.initd ${PN}
247 +}