forked from gwenshap/ops_training_vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
38 lines (30 loc) · 2.22 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
#!/usr/bin/env bash
sudo rpm --import http://packages.confluent.io/rpm/1.0/archive.key
sudo cp /vagrant/configfiles/confluent.repo /etc/yum.repos.d/
sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel confluent-platform-2.10.4 graphite-web python-carbon python-pip python-yaml
sudo service iptables stop
sudo chkconfig iptables off
# patch a small bug that prevented us from getting logs:
sed "s/^\s*KAFKA_LOG4J_OPTS/export KAFKA_LOG4J_OPTS/" </usr/bin/kafka-server-start > temp_start_script
sudo cp temp_start_script /usr/bin/kafka-server-start
sudo zookeeper-server-start -daemon /etc/kafka/zookeeper.properties
sudo JMX_PORT=9990 LOG_DIR=/var/log/kafka0 kafka-server-start -daemon /vagrant/configfiles/server0.properties
sudo JMX_PORT=9991 LOG_DIR=/var/log/kafka1 kafka-server-start -daemon /vagrant/configfiles/server1.properties
sudo JMX_PORT=9992 LOG_DIR=/var/log/kafka2 kafka-server-start -daemon /vagrant/configfiles/server2.properties
# the startup scripts here don't properly daemonize, so I need to do it here
sudo nohup schema-registry-start /etc/schema-registry/schema-registry.properties </dev/null &>/dev/null &
sudo nohup kafka-rest-start /etc/kafka-rest/kafka-rest.properties </dev/null &>/dev/null &
sudo /usr/lib/python2.6/site-packages/graphite/manage.py syncdb --noinput
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '[email protected]', 'hunter2')" | sudo /usr/lib/python2.6/site-packages/graphite/manage.py shell
sudo service carbon-cache start
sudo chkconfig carbon-cache on
sudo pip install gunicorn
sudo mkdir /var/run/gunicorn-graphite
sudo mkdir /var/log/gunicorn-graphite
sudo nohup gunicorn_django --bind=0.0.0.0:8000 --log-file=/var/log/gunicorn-graphite/gunicorn.log --preload --pythonpath=/usr/lib/python2.6/site-packages/graphite --settings=settings --workers=3 --pid=/var/run/gunicorn-graphite/gunicorn-graphite.pid </dev/null &>/dev/null &
wget http://central.maven.org/maven2/org/jmxtrans/jmxtrans/251/jmxtrans-251.rpm
sudo yum -y install jmxtrans-251.rpm
yaml2jmxtrans /vagrant/configfiles/kafka.yaml
sudo cp kafka_prod.json /var/lib/jmxtrans/
sudo service jmxtrans start