Friday, December 29, 2017

Debug CF

06 How do I debug my app?

This content is copyright of CloudCredo. © CloudCredo 2015. All rights reserved.

Feature

As a CF hero
I want to know what my CF app is doing
So that I can debug it

Push a buggy app

# From the training home directory:
$ cd 06-debugging/debug-app
$ cf push

...

urls: debug-app-unerring-muddlehead.cfapps.io

...

How do I debug my app?

  1. App logs
  2. App events
  3. App instrumentation
  4. SSH access

1. App logs

$ cf logs debug-app --recent

...

... [App/0] ERR ... - RuntimeError - I am a bug, fix me:
... [App/0] ERR /home/vcap/app/config.ru:20:in `block in <class:Web>
$ cf logs debug-app # Tails app logs, CTRL + C to exit

Let's fix the app

$ cf set-env debug-app FIXED true
$ cf restart debug-app

2. App events

$ cf events debug-app

... description
... index: 0, reason: CRASHED, exit_description: 2 error(s) ...
...
Note: Notice that the most recent event is at the top

3. App instrumentation

  • New Relic
  • AppDynamics
Included in Java buildpack

New Relic instrumentation

$ cf create-service newrelic standard newrelic
$ cf bind-service debug-app newrelic
$ cf env debug-app
# Find your New Relic license key
# From the training home directory:
$ cd 06-debugging/debug-app
# Replace YOUR-LICENSE-KEY
$ vim newrelic.yml
$ cf push
$ cf service newrelic
Note: Create a New Relic service instance
Provide app with New Relic license key
Find New Relic Dashboard URL
Generate some load

4. SSH access

$ cf ssh debug-app

DELIVERED

As a CF hero
I want to know what my CF app is doing
So that I can debug it

Any questions?

Questions cannot be stupid. Answers can.

CF SUPERHERO

$ cf cups logdrain -l syslog://YOUR-PAPERTRAIL-LOG-DESTINATION
$ cf bind-service debug-app logdrain
# Check your Papertrail Events, no need to restart the app

No comments:

Post a Comment

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...