{"id":414,"date":"2013-09-05T02:04:50","date_gmt":"2013-09-05T02:04:50","guid":{"rendered":"http:\/\/corneliadavis.com\/blog\/?p=414"},"modified":"2013-09-05T02:04:50","modified_gmt":"2013-09-05T02:04:50","slug":"tools-for-troubleshooting-application-deployment-issues-in-cloud-foundry","status":"publish","type":"post","link":"https:\/\/corneliadavis.com\/blog\/2013\/09\/05\/tools-for-troubleshooting-application-deployment-issues-in-cloud-foundry\/","title":{"rendered":"Tools for Troubleshooting Application Deployment Issues in Cloud Foundry"},"content":{"rendered":"<p>Our standard demo for Cloud Foundry has us in a directory where either some source code or an application package (war, zip, etc.) is sitting and then we do a<\/p>\n<pre>cf push<\/pre>\n<p>A handful of messages will appear on the screen, like:<\/p>\n<pre>Uploading hello... OK\nPreparing to start hello... OK\n-----&gt; Downloaded app package (4.0K)\n-----&gt; Using Ruby version: ruby-1.9.3\n-----&gt; Installing dependencies using Bundler version 1.3.2\nRunning: bundle install --without development:test --path vendor\/bundle --binstubs vendor\/bundle\/bin --deployment\nFetching gem metadata from http:\/\/rubygems.org\/..........\nFetching gem metadata from http:\/\/rubygems.org\/..\nInstalling rack (1.5.2)\nInstalling rack-protection (1.5.0)\nInstalling tilt (1.4.1)\nInstalling sinatra (1.4.3)\nUsing bundler (1.3.2)\nYour bundle is complete! It was installed into .\/vendor\/bundle\nCleaning up the bundler cache.\n-----&gt; Uploading droplet (23M)\nChecking status of app 'hello'....\n1 of 1 instances running (1 running)\nPush successful! App 'hello' available at http:\/\/hello.cdavisafc.cf-app.com<\/pre>\n<p>This shows that the application was uploaded, dependencies were downloaded, a droplet was uploaded and the application was started.\u00a0 And that is all fine and good, but what happens when something goes wrong? How can the application developer troubleshoot this?<\/p>\n<p>The answer is multi-faceted and in this note I will try to organize things a bit.<\/p>\n<p>First, let me list the different tools someone\u00a0<strong>might<\/strong> have at their disposal, and briefly what app troubleshooting things it offers:<\/p>\n<ul>\n<li>the cf cli\n<ul>\n<li>the <code>cf apps<\/code> command &#8211; This should be very familiar, it simply shows you the apps you have deployed and an indication of their health<\/li>\n<li>the <code>cf logs<\/code> command &#8211; This will show you the contents of the files found in the logs directory of the warden container &#8211; these contents will vary depending on where in the app deployment process you are when investigating<\/li>\n<li>the <code>cf files<\/code> command &#8211; This will show you the filesystem contents of the warden container &#8211; these\u00a0contents will vary depending on where in the app deployment process you are when investigating<\/li>\n<\/ul>\n<\/li>\n<li>the bosh cli\n<ul>\n<li>the <code>bosh logs<\/code> command &#8211; This will tar up and download the files found in the <code>\/var\/vcap\/sys\/logs<\/code> directory on the targeted VM. \u00a0In general, the logs from the dea will probably be the most helpful (dea logs and warden logs), with perhaps something of note in the cloud controller logs.<\/li>\n<\/ul>\n<\/li>\n<li>ssh into CF VMs\n<ul>\n<li>there is a trick to this when running in the AWS VPC &#8211; see this thread:\u00a0<a href=\"https:\/\/groups.google.com\/a\/cloudfoundry.org\/forum\/#!topic\/bosh-users\/Zc0IHbPC47k\" target=\"_blank\">https:\/\/groups.google.com\/a\/cloudfoundry.org\/forum\/#!topic\/bosh-users\/Zc0IHbPC47k<\/a><\/li>\n<li>In most cases this probably won&#8217;t bring you anything that the bosh logs command doesn&#8217;t already, except for this next thing&#8230;<\/li>\n<\/ul>\n<\/li>\n<li>wsh (warden shell) into the warden container for the application\n<ul>\n<li>this is only possible if the application was entirely staged and is up and running. In the event that the application is &#8220;flapping,&#8221; the warden containers are likely getting killed and recreated on some pretty short interval and it will be hard to get much from wsh-ing in.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Here&#8217;s the thing&#8230; ultimately your application developer will only have access to the first of these things (the cf cli) and once your cloud is stable, this should be sufficient. \u00a0While you are getting the kinks worked out of your PaaS deployment, however, the other tools can be very helpful. \u00a0One other thing to note is that if your developers are enabled with some type of micro-cloud foundry on their workstations, then while they may not have bosh, they <strong>would<\/strong> be able to ssh into that machine and poke around, for example, getting to the dea logs directly. \u00a0I do this all the time on my laptop.<\/p>\n<p>Okay, so now with this list of tools, I&#8217;ve crafted the following diagram to give some guidance on what tools will help when investigating things during different stages of the application deployment process. \u00a0There is definitely a bit of a trick to figuring out where in the lifecycle something went wrong, but even trying to use a prescribed tool for something will give you a hint.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/corneliadavis.com\/blog\/wp-content\/uploads\/2013\/09\/AppDeploymentTroubshooting.png\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-417\" title=\"AppDeploymentTroubshooting\" src=\"https:\/\/i0.wp.com\/corneliadavis.com\/blog\/wp-content\/uploads\/2013\/09\/AppDeploymentTroubshooting.png?resize=720%2C540\" alt=\"\" width=\"720\" height=\"540\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our standard demo for Cloud Foundry has us in a directory where either some source code or an application package (war, zip, etc.) is sitting and then we do a cf push A handful of messages will appear on the screen, like: Uploading hello&#8230; OK Preparing to start hello&#8230; OK &#8212;&#8211;&gt; Downloaded app package (4.0K) [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,13],"tags":[53,76,87],"class_list":["post-414","post","type-post","status-publish","format-standard","hentry","category-cloud","category-howto","tag-cloudfoundry","tag-paas","tag-tools"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts\/414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/comments?post=414"}],"version-history":[{"count":0,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts\/414\/revisions"}],"wp:attachment":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/media?parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/categories?post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/tags?post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}