Introducing RHQ Db Setup tool

Romain Pelisse belaran at gmail.com
Mon Mar 19 21:22:04 UTC 2012


Hi all,

As I've been installing and reinstalling RHQ here and there, I've grown
quite bored of always having to manually input all the database parameter
manually. More than that, I feel that for large setup (I mean several
hundreds of server and services to monitor) it will be crucial to easily
defined "domain" and fire up - in automated manner, new instance of RHQ (to
take care of new domain for instance). For all those reason, I wrapped
up a rather
simple java class<https://github.com/rpelisse/rhq-db-setup/blob/master/src/main/java/org/redhat/jboss/rqh/autodb/RHQDatabaseInstaller.java>using
HtmlUnit <http://mvnrepository.com/artifact/htmlunit/htmlunit> to "trigger"
the installation.

It is package as a simple jar (actually, a "fat jar" meaning that all
required dependencies are within the jar), and it is designed to be used in
command line within a script:

$ java -cp ./target/jon-setup-1.0-jar-with-dependencies.jar
org.redhat.jboss.rqh.autodb.RHQDatabaseInstaller -s
http://localhost:7080/installer/start.jsf -u rhqauto -p rhqautopass -d
jdbc:postgresql://postgresql-8.4:5432/rhqautoinstall -v
Setting up database for RHQ Server running on:
http://localhost:7080/installer/start.jsf
Database URL: jdbc:postgresql://postgresql-8.4:5432/rhqautoinstall
Database Username: rhqauto
Database Password: rhqautopass
Database Driver: org.postgresql.Driver
Database XA Datasource: org.postgresql.xa.PGXADataSource
...
Waiting for installer to finish...
[execution time: 1601ms]
Finished with HTTP code:200
Waiting for RHQ Server to finish its installation [3000ms] ...
DB setup for server http://localhost:7080/installer/start.jsf done.


This version has been tested on Linux against a RHQ 4.x setup with Postgres
8.4, but it should work transparently with Oracle or Windows (well, as far
as Window works). It would probably also work with RHQ 3.x, with some
tweaking (if you do those tweaks, please publish and pull them). I've
licensed this project under LGPL, so we should be able to do pretty much
whatever you want, as long as you offer back any changes.

@RHQ developers: assuming users find this useful, you should NOT change the
installer's form name or id in the coming release - unless, of course, you
fixed this issue and offer a clean mechanism to setup RHQ in complete
automated manner.

Source code: https://github.com/rpelisse/rhq-db-setup

Technical notes: For those who cares, I've managed to do this program in
one (size-reasonable) class by using cool libs such as
Lombok<http://projectlombok.org/>,
JCommander <http://jcommander.org> and JSoup <http://Jsoup.org>.

-- 
Romain PELISSE,
*"The trouble with having an open mind, of course, is that people will
insist on coming along and trying to put things in it" -- Terry Pratchett*
http://belaran.eu/wordpress/belaran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://fedorahosted.org/pipermail/rhq-devel/attachments/20120319/dfa4012e/attachment.html>


More information about the rhq-devel mailing list