Saturday, November 22, 2008

A Personal Hosted Confluence Wiki for Free

I had been searching for a way to use Confluence as a personal wiki for me and my wife. I couldn't find a cheap hosted solution where I could just get an account for 2 people on an instance of Confluence maintained by someone else. I also didn't really want to pay a hosting company like Linode or Slicehost $20 a month for my own virtual machine on which I'd have to install and maintain Confluence myself.

Recently I heard about Morph Labs which describes themselves as a Platform as a Service (PaaS). They offer free hosting accounts that give you up to a 1GB database. I immediately got the idea to try running the personal edition of Confluence on this service. Eventually I got it working, but the process to get up and running was not at all easy. In fact, I struggled for serveral nights.

The rest of this post documents the process I went through. I hope it will help someone else avoid the many hours I spent learning how to work within Morph AppSpace with a third-party Java web application. Good luck, and if you have any tips or corrections, please comment and I'll update this post.

Start by signing up for a Morph AppSpace account with Morph Labs. Create a new subscription and setup a new database for that subscription. Be sure to choose Java, not the default Ruby on Rails, when setting up your subscription. Choose PostgreSQL for your database as this seems to work best with Confluence. Once your subscription is setup, download the Properties File, morph_deploy.properties, and Deployment Jar File, morph-deploy.jar, that can be found in the Java Tools for Morph AppSpace Deployment section.

Next, go get your free license for personal Confluence. It allows you to register 2 users. Hold on to that license text. You'll need to activate Confluence once it is installed. Then download the latest version of Confluence which is currently 2.9.2.

Unpack the file you downloaded somewhere on your computer. Inside, you should find an edit-webapp directory. Any files you need to modify should get copied into this directory. The contents of this directory get overlayed on top of the contents of the eventual Confluence WAR file that you're going to build, so make sure to adhere to the standard WAR directory structure. The whole purpose of the edit-webapp directory is to keep your local changes separate from the distribution so when it comes time to upgrade Confluence, you can just replace it and you'll know what you had to modify.

Copy confluence/WEB-INF/classes/confluence-init.properties to edit-webapp/WEB-INF/classes/confluence-init.properties.
Edit the copied confluence-init.properties, specifying the home dir as /var/java/ where APP_NAME is whatever name you chose as your subdomain at Morph. For example, if your domain is family-wiki.morphexchange.com, then your home directory path would be /var/java/family-wiki.

Copy confluence/WEB-INF/web.xml into edit-webapp/WEB-INF/web.xml.
Edit web.xml adding the jdbc datasource:

<resource-ref>
<description>Morphlabs Datasource</description>
<!-- any name will do for the res-ref-name -->
<res-ref-name>jdbc/morph-ds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


and the JavaMail session:

<resource-ref>
<description>Morphlabs Mail Session</description>
<!-- any name will do for the res-ref-name -->
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I had to disable Confluence's JMX-based monitoring because of problems registering MBeans. This isn't a big deal since, for a personal instance of Confluence, I don't really have any need to monitor performance and gather statistics. This web page explained how to disable JMX. Download jmanageContext.xml from the URL shown on that page. Then, copy jmanageContext.xml into edit-webapp/WEB-INF/classes.

Remove mail.jar and activation.jar from confluence/WEB-INF/lib. Morph AppSpace already includes those in the Jetty server and having an extra copy in your WAR might cause class loader issues that would prevent JavaMail from working properly. This is the only change that you'd have to remember to do again if you were to ever download a new version of Confluence.

Now it is time to build the WAR file. Run ./build.sh which creates dist/confluence-2.9.2.war. If you need to make any changes to any files, be sure to run this build script again.

Download morph_deploy.properties and morph-deploy.jar from your subscription within the Morph Control Panel.

Run

java -Xmx512m -jar morph-deploy.jar --config morph_deploy.properties confluence-2.9.2/dist/confluence-2.9.2.war


Now, sit back, relax, and wait while your WAR is being uploaded and deployed on Morph AppSpace. This could take up to 15 minutes, so be patient.

Hit your-subscription-name.morphexchange.com and if all went well, you should see a Confluence installation web page. Following the Confluence installation wizard, entering your personal license text. Choose Custom Installation, External Database, Connect via a Datasource.
Enter java:comp/env/jdbc/morph-ds as the datasource.

Confluence takes a long time to setup the database, so the page may appear to hang. Each time I tried this (I had to try many times before figuring all this out), the page timed out. I don't know if something went wrong or Morph AppSpace just has a time limit on waiting for a page to render. Even though the page timed out and I saw some kind of "Proxy error" message, the database still seems to have been initialized properly, but the application wasn't able to recover. I had to go into the Morph Control Panel to restart the application. Once I did that, Confluence was up and running!

Coming soon to this post: Setting up a mail server and using Groovy and XML-RPC to perform a daily backup of your confluence data.

Sunday, September 28, 2008

MacBook to HDTV via Mini DVI to DVI to HDMI

Since the MacBook is so good at playing different kinds of media, I plan to make it the media center of my life. I will store all music, videos, and photos there.

This led me to try to connect my MacBook to my Sharp Aquos LC46D64U 46-Inch 1080p LCD HDTV. I did some research and found that there was only one option if I wanted to have digital picture quality. I needed 2 cables because there is no such thing yet as a Mini DVI to HDMI cable:
  1. Mini DVI to DVI Adapter ($19.95)
  2. DVI to HDMI Cable ($19.95)
I picked these up, connected the Mini DVI end of the first cable to my MacBook, connected the DVI end of the second cable to the first cable, and finally the HDMI end of the second cable to an open HDMI slot in my TV. Then I switched the TV's input to the HDMI port I just plugged into, and voila! - it worked immediately! The 1920 by 1080 picture looked great.

