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-bin/files/, www-apps/trickster-bin/
Date: Wed, 27 Feb 2019 23:20:33
Message-Id: 1551309613.48dfbcc541e36b38d9a8c72ab052c178dd5c4f56.williamh@gentoo
1 commit: 48dfbcc541e36b38d9a8c72ab052c178dd5c4f56
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Wed Feb 27 23:16:27 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 27 23:20:13 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48dfbcc5
7
8 www-apps/trickster-bin: a Dashboard Accellerator for prometheus
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.51, Repoman-2.3.12
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 www-apps/trickster-bin/Manifest | 1 +
15 www-apps/trickster-bin/files/trickster.conf | 113 ++++++++++++++++++++++
16 www-apps/trickster-bin/files/trickster.initd | 20 ++++
17 www-apps/trickster-bin/files/trickster.service | 17 ++++
18 www-apps/trickster-bin/metadata.xml | 8 ++
19 www-apps/trickster-bin/trickster-bin-0.1.7.ebuild | 36 +++++++
20 6 files changed, 195 insertions(+)
21
22 diff --git a/www-apps/trickster-bin/Manifest b/www-apps/trickster-bin/Manifest
23 new file mode 100644
24 index 00000000000..8ba1d7cf6ac
25 --- /dev/null
26 +++ b/www-apps/trickster-bin/Manifest
27 @@ -0,0 +1 @@
28 +DIST trickster-0.1.7.linux-amd64.gz 6440487 BLAKE2B 70884e04852aadf1c0a723dfdb8c39ea081e7ee15a69062e43c80bf0a75e80791e93825ddb691cc1323bdc2ae8efbef57e66871e2ed33397b29dce8d1320b12f SHA512 f8099108ad0b11d3dddd6043ceaef3451131e30aeb1973231e86c0b3b4ff378dd0e559c56903c3f2b35a5e83f2a06e8c72e95a4c1408aedb8ea6ddfb3525b67c
29
30 diff --git a/www-apps/trickster-bin/files/trickster.conf b/www-apps/trickster-bin/files/trickster.conf
31 new file mode 100644
32 index 00000000000..004a3e90642
33 --- /dev/null
34 +++ b/www-apps/trickster-bin/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 = '/some/path/to/trickster.log'
149
150 diff --git a/www-apps/trickster-bin/files/trickster.initd b/www-apps/trickster-bin/files/trickster.initd
151 new file mode 100755
152 index 00000000000..e443653fcbc
153 --- /dev/null
154 +++ b/www-apps/trickster-bin/files/trickster.initd
155 @@ -0,0 +1,20 @@
156 +#!/sbin/openrc-run
157 +command=/usr/bin/trickster
158 +command_background=yes
159 +command_group=trickster
160 +command_user=trickster
161 +description="Dashboard Accelerator for Prometheus"
162 +error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
163 +output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
164 +extra_started_commands=reload
165 +pidfile=/var/run/trickster.pid
166 +
167 +depend() {
168 +after net
169 +}
170 +
171 +reload() {
172 + ebegin "Reloading ${RC_SVCNAME}"
173 + start-stop-daemon --signal HUP --pidfile "${PIDFILE}"
174 + EEND $?
175 +}
176
177 diff --git a/www-apps/trickster-bin/files/trickster.service b/www-apps/trickster-bin/files/trickster.service
178 new file mode 100644
179 index 00000000000..02363a90678
180 --- /dev/null
181 +++ b/www-apps/trickster-bin/files/trickster.service
182 @@ -0,0 +1,17 @@
183 +# -*- mode: conf -*-
184 +
185 +[Unit]
186 +Description=Dashboard Accelerator for Prometheus
187 +Documentation=https://github.com/Comcast/trickster
188 +After=network.target
189 +
190 +[Service]
191 +EnvironmentFile=-/etc/default/trickster
192 +User=trickster
193 +ExecStart=/usr/bin/trickster \
194 + $TRICKSTER_OPTS
195 +ExecReload=/bin/kill -HUP $MAINPID
196 +Restart=always
197 +
198 +[Install]
199 +WantedBy=multi-user.target
200
201 diff --git a/www-apps/trickster-bin/metadata.xml b/www-apps/trickster-bin/metadata.xml
202 new file mode 100644
203 index 00000000000..c36c37139fa
204 --- /dev/null
205 +++ b/www-apps/trickster-bin/metadata.xml
206 @@ -0,0 +1,8 @@
207 +<?xml version="1.0" encoding="UTF-8"?>
208 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
209 +<pkgmetadata>
210 + <maintainer type="person">
211 + <email>williamh@g.o</email>
212 + <name>William Hubbs</name>
213 + </maintainer>
214 +</pkgmetadata>
215
216 diff --git a/www-apps/trickster-bin/trickster-bin-0.1.7.ebuild b/www-apps/trickster-bin/trickster-bin-0.1.7.ebuild
217 new file mode 100644
218 index 00000000000..4457b9526e2
219 --- /dev/null
220 +++ b/www-apps/trickster-bin/trickster-bin-0.1.7.ebuild
221 @@ -0,0 +1,36 @@
222 +# Copyright 1999-2019 Gentoo Authors
223 +# Distributed under the terms of the GNU General Public License v2
224 +
225 +EAPI=7
226 +MY_PN=${PN%-bin}
227 +MY_P=${MY_PN}-${PV}
228 +
229 +inherit user systemd
230 +
231 +DESCRIPTION="Dashboard Accelerator for Prometheus"
232 +HOMEPAGE="https://github.com/Comcast/trickster"
233 +SRC_URI="https://github.com/Comcast/trickster/releases/download/v${PV}/${MY_P}.linux-amd64.gz"
234 +
235 +LICENSE="Apache-2.0"
236 +SLOT="0"
237 +KEYWORDS="~amd64"
238 +
239 +QA_PREBUILT="usr/bin/*"
240 +
241 +S="${WORKDIR}"
242 +
243 +pkg_setup() {
244 + enewgroup ${MY_PN}
245 + enewuser ${MY_PN} -1 -1 -1 ${MY_PN}
246 +}
247 +
248 +src_install() {
249 +dobin ${MY_P}.linux-amd64
250 +dosym ${MY_P}.linux-amd64 /usr/bin/${MY_PN}
251 +insinto /etc/trickster
252 +doins "${FILESDIR}"/trickster.conf
253 +newinitd "${FILESDIR}"/${MY_PN}.initd ${MY_PN}
254 +systemd_dounit "${FILESDIR}"/trickster.service
255 +keepdir /var/log/${MY_PN}
256 +fowners ${MY_PN}:${MY_PN} /var/log/${MY_PN}
257 +}