Tuesday, September 29, 2015

Adding WildFly as systemd service

In Centos 7, SystemD has finally taken the center stage and become the defacto method to start/stop services. It is fully compatible with the legacy init scripts though, which gave me an interesting dilemma. I know that systemd is supposed to be superior in many ways but why bother learning it if the old method works just fine.

Anyway, recently, my team got the opportunity to do a complete middleware upgrade and migration to a brand new server running Centos 7. Wanting to take full advantage of the situation, we've decided to take the plunge and use SystemD to start/stop our Wildfly app server.

To my pleasant surprise, this had proven to be relatively painless and straightforward. All we needed to do was to create a service file in /usr/lib/systemd/system. You can give the file any name you want but in our case, we named ours wildfly.service.

Here's what our service (unit) file looks like:
Description=WildFly application server for Fusion App


# Give a reasonable amount of time for the server to start up/shut down


Notice how easy it is to define service dependencies. No more priority levels to deal with to determine startup sequence.

As defined in the ExecStart command, the service starts by invoking startapp.sh. There's no need to define ExecStop command as systemd will simply issue a kill signal to the Wildfly process. This will stop the app server.

Here's what our startapp.sh script looks like.
#Script: startapp.sh

# Load Java configuration.
[ -r /etc/java/java.conf ] && . /etc/java/java.conf
export JAVA_HOME

# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then

[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"

$JBOSS_HOME/bin/standalone.sh -Djboss.server.base.dir=$JBOSS_HOME/myapp -Dorg.jboss.boot.log.file=$JBOSS_HOME/myapp/log/boot.log -Dlogging.configuration=$JBOSS_HOME/myapp/configuration/logging.properties

Finally, here's a list of related systemd commands.
#Start the service
systemctl start wildfly

#Stop the service
systemctl stop wildfly

#Enable the service on startup
systemctl enable wildfly

#Disable the service on startup
systemctl disable wildfly

#Check if service is enabled on startup
systemctl is-enabled wildfly

#Totally disable the service 
systemctl mask wildfly

Easy. No more chkconfig nonsense :).

Thursday, May 27, 2010

How to price your software?

Here's a link to a post that talks about some of the main lessons from the free e-book "Don't just roll the dice" on how to price software.


Download the free e-book here.

Sunday, March 14, 2010

2010 F1 - Bahrain GP season opener

Excellent start to the 2010 season. Congratulations to Ferrari for making a dream debut by securing a strong 1-2. A complete reversal of fortune compared to last year.

Fernanda proved that he would deliver given the right car and Massa showed everyone that he's back on form after the disastrous and to a lesser man, possibly a career ending accident last year.

Congratulations to Schumi for securing the 6th place, though at times it seemed like he was threatened a bit by the current WDC Jenson Button. Nevertheless, he managed to hold Button at bay.

Nico showed that he has what it takes to take on Schumi by consistently being faster than him over the race weekend. It's no mean feat considering that you are up against a 7 times WDC.

Lady luck seemed to have deserted Vettel again as his engine lost significant power during the closing stages of the race, allowing Fernando, Massa and Hamilton to pass him. He deserved to at least be on the podium after a great qualifying plus strong race pace. But then, as it's been proven time and time again, there can never be certainty in racing.

Special congratulations to Kovalainen who managed to bring Lotus home - the only car out of all the new comers that managed to do so. Hope Lotus as a team can keep it up and ensure that Virgin Racing will always finish behind them. I'm sure all of us are rooting to see Sir Richard Branson serving on the Air Asia flight after the end of the season. That would be quite a spectacle ;)

All in all, an explosive beginning of a long season set to become more exciting in the coming races. Can't wait for Melbourne GP to start!

Visit the official Formula 1 website for the full results.

Friday, March 12, 2010

Mavenizing Ant

I'm currently working on a project that is based on relatively huge JEE+Flash framework. The framework was built incrementally over a period of more than 7 years and any fundamental changes (like the build process), I have to say, would be extremely hard to make.

That doesn't mean that it can't be done.

To be continued :D.....

Tuesday, March 9, 2010

The pesky anti virus

Recently I installed Panda anti virus to replace the often obtrusive Avira. Panda anti virus supposedly is among one of the world's first cloud-based anti virus, which means it theoretically should have smaller footprint and faster scanning due to its ability to harness vast amount of computing power available in the cloud. The caveat is of course you need to be connected to the Internet.

I've been reasonably happy with it up until today when I tried to fire up JBoss on my machine. Lo and behold, it took forever for the app deployment to take place. For the life of me, I couldn't figure out why until I viewed the running processes in Windows task manager. Instead of the JVM as one would naturally expect, Panda anti virus was the one consuming most of the CPU and the usage hovered between 25-50%. That's pretty hefty if you ask me.

My hunch told me to disable the anti virus and I was right. As soon as Panda was disabled, the start-up time for my Jboss instance went back to normal.

What was Panda doing? My guess would be because the app was actually an ear file i.e. packaged into zip format, Panda would relentlessly scan each and every file in it resulting in enormous wait before the deployment can continue.

I'm sure there is a way to configure Panda to ignore all ear files and I will definitely find it out later. Not now. For now, disabling Panda (at least when I'm working on the app) is my way forward.

Tuesday, March 2, 2010


I've decided that this blog shall not have any posts that contain intimate details of my personal life :-D. I've moved all old posts that don't meet this 'criteria' to a new blog. Don't bother asking me about the new blog address. Reason - those in my 'inner' circle would know about it already ;).

Friday, January 1, 2010

Snippely - A tool to help organize your code snippets

I found out about Snippely when somebody tweeted about it recently.

Snippely is a nifty Adobe AIR-based tool to help you organize your code snippets. Often, when browsing the net, I will come across interesting snippets that I would copy and paste into a new text file (or append to existing one) on my desktop. As you can imagine, over time, my desktop would be so full of these snippets until I would have to search really really hard to find a piece of code (I know it's there somewhere). Sure, some of you will say why not use Google desktop search. Problem is, the nature of search requires you to know what you're searching for and most of the time (and especially during pressing time), I would have to spend significant minutes just to come up with the proper search keyword.

That's why I think Snippely is such a gem. Snippely allows me to add and group my snippets quickly. The interface is easy to use, and the inline editor has syntax highlighting for Javascript, php and a few others. It doesn't have search capability though, and that's something I wish would be addressed in the future.

Check out my snippet folder before Snippely (what a mess!):

With Snippely:

Download Snippely at http://code.google.com/p/snippely.