Moving from Heroku to Dokku

October 3, 2015 by · Leave a Comment 

With Heroku’s recent changes to their plan offerings, my hosting costs were suddenly about to increase form $0 a month to $42. To run an app 24 hrs a day, you need to be on the hobby tier ($7/month). Not really happy with that, I decided to look elsewhere.

I had previously explored Amazon’s elastic beanstalk PaaS, but this time around I wanted to try hosting my own PaaS. Dokku bills itself as being a “Docker powered mini-Heroku in around 200 lines of Bash”. After reading good things about it, I decided to give it a shot on a Digitial Ocean dropet.

Spin Up

First, create a Digital Ocean account. You can use my referral link to get $10 of free credit, enough for 2 months continual use of the smallest droplet.

Create a new droplet and choose a droplet name.

Select Size. I went with the smallest option ($5/month, 512mb, 20gb).

Select Image > Applications > Dokku, to create your droplet with Dokku pre-installed on the latest Ubuntu.

Add an SSH key, then click ‘Create’ to finish.

Once the droplet has been created, Digitial Ocean sends an email containing the IP / login details.

Now we can connect via ssh.

ssh root@[SERVER-IP]

On first login, you will be prompted to set a new password. At this point, it’s also a good idea to disable root password access, and just use SSH keys.

Dokku Setup

Load up the Server IP in your browser to complete installation via the web-based installer. From there you can set a hostname and set your SSH public key.

Deploy An Application

Deployment is much the same as with Heroku. I didn’t need to make and file changes specifically for Dokku.

Just add the dokku server as a remote and push.

git remote add [REMOTE-NAME] dokku@[SERVER-IP]:[GIT-REPO-NAME]
git push [REMOTE-NAME] master

Build process will kick off and app will start.

App Configuration

Each application has an ENV file located at /home/dokku/[app-name]/ENV.

You can set configuration keys via:

dokku config:set [app-name] KEY1=VALUE1

Worker Processes and Auto-Restarting

Standard dokku is only setup to run web processes. A few of my apps are actually just worker processes. dokku-supervisord plugin can be used to run all process types.

Additionally, crashed processes will be automatically restarted.

git clone /var/lib/dokku/plugins/dokku-supervisord
dokku plugins-install

Memory Issues

As droplet I’m using only has 512mb of memory, it can run out pretty quickly with multiple dokku apps running. Unfortunately, when this happens the error shown isn’t so clear.

! [remote rejected] master -> master (pre-receive hook declined)

To get around this, we can resize the swap file:

cd /var
touch swap.img
chmod 600 swap.img

dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img

echo "/var/swap.img none swap sw 0 0" >> /etc/fstab

This was actually all mentioned on the Dokku Advanced Installation guide, which I missed the first time.

So Far So Good…

I’ve been pretty impressed with how Dokku just works straight out of the box. So far with my fairly straight forward node.js apps, I haven’t run into any issues. Fingers crossed that won’t change.

AWS Elastic Beanstalk – My Experiences

December 27, 2014 by · 1 Comment 

After using Heroku for the past 12 months, I decided to try out Amazon’s PaaS offering – Elastic Beanstalk.


I first decided created an application via the AWS console, by following the guided steps. However this actually just creates a sample application named ‘My First Elastic Beanstalk Application’. It is not possible to rename it, so there’s little point pushing your own code to it.

Amazon provies a Command Line Interface (CLI) for Elastic Beanstalk which was easy to install and setup. Creating a new application could then be initiated with:

eb init


Code can be pushed from a git repository to EB with:

eb push

Then some 10 – 15 minutes later, the application will restart with the newly pushed code. This is quite painful compared to Heroku, which would be updated in seconds. I’d also find the CLI would give a timeout error, however the code would still get pushed correctly.

From reading a few Stack Overflow posts it does seem like the config can be tweaked to somewhat speed up pushes, but I didn’t have much success.


Heroku’s CLI has a ‘logs’ function which can easily be tailed, but sadly EB’s CLI has no such feature. You can log directly into the EB EC2 instance and tail the log file, but this is still a headache. The AWS console provides a button to get the last 100 log lines. Rather than just display them though, it gives you a downloadable file, which is pretty cumbersome.

Logs are rotated every 15 minutes, which makes it hard when you just want to view what happened in the last hour.


I had previously been using Logentries as an add-on for Heroku, so I decided to give it a go with AWS.

I first tried using the le_aws script, which logs an EC2 instance, detects all the logs and imports them into Logentries. It painless to run, however logging was often missing chunks of lines, most likely due to the AWS 15 minute log rotation.

I then switched to using node-logentries module within my application and found it much more reliable.


The AWS Free-tier gives you enough hours to run one EC2 instance and a DB constantly. With each application runnning on it’s own instance, adding a 2nd or 3rd application will be outside the free tier. Whereas Heroku allows up to 100 applications.

