# Cloud Foundry charm is suppposed to be already deployed
# deploy Elasticsearch, Logstash and Kibana
juju deploy cs:trusty/kibana
juju deploy cs:trusty/elasticsearch
juju deploy cs:~lazypower/trusty/logstash-agent
juju deploy cs:~lazypower/trusty/logstash logstash-indexer
juju add-relation kibana:rest elasticsearch:client
juju add-relation logstash-indexer:client elasticsearch:client
juju add-relation logstash-agent:input logstash-indexer:input
juju expose kibana
juju expose elasticsearch
# add syslog input to logstash-indexer
juju run --service logstash-indexer "echo \"input { syslog { codec => json tags => [\\\"cf-app\\\"] port => 8080 }}\" > /opt/logstash/conf.d/input_syslog.conf"
juju run --service logstash-indexer "initctl restart logstash-indexer"
# deploy your application to Cloud Foundry
git clone https://github.com/bcsaller/github-high-scores.git
cd github-high-scores
cf push
# get URL of your logstash indexer
LOGSTASH_INDEXER_URL=$(juju status logstash-indexer | grep public-address | awk '{print $2;}')
# bind logstash indexer and your app
cf create-user-provided-service elk -l syslog://$LOGSTASH_INDEXER_URL:8080
cf bind-service highscore elk