-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·175 lines (136 loc) · 6.73 KB
/
bootstrap.sh
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
ECHO_PREFIX="\e[1m\e[97m[\e[34mVagrant\e[97m]\e[0m"
echo -e "$ECHO_PREFIX Will work in /tmp"
cd /tmp
echo -e "$ECHO_PREFIX Set Europe/Paris as default timezone"
rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
echo -e "$ECHO_PREFIX Add Elasticsearch & Logstash APT repository"
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
mkdir -p /etc/apt/sources.list.d
echo 'deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main' >> /etc/apt/sources.list.d/elasticsearch.list
echo 'deb http://packages.elasticsearch.org/logstash/1.4/debian stable main' >> /etc/apt/sources.list.d/logstash.list
echo -e "$ECHO_PREFIX Update APT packages index"
apt-get -qq update
echo -e "$ECHO_PREFIX Update APT system packages"
apt-get -y -qq upgrade
echo -e "$ECHO_PREFIX Install curl"
apt-get -y -qq install curl
echo -e "$ECHO_PREFIX Download Sun JDK 8 x64"
curl -s -L -C - -b "oraclelicense=accept-securebackup-cookie" -O http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz
echo -e "$ECHO_PREFIX Unzip JDK"
tar xzf jdk-8u31-linux-x64.tar.gz -C /opt
ln -s /opt/jdk1.8.0_31 /opt/jdk
rm -f jdk-8u31-linux-x64.tar.gz
echo -e "$ECHO_PREFIX Set as default java"
update-alternatives --install "/usr/bin/java" "java" "/opt/jdk/bin/java" 2000
update-alternatives --set java /opt/jdk/bin/java
update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk/bin/javac" 2000
update-alternatives --set javac /opt/jdk/bin/javac
#echo -e "$ECHO_PREFIX Fix libjvm.so not found"
ln -s /opt/jdk/jre/lib/amd64/server/libjvm.so /usr/lib/libjvm.so
#echo -e "$ECHO_PREFIX Install Collectd"
apt-get -y -qq install collectd
update-rc.d collectd defaults
echo -e "$ECHO_PREFIX Configure Collectd"
cp /vagrant/collectd.conf /etc/collectd/
echo -e "$ECHO_PREFIX Add Collectd custom types"
echo "jmx_memory value:GAUGE:0:U" >> /usr/share/collectd/types.db
echo -e "$ECHO_PREFIX Restart Collectd"
/etc/init.d/collectd restart
echo -e "$ECHO_PREFIX Install Elasticsearch"
apt-get -y -qq install elasticsearch
update-rc.d elasticsearch defaults 95 10
echo -e "$ECHO_PREFIX Configure Elasticsearch"
echo 'JDK_DIRS="/opt/jdk"' >> /etc/default/elasticsearch
echo 'JAVA_HOME="/opt/jdk"' >> /etc/default/elasticsearch
echo 'http.cors.enabled: true' >> /etc/elasticsearch/elasticsearch.yml
echo -e "$ECHO_PREFIX Install Elasticsearch HQ plugin"
/usr/share/elasticsearch/bin/plugin -s -i royrusso/elasticsearch-HQ
echo -e "$ECHO_PREFIX Install Elasticsearch bigdesk plugin"
/usr/share/elasticsearch/bin/plugin -s -i lukas-vlcek/bigdesk
echo -e "$ECHO_PREFIX Install Elasticsearch head plugin"
/usr/share/elasticsearch/bin/plugin -s -i mobz/elasticsearch-head
echo -e "$ECHO_PREFIX Install Elasticsearch kopf plugin"
/usr/share/elasticsearch/bin/plugin -s -i lmenezes/elasticsearch-kopf
echo -e "$ECHO_PREFIX Install Elasticsearch paramedic plugin"
/usr/share/elasticsearch/bin/plugin -s -i karmi/elasticsearch-paramedic
echo -e "$ECHO_PREFIX Start Elasticsearch"
/etc/init.d/elasticsearch restart
echo -e "$ECHO_PREFIX Install NGiNX"
apt-get -y -qq install nginx
update-rc.d nginx defaults
echo -e "$ECHO_PREFIX Restart NGiNX"
/etc/init.d/nginx restart
echo -e "$ECHO_PREFIX Install Kibana 3"
curl -O https://download.elasticsearch.org/kibana/kibana/kibana-3.1.2.tar.gz
tar xzf kibana-3.1.2.tar.gz
mv kibana-3.1.2 /usr/share/nginx/www/kibana
rm kibana-3.1.2.tar.gz
echo -e "$ECHO_PREFIX Configure Kibana 3"
cp /vagrant/kibana3.config.js /usr/share/nginx/www/kibana/config.js
echo -e "$ECHO_PREFIX Install Kibana 3 dashboards"
cp /vagrant/dashboard.collectd.json /usr/share/nginx/www/kibana/app/dashboards/collectd.json
cp /vagrant/dashboard.system.json /usr/share/nginx/www/kibana/app/dashboards/system.json
cp /vagrant/dashboard.jmx.json /usr/share/nginx/www/kibana/app/dashboards/jmx.json
cp /vagrant/dashboard.market.json /usr/share/nginx/www/kibana/app/dashboards/market.json
cp /vagrant/dashboard.board.json /usr/share/nginx/www/kibana/app/dashboards/board.json
echo -e "$ECHO_PREFIX Install Kibana 4 dashboards"
cp -r /vagrant/kibana4_es_config /var/lib/elasticsearch/
chown -R elasticsearch:elasticsearch /var/lib/elasticsearch/kibana4_es_config
curl -XPUT 'localhost:9200/_snapshot/es_backup' -d '{
"type": "fs",
"settings": {
"location": "/var/lib/elasticsearch/kibana4_es_config",
"compress": true
}
}'
curl -XPOST 'localhost:9200/_snapshot/es_backup/snapshot_1/_restore'
echo -e "$ECHO_PREFIX Install Kibana 4"
curl -O https://download.elasticsearch.org/kibana/kibana/kibana-4.0.1-linux-x64.tar.gz
tar xzf kibana-4.0.1-linux-x64.tar.gz -C /opt
ln -s /opt/kibana-4.0.1-linux-x64 /opt/kibana
rm -f kibana-4.0.1-linux-x64.tar.gz
echo -e "$ECHO_PREFIX Install Kibana 4 startup script"
cp /vagrant/kibana.initd.sh /etc/init.d/kibana
mkdir -p /var/log/kibana
chmod a+x /etc/init.d/kibana
update-rc.d kibana defaults 96 11
/etc/init.d/kibana start
echo -e "$ECHO_PREFIX Install Logstash"
apt-get -y -qq install logstash
update-rc.d logstash defaults
echo -e "$ECHO_PREFIX Configure Logstash"
cp /vagrant/*.logstash.conf /etc/logstash/conf.d
cp -r /vagrant/patterns /etc/logstash
echo -e "$ECHO_PREFIX Start Logstash"
/etc/init.d/logstash restart
echo -e "$ECHO_PREFIX Install Log Generator"
mkdir -p /opt/log-generator /var/log/log-generator
cp /vagrant/log-generator.jar /opt/log-generator
cp /vagrant/log-generator.initd.sh /etc/init.d/log-generator
chmod a+x /etc/init.d/log-generator
update-rc.d log-generator defaults
echo -e "$ECHO_PREFIX Start Log Generator"
/etc/init.d/log-generator start
echo -e "$ECHO_PREFIX Thank you for your patience"
echo -e "$ECHO_PREFIX"
echo -e "$ECHO_PREFIX Elasticsearch is available at:"
echo -e "$ECHO_PREFIX * http://localhost:19200"
echo -e "$ECHO_PREFIX * http://localhost:19200/_plugin/HQ"
echo -e "$ECHO_PREFIX * http://localhost:19200/_plugin/bigdesk"
echo -e "$ECHO_PREFIX * http://localhost:19200/_plugin/head"
echo -e "$ECHO_PREFIX * http://localhost:19200/_plugin/kopf"
echo -e "$ECHO_PREFIX * http://localhost:19200/_plugin/paramedic"
echo -e "$ECHO_PREFIX"
echo -e "$ECHO_PREFIX Kibana 3 is available at:"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana/index.html#/dashboard/file/collectd.json"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana/index.html#/dashboard/file/system.json"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana/index.html#/dashboard/file/jmx.json"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana/index.html#/dashboard/file/market.json"
echo -e "$ECHO_PREFIX * http://localhost:10080/kibana/index.html#/dashboard/file/board.json"
echo -e "$ECHO_PREFIX"
echo -e "$ECHO_PREFIX Kibana 4 is available at:"
echo -e "$ECHO_PREFIX * http://localhost:15601"