Elastic IPs appear to be free for the first 5 as long as they are assigned to an EC2 instance. Otherwise you get charged for every hour they are not assigned but reserved to you, which is an easy trap to fall into.

There’s also no way to set a spend limit. You can set up billing alerts, but there’s still a chance of waking up to a huge bill if something goes wrong.

Bugzilla Attachment Icons & Image Previews User Script

September 26, 2012 by · Leave a Comment 

This user script adds file type icons and image thumbnails and previews to attachments websites running Bugzilla. Hovering the cursor over an image thumbnail will show a larger image.

Attachment Image Preview


The icons used in the script are from the Fatcow icon set.

The script can be found here.

Attachment File Type Icons


Tested on Firefox 15/GM 1.1.

Window-List: application indicator to display a list of open windows in Ubuntu Unity

June 2, 2012 by · 29 Comments 

Window-list displays a list of current open desktop windows. Windows can be activated by selecting them from the menu list.

After switching to Unity from Gnome, I immediately missed the bottom showing all the current open windows. In Unity, it’s easy to lose windows behind others. While you can retrieve them by clicking on the programs icon on the Unity dash, it can be cumbersome if you have multiple windows of the same program open.

I developed Window-List to solve this problem, by displaying a list of all open windows via an icon on the Unity top-panel indicator area.


Window-List is available for all versions of Ubuntu running Unity (Natty 11.04 onwards).

install via ppa:
sudo add-apt-repository ppa:jwigley/window-list
sudo apt-get update
sudo apt-get install window-list

Window-List can also be installed via deb package, which is also available from the launchpad repository.

run the window-list application by:


Window-List is released under the GPL 3.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

More information on the GNU General Public License is available here.

Override in-line CSS styles using the !important keyword

May 4, 2012 by · 3 Comments 

It’s possible to override in-line CSS with CSS from a user style sheet. By default, CSS styling set in a HTML document takes precedence over a user style sheet. However, we can overcome this by using the !important keyword.

The following HTML example has a in-line CSS style to set the width to 100px.

<table class="MyTable" style="width: 100px;">


Normally to style the table element, we’d use the following:

.MyTable {
    width: 200px;

However, as the style is set in-line, the in-line CSS style takes precedence over our style sheet.
We can get around this by using !important keyword, as follows:

.MyTable {
    width: 200px !important;

This now tells CSS that our ‘width’ rule takes precedence over the in-line defined style.

More information on the !important keyword and CSS inheritance can be found in the W3 CSS Specification.

Making Ubuntu Unity Look Beautiful By Enabling Transparency

April 27, 2012 by · 31 Comments 

Enabling transparency is one of simplest ways to beautify Ubuntu Unity. Unity has transparency disabled for most screen items by default. However, by following the steps below you can add transparency to your Ubuntu Unity desktop.

Top Panel Transparency

To enable transparency on the top panel, follow these steps:

Top Panel

1) Install Compiz Config Settings Manager
sudo apt-get install compizconfig-settings-manager compiz-plugins
2) Alt + F2, type ‘ccsm’ and press Enter to launch CCSM.
3) Click on the ‘Ubuntu Unity Plugin’ / ‘Experimental’ tab.
4) Modify the ‘Panel Opacity’ slider to change the panels transparency. Range 0 (transparent) – 1 (opaque).

Compiz – Top Panel Settings

Desktop Window Transparency

To enable transparency on desktop Windows, follow these steps:

1) Install Compiz Config Settings Manager (if you haven’t already)
sudo apt-get install compizconfig-settings-manager compiz-plugins
2) Alt + F2, type ‘ccsm’ and press Enter to launch CCSM.
3) Click on the ‘Opacity Brightness & Saturation’ Plugin / ‘Opacity’ tab.
4) Click ‘New’. Click ‘+’ and a new window will appear. Click ‘Grab’ and then select the desktop window on which you want to enable transparency. The name will then be filled into the Value field. Click ‘add’. Range 0 (transparent) – 100 (opaque).
5) Transparency can the be changed via the Window Values slider .
Some common window classes are ‘Ccsm’,’Nautilus’,’Dialog’,’Normal’,’Empathy’,’Gedit’,’Gnome-Terminal’

Desktop Window – Compiz

Menu Transparency

To enable transparency on Unity menus, follow these steps:

1) Install Compiz Config Settings Manager (if you haven’t already)
sudo apt-get install compizconfig-settings-manager compiz-plugins
2) Alt + F2, type ‘ccsm’ and press Enter to launch CCSM.
3) Click on the ‘Opacity Brightness & Saturation’ Plugin / ‘Opacity’ tab.
4) Click ‘New’. Type ‘Menu’ in the Windows field and adjust the Window Values slider to set the transparency level. Range 0 (transparent) – 100 (opaque).
5) Repeat step 5 for the following: ‘DropDownMenu’, ‘ToolTip’, ‘PopupMenu’.



Desktop Window Title Transparency

As well as having transparency on desktop windows, Ubuntu has the option to change transparency on the Window Title area.

