This repository has been archived by the owner on May 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Example-FullElasticKibana.ps1
137 lines (111 loc) · 4.06 KB
/
Example-FullElasticKibana.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
configuration TestConfig
{
#####
#Configure locations for downloads and installs of JRE, Elasticsearch, NSSM and Kibana
#####
$installRoot = 'c:\elkInstall\'
$downloadroot = 'c:\elkTempDownload\'
$elasticZipLocation = Join-Path $downloadroot 'elastic.zip'
$elasticUnpacked = Join-Path $installRoot 'elasticsearch'
$elasticDownloadUri = 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.zip'
$kibanaZipLocation = Join-Path $downloadroot 'kibana.zip'
$kibanaUnpacked = Join-Path $installRoot 'kibana'
$kibanaDownloadUri = 'https://download.elasticsearch.org/kibana/kibana/kibana-4.0.1-windows.zip'
$javaZipLocation = Join-Path $downloadroot 'jre.tar.gz'
$javaUnpackLocation = Join-Path $installRoot 'jre'
$javaFolder = Join-Path $javaUnpackLocation 'jdk1.8.0_45'
$javaDownloadUri = 'http://download.oracle.com/otn-pub/java/jdk/8u45-b15/server-jre-8u45-windows-x64.tar.gz'
$nssmZipLocation = Join-Path $downloadroot 'nssm.zip'
$nssmUnpackLocation = Join-Path $installRoot 'nssmkibana'
$nssmDownloadUri = 'https://nssm.cc/release/nssm-2.24.zip'
Import-DscResource -Module cGripDevDSC
node ("localhost")
{
LocalConfigurationManager
{
DebugMode = 'ForceModuleImport'
}
#####
#Downlaod and set env variable for JRE
#####
cSimpleDownloader JREDownload
{
DestinationPath = $javaZipLocation
RemoteFileLocation = $javaDownloadUri
CookieName = "oraclelicense"
CookieValue = "accept-securebackup-cookie"
CookieDomain = ".oracle.com"
}
c7zip JREUnzip
{
DependsOn = "[cSimpleDownloader]JREDownload"
ZipFileLocation = $javaZipLocation
UnzipFolder = $javaUnpackLocation
}
Environment SetJREEnviromentVar
{
Name = "JAVA_HOME"
Ensure = "Present"
Path = $false
Value = $javaFolder
DependsOn = "[c7zip]JREUnzip"
}
#####
#Download and install elasticsearch
#####
cSimpleDownloader ElasticDownloadZip
{
DestinationPath = $elasticZipLocation
RemoteFileLocation = $elasticDownloadUri
}
c7zip ElasticUnzip
{
DependsOn = "[cSimpleDownloader]ElasticDownloadZip"
ZipFileLocation = $elasticZipLocation
UnzipFolder = $elasticUnpacked
}
cElasticsearch ElasticInstall
{
DependsOn = @('[Environment]SetJREEnviromentVar', '[c7zip]ElasticUnzip')
UnzipFolder = $elasticUnpacked
}
#####
# Downlaod and Install Kibana, using nssm to host as windows service
# Default Port: 5601
#####
cSimpleDownloader NSSMDownloadZip
{
DestinationPath = $nssmZipLocation
RemoteFileLocation = $nssmDownloadUri
DependsOn = "[cElasticsearch]ElasticInstall"
}
c7zip NSSMExtractForKibana
{
ZipFileLocation = $nssmZipLocation
UnzipFolder = $nssmUnpackLocation
DependsOn = "[cSimpleDownloader]NSSMDownloadZip"
}
cSimpleDownloader KibanaDownloadZip
{
DestinationPath = $kibanaZipLocation
RemoteFileLocation = $kibanaDownloadUri
DependsOn = "[cElasticsearch]ElasticInstall"
}
c7zip KibanaUnzip
{
DependsOn = "[cSimpleDownloader]KibanaDownloadZip"
ZipFileLocation = $kibanaZipLocation
UnzipFolder = $kibanaUnpacked
}
cNssm KibanaInstall
{
DependsOn = @('[c7zip]KibanaUnzip', '[c7zip]NSSMExtractForKibana')
ExeFolder = $kibanaUnpacked
NssmFolder = $nssmUnpackLocation
ServiceName = 'KibanaNSSM'
ExeOrBatName = 'kibana.bat'
}
}
}
TestConfig
Start-DscConfiguration .\TestConfig -wait -verbose -force