-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from JarvusInnovations/develop
Release: gatekeeper v2.3.0
- Loading branch information
Showing
15 changed files
with
195 additions
and
28 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[holomapping] | ||
files = [ | ||
"*/**", | ||
"!.vscode/" | ||
"!.vscode/", | ||
"!habitat/" | ||
] | ||
after = "*" |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/bin/bash | ||
hab pkg install emergence/studio | ||
hab pkg install emergence/studio jarvus/mkdocs-studio | ||
source "$(hab pkg path emergence/studio)/studio.sh" | ||
source "$(hab pkg path jarvus/mkdocs-studio )/studio.sh" |
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,13 @@ | ||
<?php | ||
|
||
$memInfo = apcu_sma_info(true); | ||
|
||
$totalBytes = $memInfo['seg_size'] * $memInfo['num_seg']; | ||
$freeBytes = $memInfo['avail_mem']; | ||
$responsesBytes = Cache::getIterator('/^response:/')->getTotalSize(); | ||
$applicationBytes = $totalBytes - $freeBytes - $responseBytes; | ||
|
||
printf("total\t%u\n", $totalBytes); | ||
printf("free\t%u\n", $freeBytes); | ||
printf("responses\t%u\n", $responsesBytes); | ||
printf("application\t%u\n", $applicationBytes); |
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,7 @@ | ||
<?php | ||
|
||
use Gatekeeper\Endpoints\Endpoint; | ||
|
||
foreach (Endpoint::getAll() AS $Endpoint) { | ||
printf("%s\t%u\n", $Endpoint->Handle, $Endpoint->getCounterMetric('requests')); | ||
} |
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 @@ | ||
[server] | ||
address = "0.0.0.0" | ||
port = 19999 |
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,57 @@ | ||
pkg_name=gatekeeper-netdata | ||
pkg_origin=jarvus | ||
pkg_version=1.17.0 | ||
pkg_maintainer="Chris Alfano <[email protected]>" | ||
pkg_license=("MIT") | ||
pkg_build_deps=( | ||
jarvus/toml-merge | ||
) | ||
pkg_wrapped_ident="emergence/netdata" | ||
pkg_deps=( | ||
core/bash | ||
"${pkg_wrapped_ident}" | ||
) | ||
|
||
pkg_exports=( | ||
[host]=server.address | ||
[port]=server.port | ||
) | ||
pkg_exposes=(port) | ||
pkg_svc_run="netdata -D -c ${pkg_svc_config_path}/netdata.conf" | ||
|
||
pkg_binds_optional=( | ||
[mysql]="port username password" | ||
[nginx]="port status_path" | ||
[phpfpm]="port status_path" | ||
) | ||
|
||
do_before() { | ||
push_runtime_env NETDATA_PKG_PLUGINS_DIR "${pkg_prefix}/plugins.d" | ||
} | ||
|
||
do_build() { | ||
return 0 | ||
} | ||
|
||
do_install() { | ||
return 0 | ||
} | ||
|
||
do_build_config() { | ||
do_default_build_config | ||
|
||
build_line "Merging config from ${pkg_wrapped_ident}" | ||
cp -nrv "$(pkg_path_for ${pkg_wrapped_ident})"/{config,hooks} "${pkg_prefix}/" | ||
toml-merge \ | ||
"$(pkg_path_for ${pkg_wrapped_ident})/default.toml" \ | ||
"${PLAN_CONTEXT}/default.toml" \ | ||
> "${pkg_prefix}/default.toml" | ||
|
||
build_line "Copying local plugins.d" | ||
cp -rv "${PLAN_CONTEXT}/plugins.d" "${pkg_prefix}/" | ||
fix_interpreter "${pkg_prefix}/plugins.d/*" core/bash bin/bash | ||
} | ||
|
||
do_strip() { | ||
return 0 | ||
} |
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,65 @@ | ||
#!/bin/bash | ||
|
||
# TODO: move gk-specific charts somewhere additional | ||
# TODO: add top-users chart | ||
|
||
# load netdata plugin config | ||
if [ -f "${NETDATA_USER_CONFIG_DIR}/emergence.conf" ]; then | ||
set -a | ||
. "${NETDATA_USER_CONFIG_DIR}/emergence.conf" | ||
set +a | ||
fi | ||
|
||
|
||
# define CACHE_STATUS chart | ||
echo "CHART gatekeeper.cache_status '' 'Gatekeeper Cache' B 'Gatekeeper' cache stacked 1" | ||
echo "DIMENSION application '' absolute" | ||
echo "DIMENSION responses '' absolute" | ||
echo "DIMENSION free '' absolute" | ||
declare -A CACHE_STATUS | ||
|
||
|
||
# define ENDPOINT_REQUESTS chart | ||
echo "CHART gatekeeper.endpoint_requests '' 'Endpoint Requests' 'requests/hr' 'Gatekeeper' endpoint_requests stacked 2" | ||
declare -A ENDPOINT_REQUESTS_DIMENSIONS | ||
|
||
|
||
# update all charts indefinitely | ||
while true; do | ||
|
||
|
||
# update CACHE_STATUS | ||
while read -r line; do | ||
key="${line%%$'\t'*}" | ||
value="${line#*$'\t'}" | ||
CACHE_STATUS["${key}"]="${value}" | ||
done < <(env -i HAB_LICENSE="${HAB_LICENSE}" hab pkg exec "${EMERGENCE_RUNTIME:-emergence/php-runtime}" emergence-console-run gk:health:cache) | ||
|
||
echo "BEGIN gatekeeper.cache_status" | ||
echo "SET application=${CACHE_STATUS[application]}" | ||
echo "SET responses=${CACHE_STATUS[responses]}" | ||
echo "SET free=${CACHE_STATUS[free]}" | ||
echo "END" | ||
|
||
|
||
# update ENDPOINT_REQUESTS | ||
echo "BEGIN gatekeeper.endpoint_requests" | ||
|
||
while read -r line; do | ||
key="${line%%$'\t'*}" | ||
value="${line#*$'\t'}" | ||
|
||
if [[ ! -v ENDPOINT_REQUESTS_DIMENSIONS["${key}"] ]]; then | ||
echo "DIMENSION ${key} '' absolute" | ||
ENDPOINT_REQUESTS_DIMENSIONS["${key}"]='printed' | ||
fi | ||
|
||
echo "SET ${key}=${value}" | ||
done < <(env -i HAB_LICENSE="${HAB_LICENSE}" hab pkg exec "${EMERGENCE_RUNTIME:-emergence/php-runtime}" emergence-console-run gk:health:endpoint-requests) | ||
|
||
echo "END" | ||
|
||
|
||
# wait netdata-provided amount of time until next exec | ||
sleep "${NETDATA_UPDATE_EVERY:-1}" | ||
done |
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
7 changes: 1 addition & 6 deletions
7
...config/Emergence/People/Person.config.php → ...eople/Person.config.d/gatekeeper-keys.php
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 |
---|---|---|
@@ -1,12 +1,7 @@ | ||
<?php | ||
|
||
Emergence\People\Person::$relationships['Subscriptions'] = [ | ||
'type' => 'one-many', | ||
'class' => Gatekeeper\Endpoints\Subscription::class | ||
]; | ||
|
||
Emergence\People\Person::$relationships['Keys'] = [ | ||
'type' => 'many-many', | ||
'class' => Gatekeeper\Keys\Key::class, | ||
'linkClass' => Gatekeeper\Keys\KeyUser::class | ||
]; | ||
]; |
6 changes: 6 additions & 0 deletions
6
php-config/Emergence/People/Person.config.d/gatekeeper-subscriptions.php
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,6 @@ | ||
<?php | ||
|
||
Emergence\People\Person::$relationships['Subscriptions'] = [ | ||
'type' => 'one-many', | ||
'class' => Gatekeeper\Endpoints\Subscription::class | ||
]; |
10 changes: 10 additions & 0 deletions
10
php-config/Gatekeeper/ApiRequestHandler.config.d/source-interface.php
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,10 @@ | ||
<?php | ||
|
||
/** | ||
* Change the network interface that Gatekeeper makes requests from | ||
* | ||
* - `false`: no override (let cURL choose) | ||
* - `null`: override automatically (use HTTP_HOST) | ||
* - String: any IP or hostname | ||
*/ | ||
Gatekeeper\ApiRequestHandler::$sourceInterface = false; |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
<?php | ||
|
||
/** | ||
* One or more hostnames to automatically prepend /api/ to requests for | ||
*/ | ||
// Gatekeeper\Gatekeeper::$apiHostname = [ | ||
// 'api.example.com' | ||
// ]; |
6 changes: 6 additions & 0 deletions
6
php-config/Gatekeeper/Gatekeeper.config.d/portal-hostname.php
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,6 @@ | ||
<?php | ||
|
||
/** | ||
* Hostname for generating links to public portal | ||
*/ | ||
// Gatekeeper\Gatekeeper::$portalHostname = 'developer.example.com'; |
This file was deleted.
Oops, something went wrong.