forked from mogikanen9/blog-demo-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Docker with ubuntu16.04+statsd dependencies * removed jdk, get statsd sources, build and install statsd * fix docker file, add init config for statsd * init setup * init setup of api client page * zulu proxy enabled, client calls proxy url * hystrix dashboard added and enabled * split project into proxy and service
- Loading branch information
1 parent
8c5fd92
commit b6ea986
Showing
24 changed files
with
1,603 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Download base image ubuntu18.04 | ||
FROM ubuntu:16.04 | ||
|
||
# Add Maintainer Info | ||
LABEL maintainer="mogikanensoftware@gmail.com" | ||
|
||
# Update Ubuntu Software repository | ||
RUN apt-get -y update | ||
|
||
RUN apt-get install -y curl && curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
|
||
# Install StatsD dependencied | ||
RUN apt-get install -y git nodejs | ||
|
||
# Checkout statsd sources | ||
RUN cd /tmp && git clone https://github.com/etsy/statsd.git | ||
|
||
COPY ./myConfig.js /tmp/statsd | ||
|
||
# Start statsd from sources | ||
ENTRYPOINT ["node","/tmp/statsd/stats.js","/tmp/statsd/myConfig.js"] |
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,127 @@ | ||
/* | ||
Graphite Required Variable: | ||
(Leave this unset to avoid sending stats to Graphite. | ||
Set debug flag and leave this unset to run in 'dry' debug mode - | ||
useful for testing statsd clients without a Graphite server.) | ||
graphiteHost: hostname or IP of Graphite server | ||
Optional Variables: | ||
graphitePort: port for the graphite text collector [default: 2003] | ||
graphitePicklePort: port for the graphite pickle collector [default: 2004] | ||
graphiteProtocol: either 'text' or 'pickle' [default: 'text'] | ||
backends: an array of backends to load. Each backend must exist | ||
by name in the directory backends/. If not specified, | ||
the default graphite backend will be loaded. | ||
* example for console and graphite: | ||
[ "./backends/console", "./backends/graphite" ] | ||
servers: an array of server configurations. | ||
If not specified, the server, address, | ||
address_ipv6, and port top-level configuration | ||
options are used to configure a single server for | ||
backwards-compatibility | ||
Each server configuration supports the following keys: | ||
server: the server to load. The server must exist by name in the directory | ||
servers/. If not specified, the default udp server will be loaded. | ||
* example for tcp server: | ||
"./servers/tcp" | ||
address: address to listen on [default: 0.0.0.0] | ||
address_ipv6: defines if the address is an IPv4 or IPv6 address [true or false, default: false] | ||
port: port to listen for messages on [default: 8125] | ||
socket: (only for tcp servers) path to unix domain socket which will be used to receive | ||
metrics [default: undefinded] | ||
socket_mod: (only for tcp servers) file mode which should be applied to unix domain socket, relevant | ||
only if socket option is used [default: undefined] | ||
debug: debug flag [default: false] | ||
mgmt_address: address to run the management TCP interface on | ||
[default: 0.0.0.0] | ||
mgmt_port: port to run the management TCP interface on [default: 8126] | ||
title: Allows for overriding the process title. [default: statsd] | ||
if set to false, will not override the process title and let the OS set it. | ||
The length of the title has to be less than or equal to the binary name + cli arguments | ||
NOTE: This does not work on Mac's with node versions prior to v0.10 | ||
healthStatus: default health status to be returned and statsd process starts ['up' or 'down', default: 'up'] | ||
dumpMessages: log all incoming messages | ||
flushInterval: interval (in ms) to flush metrics to each backend | ||
percentThreshold: for time information, calculate the Nth percentile(s) | ||
(can be a single value or list of floating-point values) | ||
negative values mean to use "top" Nth percentile(s) values | ||
[%, default: 90] | ||
flush_counts: send stats_counts metrics [default: true] | ||
keyFlush: log the most frequently sent keys [object, default: undefined] | ||
interval: how often to log frequent keys [ms, default: 0] | ||
percent: percentage of frequent keys to log [%, default: 100] | ||
log: location of log file for frequent keys [default: STDOUT] | ||
deleteIdleStats: don't send values to graphite for inactive counters, sets, gauges, or timers | ||
as opposed to sending 0. For gauges, this unsets the gauge (instead of sending | ||
the previous value). Can be individually overriden. [default: false] | ||
deleteGauges: don't send values to graphite for inactive gauges, as opposed to sending the previous value [default: false] | ||
deleteTimers: don't send values to graphite for inactive timers, as opposed to sending 0 [default: false] | ||
deleteSets: don't send values to graphite for inactive sets, as opposed to sending 0 [default: false] | ||
deleteCounters: don't send values to graphite for inactive counters, as opposed to sending 0 [default: false] | ||
prefixStats: prefix to use for the statsd statistics data for this running instance of statsd [default: statsd] | ||
applies to both legacy and new namespacing | ||
keyNameSanitize: sanitize all stat names on ingress [default: true] | ||
If disabled, it is up to the backends to sanitize keynames | ||
as appropriate per their storage requirements. | ||
console: | ||
prettyprint: whether to prettyprint the console backend | ||
output [true or false, default: true] | ||
log: log settings [object, default: undefined] | ||
backend: where to log: stdout or syslog [string, default: stdout] | ||
application: name of the application for syslog [string, default: statsd] | ||
level: log level for [node-]syslog [string, default: LOG_INFO] | ||
graphite: | ||
legacyNamespace: use the legacy namespace [default: true] | ||
globalPrefix: global prefix to use for sending stats to graphite [default: "stats"] | ||
prefixCounter: graphite prefix for counter metrics [default: "counters"] | ||
prefixTimer: graphite prefix for timer metrics [default: "timers"] | ||
prefixGauge: graphite prefix for gauge metrics [default: "gauges"] | ||
prefixSet: graphite prefix for set metrics [default: "sets"] | ||
globalSuffix: global suffix to use for sending stats to graphite [default: ""] | ||
This is particularly useful for sending per host stats by | ||
settings this value to: require('os').hostname().split('.')[0] | ||
repeater: an array of hashes of the for host: and port: | ||
that details other statsd servers to which the received | ||
packets should be "repeated" (duplicated to). | ||
e.g. [ { host: '10.10.10.10', port: 8125 }, | ||
{ host: 'observer', port: 88125 } ] | ||
repeaterProtocol: whether to use udp4, udp6, or tcp for repeaters. | ||
["udp4," "udp6", or "tcp" default: "udp4"] | ||
histogram: for timers, an array of mappings of strings (to match metrics) and | ||
corresponding ordered non-inclusive upper limits of bins. | ||
For all matching metrics, histograms are maintained over | ||
time by writing the frequencies for all bins. | ||
'inf' means infinity. A lower limit of 0 is assumed. | ||
default: [], meaning no histograms for any timer. | ||
First match wins. examples: | ||
* histogram to only track render durations, with unequal | ||
class intervals and catchall for outliers: | ||
[ { metric: 'render', bins: [ 0.01, 0.1, 1, 10, 'inf'] } ] | ||
* histogram for all timers except 'foo' related, | ||
equal class interval and catchall for outliers: | ||
[ { metric: 'foo', bins: [] }, | ||
{ metric: '', bins: [ 50, 100, 150, 200, 'inf'] } ] | ||
automaticConfigReload: whether to watch the config file and reload it when it | ||
changes. The default is true. Set this to false to disable. | ||
*/ | ||
{ | ||
graphitePort: 2003 | ||
, graphiteHost: "graphite.example.com" | ||
, port: 8125 | ||
, backends: [ "./backends/graphite" ] | ||
} | ||
|
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 @@ | ||
docker run --name graphite -p 80:80 -p 8125:8125/udp -p 8126:8126 graphiteapp/graphite-statsd |
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,31 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/** | ||
!**/src/test/** | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
114 changes: 114 additions & 0 deletions
114
rest-api-proxy/greetings-service/.mvn/wrapper/MavenWrapperDownloader.java
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,114 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.channels.Channels; | ||
import java.nio.channels.ReadableByteChannel; | ||
import java.util.Properties; | ||
|
||
public class MavenWrapperDownloader { | ||
|
||
/** | ||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. | ||
*/ | ||
private static final String DEFAULT_DOWNLOAD_URL = | ||
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; | ||
|
||
/** | ||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to | ||
* use instead of the default one. | ||
*/ | ||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = | ||
".mvn/wrapper/maven-wrapper.properties"; | ||
|
||
/** | ||
* Path where the maven-wrapper.jar will be saved to. | ||
*/ | ||
private static final String MAVEN_WRAPPER_JAR_PATH = | ||
".mvn/wrapper/maven-wrapper.jar"; | ||
|
||
/** | ||
* Name of the property which should be used to override the default download url for the wrapper. | ||
*/ | ||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; | ||
|
||
public static void main(String args[]) { | ||
System.out.println("- Downloader started"); | ||
File baseDirectory = new File(args[0]); | ||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); | ||
|
||
// If the maven-wrapper.properties exists, read it and check if it contains a custom | ||
// wrapperUrl parameter. | ||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); | ||
String url = DEFAULT_DOWNLOAD_URL; | ||
if(mavenWrapperPropertyFile.exists()) { | ||
FileInputStream mavenWrapperPropertyFileInputStream = null; | ||
try { | ||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); | ||
Properties mavenWrapperProperties = new Properties(); | ||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); | ||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); | ||
} catch (IOException e) { | ||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); | ||
} finally { | ||
try { | ||
if(mavenWrapperPropertyFileInputStream != null) { | ||
mavenWrapperPropertyFileInputStream.close(); | ||
} | ||
} catch (IOException e) { | ||
// Ignore ... | ||
} | ||
} | ||
} | ||
System.out.println("- Downloading from: : " + url); | ||
|
||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); | ||
if(!outputFile.getParentFile().exists()) { | ||
if(!outputFile.getParentFile().mkdirs()) { | ||
System.out.println( | ||
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); | ||
} | ||
} | ||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); | ||
try { | ||
downloadFileFromURL(url, outputFile); | ||
System.out.println("Done"); | ||
System.exit(0); | ||
} catch (Throwable e) { | ||
System.out.println("- Error downloading"); | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
} | ||
|
||
private static void downloadFileFromURL(String urlString, File destination) throws Exception { | ||
URL website = new URL(urlString); | ||
ReadableByteChannel rbc; | ||
rbc = Channels.newChannel(website.openStream()); | ||
FileOutputStream fos = new FileOutputStream(destination); | ||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); | ||
fos.close(); | ||
rbc.close(); | ||
} | ||
|
||
} |
Binary file not shown.
1 change: 1 addition & 0 deletions
1
rest-api-proxy/greetings-service/.mvn/wrapper/maven-wrapper.properties
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 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip |
Oops, something went wrong.