XInit - Application
Admin tool to manager an XWiki/Tomcat instance |
Type | |
Category | Other |
Developed by | Unknown |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Xinit is a bash script that can be used to manage an tomcat instance and to monitor XWiki availability. It was mainly tested and used on Debian systems but it should also run on a RedHad based OS.
The main features of Xinit are:
- Check XWiki availability
- Check Tomcat process (java process)
- Automatic restarts when XWiki is not responding or when java process is not running.
- Send notifications by e-mail and jabber
- Manage OpenOffice Daemon
- Send reports about disk usage, database size, mysql queries, cpu and memory used for the specified daemons, java thread dumps, connections state for the specified port numbers, tomcat logs.
- Supports Basic Authentication
- Manage JVM settings and also able to start JVM in debug mode with remote access.
Usage
After you have installed Xinit (please see the installation section) it has two main files you need to use. One is the configuration file and another one is the script used to manage xwiki. This script can be found in /etc/init.d/xwiki.sh
If you run xwiki.sh without any options it will print a list of all parameters it supports.
After doing all the configuration in xinit.cfg you can use xinit in a cron to check XWiki availability. For example the following cron configuration will check XWiki every 5 minutes and Tomcat process every minute.
*/5 * * * * /etc/init.d/xwiki.sh check-http >/dev/null 2>&1
Xinit will automatically restart Tomcat in case XWiki is not responding in an amount of time or if the java process is not running. In the same time it will send email notifications to the emails addresses specified in xinit.cfg file. Also the time xinit should wait for XWiki to respond can be set in xinit.cfg .
Running xinit as non-root user
Xinit can also be run with another user than root if you have some specific security requirements. By default, it will be the tomcat user. To do so, before to run the ./install.sh command, make sure to edit the file xinit-master/xinit-application/src/main/resources/var/lib/xinit/vars and set the variable ROOT_INSTALL to "false":
Then, also edit the file xinit-master/xinit-application/src/main/resources/var/lib/xinit/default.cfg if xinit is not installed yet, or the file /etc/xinit/xinit.cfg if it is, and set the variable VAR_DIR to "/var/tmp/xinit":
Then, you can follow the standard instructions above to finalize the install.
check-http
This is the most important feature of Xinit this is why I'm going to offer more information about it. So to enable this feature edit xinit.cfg file and set CHECK_HTTP="yes". You'll find a dedicated section for this feature in the configuration file.
Also in the configuration file you'll find more parameters that you can use to customize the way how Xinit is checking XWiki availability.
That means you can configure Xinit to expect any of the HTTP/1.1 response code and based on the response code it receives it can decide if the wiki is responding or not in the amount of time specified in xinit.cfg.
Example: supposing you have an public wiki that can be accessed using http://xwiki.domain.tld . To configure Xinit to check the availability of that wiki do the following changes in xinit.cfg:
EXPECT_HTTP_RESPONSE_CODE="200"
CHECK_HTTP_URL="http://xwiki.domain.tld"
After this you can run /etc/init.d/xwiki.sh test-http to see the results. If everything is ok then you can configure a cron job as specified above.
If the wiki is protected by htaccess you can set USE_BASIC_AUTH="yes" and set HTACCESS_USERNAME and HTACCESS_PASSWORD parameters in xinit.cfg to let Xinit be able bypass the basic authentication.
Other important parameter is USE_DNS which by default is set to "yes". This parameter makes Xinit to not restart Tomcat in case it was not able to resolve the domain specified by the CHECK_HTTP_URL parameter. You can set it to "no" if you want to reverse the behavior.
You can also instruct Xinit how much time to wait for a response. This can be set using the following parameters:
CHECK_HTTP_TRIES
CHECK_HTTP_WAITRETRY
Prerequisites & Installation Instructions
Some packages must be installed before start uisng xinit. For Debian system you can just simply run
For RedHat Based systems you can look for the equivalent packages.
After that, download the source code of xinit and run ./install.sh