brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorbett <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Adds documentation for troublesho...
Date Wed, 22 Jul 2015 11:05:36 GMT
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/762#discussion_r35201803
  
    --- Diff: docs/guide/dev/tips/troubleshooting-exceptions.md ---
    @@ -0,0 +1,487 @@
    +---
    +layout: website-normal
    +title: Troubleshooting Exceptions and Node Failure
    +toc: /guide/toc.json
    +---
    +
    +Whether you're customizing out-of-the-box blueprints, or developing your own custom blueprints,
you will
    +inevitably have to deal with node failure, or exceptions being thrown by your node. Thankfully
Brooklyn
    +provides plenty of information to help you locate and resolve any issues you may encounter.
    +
    +This guide looks at three common failure scenarios and describes the steps that can be
taken to
    +identify the issue.
    +
    +## Script failure
    +Many blueprints run bash scripts as part of the installation. This section highlights
how to identify a problem with
    +a bash script.
    +
    +First let's take a look at the `customize()` method of the Tomcat server blueprint:
    +
    +{% highlight java %}
    +  @Override
    +  public void customize() {
    +      newScript(CUSTOMIZING)
    +          .body.append("mkdir -p conf logs webapps temp")
    +          .failOnNonZeroResultCode()
    +          .execute();
    +
    +      copyTemplate(entity.getConfig(TomcatServer.SERVER_XML_RESOURCE), Os.mergePaths(getRunDir(),
"conf", "server.xml"));
    +      copyTemplate(entity.getConfig(TomcatServer.WEB_XML_RESOURCE), Os.mergePaths(getRunDir(),
"conf", "web.xml"));
    +
    +      // Deduplicate same code in JBoss
    +      if (isProtocolEnabled("HTTPS")) {
    +          String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore
URL must be specified if using HTTPS for " + entity);
    +          String destinationSslKeystoreFile = getHttpsSslKeystoreFile();
    +          InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl);
    +          getMachine().copyTo(keystoreStream, destinationSslKeystoreFile);
    +      }
    +
    +      getEntity().deployInitialWars();
    +  }
    +{% endhighlight %}
    +
    +Here we can see that it's running a script to create four directories before continuing
with the customization. Let's
    +introduce an error by changing `mkdir` to `mkrid`:
    +
    +{% highlight java %}
    +      newScript(CUSTOMIZING)
    +          .body.append("mkrid -p conf logs webapps temp") // `mkdir` changed to `mkrid`
    +          .failOnNonZeroResultCode()
    +          .execute();
    +{% endhighlight %}
    +
    +Now let's try deploying this using the following YAML:
    +
    +{% highlight yaml %}
    +
    +name: Tomcat failure test
    +location: localhost
    +services:
    +- type: brooklyn.entity.webapp.tomcat.TomcatServer
    +
    +{% endhighlight %}
    +
    +Shortly after deployment, the entity fails with the following error:
    +
    +`Failure running task ssh: customizing TomcatServerImpl{id=e1HP2s8x} (HmyPAozV): 
    +Execution failed, invalid result 127 for customizing TomcatServerImpl{id=e1HP2s8x}`
    +
    +[![Script failure error in the Brooklyn debug console.](images/script-failure.png)](images/script-failure-large.png)
    +
    +By selecting the `Activities` tab and drilling down into the tasks, we eventually get
to the task that failed:
    --- End diff --
    
    Minor: worth a comment explaining how to drill down into tasks? I've often seen people
hesitate when I ask them to do this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message