Archive for November, 2007

I Suck at Espresso

November 20, 2007

Let me clarify, today I got my first home espresso machine so I am a total newbie when it comes to pulling shots. I plan to post some pics of the equipment I picked up in a later post. For now I just wanted to say, one of my worst practice shots was better than 90% of the shots I have had at Starbucks, restaurants, or local coffee shops. I can’t convey how excited I am to be able to perfect pulling shots on my home equipment. I will be taking all my coffee at home now, thanks.

Smugmug.com is Awesome!

November 19, 2007

I just have to being up how cool SmugMug is, specifically their customer service. I had been a paying customer for two years. Well, while in a state of severe sleep depravation, I decided to cancel my account and either host something myself or move to Flickr. My sleep deprived state was due to the arrival of our first child, so when am I going to have time to work on something hosted locally? After playing around with Flickr some, I found that the feature set at SmugMug is far better. So last night after realizing the error of my ways, I emailed them to ask if they could reinstate my account as it existed before. I fully expected them to direct me to signup again. Much to my pleasure, I got a reply this morning. They restored my account such that I am still listed as a user since 2005 and all my uploaded images are back. It is like I never left. Thanks a lot SmugMug!

Running GlassFish on Mac OS X using launchd

November 6, 2007

I run a Mac Mini as my home server, currently with OS X 10.4. Tonight I dug around and got GlassFish up and running using OS X’s answer to SMF on Solaris, launchd. I am by no means an expert on launchd but I will happily document what worked for me. First off I installed GlassFish v2 to “/usr/local/glassfish” as per the documented instructions.

Once I verified that it all worked, I sought out how to integrate it into launchd. I certainly don’t want it running as root, so I took a look at the available users and groups using the NetInfo Manager application. I found an “appserver” user and associated “appserverusr” group. Seemed a good place to start. I changed the ownership recursively for my install directory to this user and group combination. Once done, I created my launchd plist file and saved it to “/Library/LaunchDaemons/glassfish.plist”.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sun.glassfish</string>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>appserver</string>
<key>GroupName</key>
<string>appserverusr</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/glassfish/bin/asadmin</string>
<string>start-domain</string>
<string>domain1</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Similar to SMF you have to load/import the service description. On OS X you use “launchctl load ./glassfish.plist” for this purpose. If all goes well you will have a running instance of GlassFish. If not, you will see rather vague error messaging in the system.log file.

Some drawbacks. It seems that launchd relies on sending a SIGTERM to the process when you attempt to stop it using “launchctl stop com.sun.glassfish”. This doesn’t work for GlassFish. I prefer the ability of SMF to define a appropriate shutdown command. Not a huge deal as I can easily stop GlassFish using asadmin or the admin console when needed. Once the process is stopped you can use “launchctl start com.sun.glassfish” to bring it back up. There is no notion of a restarter if the process dies. I think there is a new KeepAlive element in OS X 10.5 but I haven’t be able to experiment with that version yet. Sounds promising though.

All in all this works pretty well. GlassFish will launch on boot using the recommended subsystem. If anyone has any tips on achieving a tighter integration with launchd let me know.