-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Control Plane API call to put your own custom enrichments in Snow…
…plow Mini (closes #66)
- Loading branch information
1 parent
618964f
commit cd7af1f
Showing
20 changed files
with
619 additions
and
51 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
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
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,4 +1,5 @@ | ||
localhost:2000 { | ||
*:80 { | ||
tls off | ||
basicauth "USERNAME_PLACEHOLDER" PASSWORD_PLACEHOLDER { | ||
/home | ||
/kibana | ||
|
Binary file modified
BIN
-1.5 MB
(83%)
provisioning/resources/control-plane/snowplow-mini-control-plane-api
Binary file not shown.
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
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,58 @@ | ||
#!/bin/bash | ||
|
||
testDir=$1 | ||
testEnv="$testDir/testEnv" | ||
testInit="$testDir/testInit" | ||
|
||
sudo cp $testInit/snowplow_mini_control_plane_api_test_init /etc/init.d/snowplow_mini_control_plane_api | ||
sudo /etc/init.d/snowplow_mini_control_plane_api restart $testDir | ||
sleep 2 | ||
|
||
## restart SP services test | ||
stream_enrich_pid_file=/var/run/snowplow_stream_enrich_0.10.0.pid | ||
stream_collector_pid_file=/var/run/snowplow_stream_collector_0.9.0.pid | ||
sink_bad_pid_file=/var/run/snowplow_elasticsearch_sink_bad_0.8.0-2x.pid | ||
sink_good_pid_file=/var/run/snowplow_elasticsearch_sink_good_0.8.0-2x.pid | ||
|
||
|
||
stream_enrich_pid_old="$(cat "${stream_enrich_pid_file}")" | ||
stream_collector_pid_old="$(cat "${stream_collector_pid_file}")" | ||
sink_bad_pid_old="$(cat "${sink_bad_pid_file}")" | ||
sink_good_pid_old="$(cat "${sink_good_pid_file}")" | ||
|
||
req_result=$(curl -s -o /dev/null -w "%{http_code}" -XPUT http://localhost:10000/restart-services) | ||
|
||
stream_enrich_pid_new="$(cat "${stream_enrich_pid_file}")" | ||
stream_collector_pid_new="$(cat "${stream_collector_pid_file}")" | ||
sink_bad_pid_new="$(cat "${sink_bad_pid_file}")" | ||
sink_good_pid_new="$(cat "${sink_good_pid_file}")" | ||
|
||
if [[ "${req_result}" -eq 200 ]] && | ||
[[ "${stream_enrich_pid_old}" -ne "${stream_enrich_pid_new}" ]] && | ||
[[ "${stream_collector_pid_old}" -ne "${stream_collector_pid_new}" ]] && | ||
[[ "${sink_bad_pid_old}" -ne "${sink_bad_pid_new}" ]] && | ||
[[ "${sink_good_pid_old}" -ne "${sink_good_pid_new}" ]]; then | ||
|
||
echo "Restarting SP services is working correctly." | ||
else | ||
echo "Restarting SP services is not working correctly." | ||
exit 1 | ||
fi | ||
|
||
|
||
## upload enrichment test | ||
upload_enrichments_result=$(curl -s -o /dev/null -w "%{http_code}" --header "Content-Type: multipart/form-data" -F "enrichmentjson=@$testEnv/orgEnrichments/enrich.json" localhost:10000/upload-enrichments) | ||
enrichment_diff=$(diff $testEnv/testEnrichments/enrich.json $testEnv/orgEnrichments/enrich.json) | ||
sleep 2 | ||
|
||
if [[ "${upload_enrichments_result}" -eq 200 ]] && [[ "${enrichment_diff}" == "" ]];then | ||
echo "Uploading enrichment is working correctly." | ||
else | ||
echo "Uploading enrichment is not working correctly." | ||
exit 1 | ||
fi | ||
|
||
sudo cp $testInit/snowplow_mini_control_plane_api_original_init /etc/init.d/snowplow_mini_control_plane_api | ||
sudo /etc/init.d/snowplow_mini_control_plane_api restart | ||
|
||
exit 0 |
37 changes: 37 additions & 0 deletions
37
...ing/resources/control-plane/test/testEnv/expectedConfig/Caddyfile_add_domain_name_tls_off
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,37 @@ | ||
*:80 { | ||
tls off | ||
basicauth "USERNAME_PLACEHOLDER" PASSWORD_PLACEHOLDER { | ||
/home | ||
/kibana | ||
/elasticsearch | ||
/control-plane | ||
/_plugin | ||
} | ||
redir /home /home/ | ||
redir /kibana /kibana/ | ||
redir /iglu-server /iglu-server/ | ||
|
||
proxy / localhost:8080 | ||
|
||
proxy /home localhost:3000 { | ||
without /home | ||
} | ||
|
||
proxy /kibana localhost:5601 { | ||
without /kibana | ||
} | ||
|
||
proxy /iglu-server localhost:8081 { | ||
without /iglu-server | ||
} | ||
proxy /api localhost:8081 | ||
|
||
proxy /elasticsearch localhost:9200 { | ||
without /elasticsearch | ||
} | ||
proxy /_plugin localhost:9200 | ||
|
||
proxy /control-plane localhost:10000 { | ||
without /control-plane | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ning/resources/control-plane/test/testEnv/expectedConfig/Caddyfile_add_domain_name_tls_on
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,37 @@ | ||
test.com *:80 { | ||
tls [email protected] | ||
basicauth "USERNAME_PLACEHOLDER" PASSWORD_PLACEHOLDER { | ||
/home | ||
/kibana | ||
/elasticsearch | ||
/control-plane | ||
/_plugin | ||
} | ||
redir /home /home/ | ||
redir /kibana /kibana/ | ||
redir /iglu-server /iglu-server/ | ||
|
||
proxy / localhost:8080 | ||
|
||
proxy /home localhost:3000 { | ||
without /home | ||
} | ||
|
||
proxy /kibana localhost:5601 { | ||
without /kibana | ||
} | ||
|
||
proxy /iglu-server localhost:8081 { | ||
without /iglu-server | ||
} | ||
proxy /api localhost:8081 | ||
|
||
proxy /elasticsearch localhost:9200 { | ||
without /elasticsearch | ||
} | ||
proxy /_plugin localhost:9200 | ||
|
||
proxy /control-plane localhost:10000 { | ||
without /control-plane | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ng/resources/control-plane/test/testEnv/expectedConfig/Caddyfile_change_username_password
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,37 @@ | ||
*:80 { | ||
tls off | ||
basicauth "test_username" "test_password" { | ||
/home | ||
/kibana | ||
/elasticsearch | ||
/control-plane | ||
/_plugin | ||
} | ||
redir /home /home/ | ||
redir /kibana /kibana/ | ||
redir /iglu-server /iglu-server/ | ||
|
||
proxy / localhost:8080 | ||
|
||
proxy /home localhost:3000 { | ||
without /home | ||
} | ||
|
||
proxy /kibana localhost:5601 { | ||
without /kibana | ||
} | ||
|
||
proxy /iglu-server localhost:8081 { | ||
without /iglu-server | ||
} | ||
proxy /api localhost:8081 | ||
|
||
proxy /elasticsearch localhost:9200 { | ||
without /elasticsearch | ||
} | ||
proxy /_plugin localhost:9200 | ||
|
||
proxy /control-plane localhost:10000 { | ||
without /control-plane | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ing/resources/control-plane/test/testEnv/expectedConfig/iglu-resolver-add-super-uuid.json
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,33 @@ | ||
{ | ||
"schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", | ||
"data": { | ||
"cacheSize": 500, | ||
"repositories": [ | ||
{ | ||
"name": "Iglu Central", | ||
"priority": 1, | ||
"vendorPrefixes": [ | ||
"com.snowplowanalytics" | ||
], | ||
"connection": { | ||
"http": { | ||
"uri": "http://iglucentral.com" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "Iglu Server", | ||
"priority": 0, | ||
"vendorPrefixes": [ | ||
"com.snowplowanalytics" | ||
], | ||
"connection": { | ||
"http": { | ||
"uri": "http://localhost:8081/api", | ||
"apikey": "04577adf-6dce-49d7-8cbb-0ffdf83304de" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.