Skip to content

Commit a17eca4

Browse files
author
Felix Barnsteiner
committed
Initial commit
0 parents  commit a17eca4

12 files changed

Lines changed: 403 additions & 0 deletions

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto eol=lf
2+
*.sh eol=lf
3+
gradlew eol=lf
4+
*.bat eol=crlf
5+
*.so binary
6+
*.dll binary
7+
*.dylib binary
8+
*.png binary
9+
*.ttf binary
10+
*.jar binary

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Init Elasticsearch and Kibana
2+
3+
This program initializes the required Elasticsearch indices and populates Kibana dashboards.
4+
5+
It is intended to be used in more restricted environments where X-Pack security is enabled and the agents should not be
6+
allowed to create index patterns and dashboards.
7+
8+
If you are not operating in such an environment, you don't need this program.
9+
10+
## Usage
11+
12+
### 1. Clone this repo
13+
14+
```
15+
git clone https://github.com/stagemonitor/stagemonitor-elasticsearch-init.git
16+
cd stagemonitor-elasticsearch-init
17+
```
18+
19+
### 2. Adjust stagemonitor version
20+
21+
Open `gradle.properties` and set the property `stagemonitorVersion` to the version of stagemonitor you are actually using.
22+
Note that the minimum Version is 0.87.0.
23+
24+
### 3. Adjust optional plug-ins
25+
26+
Open `build.gradle` and include the optional plug-ins you are using.
27+
28+
### 4. Make sure Elasticsearch and Kibana is started
29+
30+
Open the Kibana status page in the browser (default ist [http://localhost:5601/status](http://localhost:5601/status))
31+
and make sure the status is green.
32+
33+
### 5. Execute initialization program
34+
35+
Unix:
36+
```
37+
./gradlew run -Purl=http://user:pwd@localhost:9200
38+
```
39+
40+
Windows:
41+
```
42+
gradlew.bat run -Purl=http://user:pwd@localhost:9200
43+
44+
```
45+
46+
Adjust the url argument according to your environment.
47+
48+
## Q&A
49+
50+
Q: I can't execute the script because it wants to download artifacts from maven central and that's not permitted because of
51+
firewall rules.
52+
53+
A: Build the distribution on a host with unrestricted access to the internet: Execute `./gradlew assembleDist`.
54+
In the directory `build/distributions` you will find a `zip` and `tar` file which contain all dependencies.
55+
Extract either the `zip` or `tar` file on the target host and execute `bin/stagemonitor-elasticsearch-init` (Unix) or `bin/stagemonitor-elasticsearch-init.bat` (Windows)
56+
57+
Q: I don't want to specify the Elasticsearch url as a command line argument as it would leak the credentials in the console history
58+
59+
A: Add the url in `stagemonitor-elasticsearch-init/gradle.properties` or `~/.gradle/gradle.properties`

build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
group 'org.stagemonitor'
2+
version '1.0'
3+
4+
apply plugin: 'java'
5+
apply plugin: 'application'
6+
7+
sourceCompatibility = 1.8
8+
9+
repositories {
10+
mavenCentral()
11+
mavenLocal()
12+
}
13+
14+
run {
15+
mainClassName = "org.stagemonitor.init.InitElasticsearch"
16+
if (project.hasProperty("url")) {
17+
args += url
18+
}
19+
}
20+
21+
dependencies {
22+
compile "org.slf4j:slf4j-simple:1.7.25"
23+
compile 'javax.servlet:javax.servlet-api:3.0.1'
24+
compile 'net.sf.ehcache:ehcache-core:2.5.1'
25+
26+
compile "org.stagemonitor:stagemonitor-web-servlet:$stagemonitorVersion"
27+
compile "org.stagemonitor:stagemonitor-tracing-elasticsearch:$stagemonitorVersion"
28+
29+
// optional plug-ins
30+
// compile "org.stagemonitor:stagemonitor-os:$stagemonitorVersion"
31+
// compile "org.stagemonitor:stagemonitor-alerting:$stagemonitorVersion"
32+
// compile "org.stagemonitor:stagemonitor-ehcache:$stagemonitorVersion"
33+
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
stagemonitorVersion=0.87.0
2+
#url=http://user:pwd@localhost:9200

gradle/wrapper/gradle-wrapper.jar

53.1 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Tue Jan 16 08:45:08 CET 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)