Bug 751248 - Example script: drift repair
Summary: Example script: drift repair
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: ---
: ---
Assignee: Charles Crouch
QA Contact: Mike Foley
URL:
Whiteboard:
: 803841 (view as bug list)
Depends On:
Blocks: jon30-sprint9 jon30-sprint8 787221
TreeView+ depends on / blocked
 
Reported: 2011-11-04 02:42 UTC by Charles Crouch
Modified: 2015-02-01 23:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
: 787221 (view as bug list)
Environment:
Last Closed: 2013-09-03 16:55:38 UTC
Embargoed:


Attachments (Terms of Use)
RHQ-server script that redeploys a bundle (12.12 KB, application/javascript)
2011-11-18 17:19 UTC, Ian Springer
no flags Details

Description Charles Crouch 2011-11-04 02:42:45 UTC
The following are the steps to test the required CLI script. The needed script itself is mentioned in step 4) below:

1) Create a bundle containing an EAP instance
2) Provision that bundle to a platform
3) Setup drift to monitor that EAP instance
*4) Create a CLI script which redeploys the bundle from step 1, returning the EAP instance to its original state
5) Setup an alert to trigger when drift is detected, and have the script from step 4 be fired when the alert triggers
6) Update the EAP instance, thus triggering drift, and watch as the script reprovisions the EAP instance.

Comment 1 Ian Springer 2011-11-18 17:18:00 UTC
1) Create an EAP 5.1.1 bundle using a script I wrote, which has been checked into master at etc/scripts/create-jbossas-bundle.sh. The script is run as follows:

create-jbossas-bundle.sh jboss-eap-5.1.1.zip

where jboss-eap-5.1.1.zip is the EAP 5.1.1 dist zipfile. This outputs a bundle distribution zipfile named jboss-eap-5.1.1-bundle.zip.

2) Use the bundle create wizard in the GUI to create a bundle from jboss-eap-5.1.1-bundle.zip. Create a compat group containing one or more platforms. Create a bundle destination containing the platforms group with a deploy dir of "/tmp/jboss-eap-5.1.". Deploy the bundle to this bundle destination. For each platform:

 a) uncomment the admin=admin line in /tmp/jboss-eap-5.1.1/server/production/conf/props/jmx-console-users.properties.
 b) start the EAP server: /tmp/jboss-eap-5.1.1/bin/run.sh -b 127.0.0.51 -c production
 c) wait for the EAP server to fully start, then run "discovery -f" at that platform's agent prompt to discover the new EAP server
 d) from the GUI, import the newly discovered EAP server resource

3) for each of the EAP server resources, create a drift definition based off the base files template (this def will monitor the bin, common, and lib dirs for drift)

4) Setup an alert on the EAP server resource that triggers when drift is detected. Add a notification of type 'CLI script' and upload the attached fix-bundle-deployment.js script.

5) Manually modify some file under the bin directory of one of the EAP servers (e.g. add the line "######## BLAH ########" to bin/classpath.sh). Select the drift definition for the corresponding EAP server resource and click the Detect Now button. Wait for the drift definition to report it is Out of Compliance (should only take a minute or so). Wait for the alert defined in step 4 to fire. Watch as the script reprovisions the EAP instance.

Comment 2 Ian Springer 2011-11-18 17:19:27 UTC
Created attachment 534456 [details]
RHQ-server script that redeploys a bundle

Comment 3 Ian Springer 2011-11-18 17:22:10 UTC
Note, for step 4, before you upload fix-bundle-deployment.js, you will need to edit the following two lines in that file and set them to the destination ID and bundle version ID corresponding to the destination and bundle version you created in step 2:

var destinationId = 10002;
var bundleVersionId = 10002;

Comment 4 Mike Foley 2011-11-29 16:49:30 UTC
changing priority to low ... sample script ... no impact on runtime

Comment 5 Charles Crouch 2011-11-30 19:45:15 UTC
It doesn't impact the run time, but I've asked Lukas to test it out and make it available under /downloads from the JON server, so that people who want it can grab it.

Comment 6 Lukas Krejci 2011-12-01 16:15:44 UTC
The change is in master.

The script is downloadable from the server and the Administration/Downloads page was updated to contain it (more scripts are automatically picked up if placed in the same location).

I also slightly updated the script to contain more guiding documentation.

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=4ef245611000d6b7f72d2e6ed27b8211315d427b
Author: Lukas Krejci <lkrejci>
Date:   Thu Dec 1 14:50:06 2011 +0100

    [BZ 751248] - Make the sample CLI alert scripts downloadable from the server's /download/cli-alert-scripts location and from the Downloads section of the GUI.

Comment 7 Lukas Krejci 2011-12-02 16:12:49 UTC
release_jon3.x contains only the script and makes it accessible for download. The UI changes were left out from the release. The location of the script is only to be mentioned in the documentation.

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=f6cd36125fe0805161caec0ac24b5b8c8a94ef17
Author: Lukas Krejci <lkrejci>
Date:   Fri Dec 2 17:01:58 2011 +0100

    [BZ 751248] - in JON 3.0.0 we are going to make the script downloadable but
    will provide no UI for accessing it. The script can be downloaded from
    http(s)://<JON_DOMAIN>:<JON_PORT>/downloads/cli-alert-scripts/fix-bundle-deployment.js

Comment 8 Filip Brychta 2012-09-04 14:09:18 UTC
Verified on 3.1.1.CR1. Verified that scenario from comment 1 is working with following script: http(s)://<JON_DOMAIN>:<JON_PORT>/downloads/cli-alert-scripts/fix-bundle-deployment.js

Also verified that deployBundle function from rhq-remoting-cli-4.4.0.JON311CR1/samples/bundles.js is working.

Comment 9 Filip Brychta 2012-09-05 11:52:15 UTC
*** Bug 803841 has been marked as a duplicate of this bug. ***

Comment 11 Heiko W. Rupp 2013-09-03 16:55:38 UTC
Bulk closing of old issues that are in VERIFIED state.


Note You need to log in before you can comment on or make changes to this bug.