12.04 and earlier:

1) Install Compiz Gnome and GConf Editor:
sudo apt-get install compiz-gnome gconf-editor
2) Alt+F2 , type ‘gconf-editor’ to open the GConf Editor.
3) Navigate to apps/gwd in the left panel.
4) Adjust the value column for ‘metacity_theme_active_opacity’ and ‘metacity_theme_opacity’ to set the window titles transparency. Range 0 (transparent) – 1 (opaque).


1) Install Compiz Gnome and DConf Editor:
sudo apt-get install compiz-gnome dconf-tools
2) Alt+F2 , type ‘dconf-editor’ to open the DConf Editor.
3) Navigate to org /compiz / gwd in the left panel.
4) Adjust the value column for ‘metacity_theme_active_opacity’ and ‘metacity_theme_opacity’ to set the window titles transparency. Range 0 (transparent) – 1 (opaque).

Window Title – GConf Editor

Window Title

How to block ads in ooVoo video chat

January 30, 2012 by · 10 Comments 

Blocking ads in ooVoo is a relatively simple process. There’s a few steps involved, but there’s nothing too complex.

How to block ads in ooVoo

1) Edit hosts files

Hosts file

a) Click Start. Enter ‘Notepad’ in the search.
b) Vista/7: Right-click on the Notepad icon and select ‘Run As Administrator’.
Other: Click the icon to ‘Open’.
c) In Notepad, click ‘File’, ‘Open’ and navigate to ‘C:\windows\system32\drivers\etc’.
d) Change the file-type to ‘All Files (*.*)’. Select the ‘hosts’ file and and click ‘Open’.
e) Add the following lines to the bottom of the document:

The above entries block anything coming from those website domains. So basically, we are just creating a list of all the places ooVoo gets it’s ads from, and blocking them.

If you discover a new place ooVoo is getting ads from, you can simply add it to the list. Alternatively you could use a comprehensive list of ad servers, such as the one found here.

Note: changes to the hosts file are system-wide. So changes you make affect any application that accesses the web, not just ooVoo.

2) Flush DNS cache

No Ads

a) Click Start. Enter ‘Cmd’ in the search.
b) Click the icon to ‘Open’.
c) Type the following: ipconfig /flushdns
Windows will report the cache was successfully flushed.

3) Restart DNS Service

a) Click Start. Enter ‘services.msc’ in the search.
b) Click the icon to ‘Open’.
c) Navigate to ‘DNS Cache’ in the list and right-click.
d) Select ‘Restart’.

4) Restart ooVoo.

a) ooVoo ads should now be replaced with a blank white box.

How to find where an ooVoo ad is from

Flash-based Ad

The ad will be one of the following two types. Identifying the source address is slightly different for each.

a) HTML based – Right-click on the ad, there will be a ‘Properties’ option. Select it and take note of the Address (URL).

b) Flash based – Right-click the ad, there will be a ‘Settings’ option. Select it and take note of the Address (URL) on the privacy tab.


OzBargain ‘My Comments’ Menu Item User Script – Updated

November 2, 2011 by · Leave a Comment 

This user script adds a ‘My Comments’ link to the main links bar on the OzBargain website, to allow quick navigation to the current logged in user’s ‘Comments’ page. This is helpful if you like to check back for replies to comments you’ve made, or simply see if anyone +1’d your post.

The script has been updated to match OzBargain’s October, 2011 UI update.

Tested on Google Chrome & Firefox 7/GM 0.9.12

My Comments menu item

My Comments menu item

The script can be found here.

Sony Ericsson Xperia Arc 2.3.4 (4.0.1.A.0.238) Update

October 20, 2011 by · Leave a Comment 

Recently Sony Ericsson released an update for the Xperia Arc, taking it from 2.3.3 to 2.3.4.

Update Available

The updates include the following notable changes:

– Screenshot option (via the Power button menu)

-Built in Swipe keyboard

– 3D Gallery application

– 3D/Sweep Panorama photo camera functionality

– Zoom during Video mode functionality

– Updated Time Widget

– Updated Facebook integration

– Automatic brightness option

-xLOUD speaker loudness option

– McAfee Security application pre-loaded

– Video/Music Unlimited applications pre-loaded

– Data Monitor application

The update is available OTA via Sony Ericsson’s PC Companion software.

Update Complete






Looping through key/value pairs from a Perl scalar hash reference

September 13, 2011 by · Leave a Comment 

If you’ve got a hash ( %hash ), it’s easy enough to loop through all the key/value pairs with the following:

foreach my $key ( keys %hash )
print "key: $key, value: $hash{$key}\n";

We could reference the hash with:

$href = \%hash;

As the hash element is scalar, the $ notation is used.

To access the key/value pairs in a hash reference, the syntax differs slightly from the first example.

foreach my $key ( keys %{ $href } )
print "key: $key, value: ${$href}{$key}\n";

Perlreftut contains a more in depth explanation of Perl references.

Next Page »