This file contains hidden or 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
####### PLUGIN, SERVICE-ACCOUNT AND RESTART ELASTICSEARCH ######## | |
systemctl enable elasticsearch.service | |
cd /usr/share/elasticsearch | |
sudo ./bin/elasticsearch-plugin install repository-gcs -b | |
echo ${gcp_sa} | base64 -d > credentials.json | |
sudo ./bin/elasticsearch-keystore add-file gcs.client.default.credentials_file credentials.json -s | |
systemctl restart elasticsearch.service |
This file contains hidden or 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
############# APPEND TO JVM CONFIGURATION FILE #################### | |
echo "-Xms4g" >> /etc/elasticsearch/jvm.options | |
echo "-Xmx4g" >> /etc/elasticsearch/jvm.options |
This file contains hidden or 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
node_name = var.master_node, | |
network_host = var.node_ips[0], | |
elastic_host_1 = var.node_ips[0], | |
elastic_host_2 = var.node_ips[1], | |
elastic_host_3 = var.node_ips[2], | |
master_node = var.master_node, | |
ca_bucket = var.ca_bucket_location, | |
backup_bucket = var.backup_bucket, | |
gcp_sa = google_service_account_key.mykey.private_key, | |
elastic_pw = var.elastic_pw, |
This file contains hidden or 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
############### CERTIFICATES FOR KIBANA ############## | |
gsutil cp "${ca_bucket}http.p12" /etc/kibana | |
gsutil cp "${ca_bucket}elasticsearch-ca.pem" /etc/kibana | |
chmod 777 /etc/kibana/http.p12 | |
chmod 777 /etc/kibana/elasticsearch-ca.pem | |
chmod 777 /etc/ssl/certs/elasticsearch-ca.pem | |
cp /etc/kibana/elasticsearch-ca.pem /etc/ssl/certs | |
touch /var/log/kibana.log | |
sudo chmod 777 /var/log/kibana.log |
This file contains hidden or 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
############## APPEND TO KIBANA CONFIGURATION FILE ############ | |
cat <<EOT >> /etc/kibana/kibana.yml | |
elasticsearch.hosts: ['https://${internal_lb_ip}:9200'] | |
server.name: my-elastic-kibana | |
server.host: 0.0.0.0 | |
server.port: 8080 | |
kibana.index: .kibanana | |
logging.dest: /var/log/kibana.log | |
logging.verbose: true | |
csp.strict: true |
This file contains hidden or 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
###################### START KIBANA ########################## | |
sudo systemctl daemon-reload | |
sudo systemctl enable kibana.service | |
sudo systemctl start kibana.service |
This file contains hidden or 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
################## CONFIGURE FILEBEAT ####################### | |
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-x.x.x-amd64.deb // Replace x.x.x with version | |
sudo dpkg -i filebeat-x.x.x-amd64.deb // Replace x.x.x with version | |
sudo filebeat keystore create | |
echo "${elastic_pw}" | sudo bin/filebeat keystore add ES_PASSWORD | |
cat <<EOT >> /etc/filebeat/filebeat.yml | |
output.elasticsearch: | |
hosts: ['https://${internal_lb_ip}:9200'] | |
username: "elastic" |
This file contains hidden or 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
################## START FILEBEAT ####################### | |
sudo systemctl daemon-reload | |
sudo systemctl enable filebeat | |
sudo filebeat modules enable system nginx mysql elasticsearch kibana googlecloud | |
cd /etc/filebeat/ | |
sudo filebeat setup -e | |
sudo systemctl start filebeat |
This file contains hidden or 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
##################### APM ########################## | |
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-7.8.0-amd64.deb | |
sudo dpkg -i apm-server-7.7.0-amd64.deb | |
sudo apm-server keystore create | |
echo "${elastic_pw}" | sudo bin/apm-server keystore add ES_PASSWORD | |
cat <<EOT >> /etc/apm-server/apm-server.yml | |
output.elasticsearch: | |
hosts: ['https://${elastic_host_1}:9200','https://${elastic_host_2}:9200','https://${elastic_host_3}:9200'] |
This file contains hidden or 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
########################### HEARTBEAT ################################## | |
sudo heartbeat keystore create | |
echo "${elastic_pw}" | sudo bin/heartbeat keystore add ES_PASSWORD | |
cat <<EOT >> /etc/heartbeat/heartbeat.yml | |
output.elasticsearch: | |
hosts: ['https://${elastic_host_1}:9200','https://${elastic_host_2}:9200','https://${elastic_host_3}:9200'] | |
username: 'elastic' |