The MacBook lets you choose between having 2 monitors and mirroring the same monitor. The settings are all under System Preferences > Displays.

Now, I can show photo slide shows when the family is over, I can watch video podcasts and YouTube videos on the big screen, and I can even enjoy the Twitter election feed from my couch.

Next I will look for the best way to get the sound from my MacBook hooked up to my Denon receiver.

Tuesday, September 23, 2008

Giving In and Buying a MacBook

I finally caved in to the marketing pressure from Apple and a lot of my Apple-religious friends. I bought a MacBook. Why would I do this after many years of trying to do everything with open source software? The main reasons are iTunes and my wife's need to use MS Office.

I need iTunes to manage my family's 3 iPods (2 of which I got for free at tech conferences and users groups). I also will need iTunes if I decide to buy an iPhone. I have been thinking about it because I am surrounded by friends and co-workers who swear up and down that the iPhone is the answer to all of life's problems. Anyway, Apple won't produce a version of iTunes that runs on Linux and that's a shame, but there's nothing I can do about it.

My wife has been using our Ubuntu linux desktop for the last few years, and has gotten along quite nicely until recently when she needed some advanced spreadsheet functionality like mail merge. I am disappointed to say that Open Office just wasn't cutting it. The feature set was either lacking or buggy. She was longing for MS Excel. MS Office is available for the Mac, so that problem could get solved too.

So far, the best thing about that Mac has been its packaging. It came in a slick box with fancy designer Styrofoam. It has stylish body and the l.e.d. lights have a pleasing glow. Also the screen has a great, kind of glossy, picture.

I do have some gripes:

For one thing, I can't find a way to turn of that annoying sound the computer makes when booting. A few blog posts I read say that you have to download some 3rd party software to disable it.

After 20 minutes of surfing the web when I first booted up, the computer crashed and the wireless card stopped working. I had to take the computer back to the Apple store. Thankfully they exchanged it even though I had purchased the MacBook from the online Apple store.

There doesn't appear to be any way to maximize a window. There is a green plus button on each window that makes the window larger, but it doesn't make it go full screen. Why can't I have this functionality on a Mac?

There is no concept of right-click! To get a context menu, I have to put 2 fingers on the trackpad and click the button. I guess I can get used to this, but come-on, would it be so hard for Apple to make the right side of the button do what Windows and Linux users expect?

You can only resize a window from the lower-right corner. This is unbelieveable. Both Windows and Linux allow you to resize a window from any edge of the window. I find this really annoying.

There are no Page Up, Page Down, Home, and End keys! The function key + up or down arrows will do the same thing as Page Up and Page Down. Also the Apple key + the left and right arrow will do the same thing as Home and End, but I'm just not used to it yet.

Pressing the red X button on a window closes the window, but doesn't close the application even if it is the last window open in that application. You have to remember to explicitly quit the application with an Apple key + Q. I always forget to do this and am left with many open applications as a result.

Despite all these gripes, I am happy to be getting to know my way around a Mac now. I have always felt completely lost on a Mac and these days, it feels like everyone and their mother has one.

Sunday, July 13, 2008

Walking L.A. #20 - Lower Beachwood Canyon

Again, Erin Mahoney, the author of our guide book, took us back to Hollywood. This time we visited Lower Beachwood Canyon which is just a little bit east of the last walk in Whitley Heights. Again there were many steep roads, but I enjoyed this walk a little more than last week's because we went earlier in the morning to avoid the heat, and I saw an area I've never seen before, even though I've lived in LA for over 15 years.

We began at the bottom of Vista del Mar Ave where it meets Franklin Ave. We stopped for coffee at the 101 Coffee Shop which was a 70's-looking diner with some character. I'd return there sometime to try the food, but never again for a cup of coffee which was pretty lousy even for a diner.

Again this week we saw beautiful houses, many with enviable views of Hollywood and Downtown LA. Many parts of the neighborhood were quiet with narrow, curvy streets, which reminded me of hillside towns in Europe. Other parts were extremely noisy from the roaring cars on the adjacent 101 Freeway.

One of the noisiest areas, ironically, was home to the Vedanta Society of Southern California. We stopped in to admire their white temple which looked like a mini Taj Mahal. We also browsed through their bookstore where we almost bought our son a Peaceful Piggy Meditation book.




The next walk is Upper Beachwood Canyon.

Walking L.A.: 36 Walking Tours Exploring Stairways, Streets and Buildings You Never Knew Existed

Sunday, July 06, 2008

Walking L.A. #19 - Whitley Heights and Hollywood Boulevard

This walk was just on the other side of Highland Ave from the last walk. You can tell that Whitley Heights was once a very prestigious neighborhood by the many fancy Mediterranean style homes. Unfortunately the 101 Freeway was built right through it and now the residents have to put up with the noise.

It was really hot today and the many steep roads on this walk contributed to a lot of sweating. After walking through Whitley Heights we descended down Whitley Ave to Hollywood Blvd where we walked west to the Hollywood and Highland complex. The boulevard was full of the usual tourists. We had been here many times before so instead of sightseeing, we headed into a Build-a-Bear store to cool off. Yes, there is actually a store that is like a Subway Restaurant for teddy bears. You start with a naked bear and then pick its name, clothes, and accessories.

After the bear store, we stopped to watch some dancers rehearsing their moves at the Hollywood Pop Academy while we fed our baby. Finally, we grabbed some coffee at Starbucks and then headed back to Whitley Heights to end our walk.

The next walk is Lower Beachwood Canyon.

Walking L.A.: 36 Walking Tours Exploring Stairways, Streets and Buildings You Never Knew Existed