Setup a Jetty 7 service for Debians or CentOS

Recently I changed Apache Tomcat 7.x by Jetty 7.6.11 to test and production VMs. Incredibly, the start-up time passed of 8 minutes to  +- 2.5 minutes, the same for memory usage during this process.

Both servers has the same behavior for my applications, however, the slow start-up time of Apache Tomcat 7.x complicates my life and all of clients :/ …In the last few weeks, I’ve need release several builds…this in the rush hour.

Problem…

For my Linux Mint (ubuntu-based) I can be install Jetty 7 directly from apt repositories, but for CentOS I’m need configure on the nail, and, its probably that two installations are not equal. So, I’ll need create a portable installation for Jetty works at two OS’s.

Downloading and moving

First, download Jetty 7 from Eclipse repositories here (you can choose by .zip, .tar, .tar.gz options) or using CI:

After this, we can create all configurations ;)

Extract downloaded file:

Rename final folder (we don’t the version number : ))

Moving to /opt (you’ll maybe requires sudo privileges)

.bashes and .confs

At jetty7/bin/ folder you have jetty.sh file, with all commands to correctly starts Jetty server instance, however, we have to configure some files with default configurations for Jetty instance. To this, create a configuration file at /etc/default/ called jetty:

Inside this file, you’ll put all yours configurations values, like this:

Save this file ‘Esc + :wq!’ (you know…)

Tip! You can use official Jetty docs to append additional configuration args to this file.

After create a symbolic link for jetty7/bin/jetty.sh at /etc/init.d/ folder.

Now, we can start the Jetty server using service command:

Appendix

To realtime track Jetty logs, you can use tail -f command:

To increase the max input parameters submitted to server, you’ll need add -Dorg.eclipse.jetty.server.Request.maxFormKeys=9000000 to /etc/default/jetty file. The final JAVA_OPTIONS will stay:

With you need replicate this installation, you can keep /etc/default/jetty inside of Jetty folder…like jetty7/bin/jetty or jetty7/configs/jetty and just create a symbolic links every new installation.

Or also,  create a bash file to make all this steps.

Reference

http://wiki.eclipse.org/Jetty/Howto/Configure_Jetty

http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size

http://wiki.eclipse.org/Jetty/Howto/How_to_serve_symbolically_linked_files

All comments are be welcome. Bye.