Gigaw.at: Back from the future

Gigaw.at

A week ago, I had an email about a domain name due to expire, which got me thinking, then two days ago I wrote a blog post about open sourcing more of my web apps that I have built and are sat lying on my computer.

Today, I open sourced my first web app: Gigaw.at.

Gigawat was a web app that I had built nearly two years ago, and I was running it for a good time on it’s own VPS with separate database server, and them over time it sort of dwindled out, and was not very active, and it was costing me each month with very little reward (personally), so I closed it down and decided to save my money and put into other projects. As per my blog post the other day, I want to bring some of my web apps back to life, and have a history of the code I’ve written.

I decided that gigaw.at would be my first web app to be open sourced as I knew it was in a pretty good state and was able to run with very little work… I did say little work, which turned out to be wrong as I decided to adjust a couple of things, I also removed a couple of features. This meant that I could spend more time working out how to use heroku and get it all up and running. Which was very simple, just a few kinks to work out, which was mainly the config settings to ensure I did not commit any sensitive information.

So, gigaw.at is on my github, under a GPL3 license, and it’s now back up and running over at heroku, and using compose as my mongoDB provider. Feel free to grab the code, and play around (note it’s made using OpenBD, and I need to write up a readme for information on how to get running)

URLrewrite with OpenBD

I love a good clean URL, and recently I decided that I wanted to clean up the way I was handling URLs in my web apps. while this is easily achieved using say nginx or apache, or which ever server you are using. I had a unique requirement that I wanted to be able to handle the rewrites locally without having to have to install nginx or something on top of what I was already using. Also I did not want to have a separate server config to maintain. I was after a way I could have the settings checked in with the web application code so it would work on the server and locally.

Locally I am developing using jettydesktop launcher, and I deploy to a server that’s running jetty, while I could have jetty handle it, it would mean loosing the ability to test locally easily by having the settings within the web app.

After some research and looking around I came across UrlRewriteFilter this is a jar file that can be dropped into the lib directory, a small update to the web.xml file to ensure its loaded. Then you have a configuration file where you can set up all your URL rewrites. The details are shown on the UrlRewriteFilter website, and it’s was a relativity painless to get up and running. But I did run into a small issue. After using the base config and it was all working with that correctly, I applied the changes I wanted for it to work for my web app, and I was getting lots of java string overflow errors. Some Googl’ing around lead me no further, so it became process of elimination to get it working.

The default config for the web.xml is

<filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>

But for me to remove the error’s I was seeing I had to remove the <dispatcher> lines to give me the following config:

<filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

After restarting jetty all was good. Few  more test’s and then I released it to my web server, and all seems to be working.

This jar file is now part of my base web app structure that I use for all new web apps, and I’ll be updating my other apps soon.

Multiple OpenBD installs with one jetty

This is a copy of my reply to a message on the OpenBD Mailing List, and as I think it’s a great use for others I have decided to post it on here.

If I have gotten this correct you are wanting an OpenBD JAM install and be able to run two OpenBD sites from the one ./openbdjam command

For example:

www.mysite.com
www.myothersite.com

to be severed from the same server, and same OpenBD JAM install?

If this is right, this is what you need to do to get it working:

Note – This is from a clean install

By default the webroot for the JAM install is /opt/openbdjam/webroot/ – You will need to duplicate this folder (or uploaded your own webroot containing a site), I created a webrootb folder like : /opt/openbdjam/webrootb/

Now you need to navigate to the jetty contexts folder: /opt/openbdjam/jetty/contexts/
You will see a file called webroot-context.xml here, this is the file that points to the default webroot, we need to make another one of these files (use the cp command, then we only need to edit a couple of lines), I called mine webrootb.xml

Open up webroot-context.xml and un comment the virtualHosts block and inside the < Item>< /item> Put the web address you want to use to access the site located in /opt/openbdjam/webroot/
eg. < Item>www.mysite.com< /Item>
Save and close the file

Now open the webrootb.xml file and edit the 7th line to point to the new webrootb folder, then also un comment the virtualHosts block and change the line to the web address you wish to access this OpenBD site from
eg. < Item>www.myothersite.com< /Item>
Save and close the file

Note : You need to point the A record for your domain(s) to the IP of your server

Now stop OpenBDJAM, and then start OpenBDJAM

Try and access your two sites

OpenBD Manual Chrome Extension

OpenBD Chrome Extension

On Tuesday 11th December I put the OpenBD Manual Google Chrome Extension live, and have done a little promoting of it. This morning I was doing some checking of different things and decided to check the stats for the extension. Google Chrome is reporting it has 22 users, I know this is not huge numbers but as it’s only a chrome extension I know a lot of developers who use Firefox then we are missing some users here. But all in all I am very happy that there are people who have taken their time to download it, and I hope they are using it.

The extension is a simple way to get direct access to the tags and functions direct from the OpenBD Manual, while it’s not a full blown version of the manual in the extension, it provides you will a summary, the usage of the tag/function and the Attributes available, which I feel is enough for a quick reference.