Moving a postgresql database from heroku to your dokku instance

I have enjoyed hosting a few apps on Heroku, but recently wanted to give dokku a shot.  A few of my apps have production data stored in postgres databases,and I wanted to move that data over to my dokku containers for testing.

I found a process that seemed to work fairly painlessly for me.  here are the steps:

Backup the database on Heroku and retrieve backup file:

connect to heroku using the heroku command line (don’t have it?  use ‘apt-get install heroku-toolbelt’ in linux).  Login using ‘heroku login’ and enter your Heroku credentials when prompted.

$ heroku login
Enter your Heroku credentials.
Email: <your email>
Password (typing will be hidden): <your password>
Authentication successful.

Backup the database:

$ heroku pg:backups capture --app <YOURAPP>

Use Ctrl-C at any time to stop monitoring progress; the backup
will continue running. Use heroku pg:backups info to check progress.
Stop a running backup with heroku pg:backups cancel.


Backup completed

Get the public url for the backup file:

$ heroku pg:backups public-url --app <YOURAPP>

The following URL will expire at 2015-05-16 18:30:19 +0000:
 <"Very Long AWS URL">

Paste that url into your browser (or use wget, but I couldn’t get that to work with the AWS url, if you know a way to make that work, please post a comment).  And download the file.

Upload that file to an easily accessible directory on your dokku host.

Restoring the database to your dokku app

I found that deleting, creating, and finally restoring the database worked well.  First, let’s delete the current database:

$ dokku postgresql:delete <YOURAPP>

-----> PostgreSQL container deleted: postgresql/<YOURAPP>

Next, re-create a clean database.  This will cause dokku to redeploy the app as well:

$ dokku postgresql:create <YOURAPP>

-----> Setting config vars
 DATABASE_URL: postgres://root:GfOLmcTje92sJ79x@<YOUR SERVER IP>:32776/db
-----> Restarting app <YOURAPP>
-----> Releasing <YOURAPP> ...
-----> Deploying <YOURAPP>...
-----> Running pre-flight checks
 CHECKS file not found in container: running simple container check...
-----> Waiting for 35 seconds ...
-----> Default container check successful!
=====> <YOURAPP> container output:
 [2015-05-16 18:25:52] INFO WEBrick 1.3.1
 [2015-05-16 18:25:52] INFO ruby 2.0.0 (2015-04-13) [x86_64-linux]
 [2015-05-16 18:25:52] INFO WEBrick::HTTPServer#start: pid=14 port=5000
=====> end <YOURAPP> container output
-----> Running post-deploy
-----> Shutting down old container in 60 seconds
=====> Application deployed:
 http://<YOURAPP URL>

-----> <YOURAPP> linked to postgresql/<YOURAPP> database

-----> PostgreSQL container created: postgresql/<YOURAPP>

 Port: 32776
 User: 'root'
 Password: 'thepassword'
 Database: 'db'

 Url: 'postgres://root:GfOLmcTje92sJ79x@<YOUR SERVER IP>:32776/db'

Now all that’s left is to restore the database, I had difficulty doing this, but found this syntax (local postgresql command piped into dokku command) here:

pg_restore -O <backup_name.sql> | dokku postgresql:restore <database>

-----> <YOURAPP> database restored

Your production database should now be restored to your dokku app and data should be synced to the database at the time of backup.

Aquapod 24 LED Retrofit

I have been wanting to upgrade the lighting on my Aquapod 24 gallon.  In doing my research, I didn’t find many other writeups on retrofitting this tank with LEDs.  I’m not even sure if this tank is being manufactured anymore.  I’ve detailed the steps I took to perform the retrofit here for anyone else who owns one of these tanks.  Of course, the process should be similar for other pod-style tanks as well.

Design Requirements:

  • ability to independently dim each ‘channel’, that is, blue/white.
  • ability to control dimming via Arduino / PWM
  • low heat generation
  • As OEM – looking as possible (didn’t want a bunch of new wires or holes drilled into the hood)
  • Low noise from any active cooling
  • Remote power supply and drivers (to reduce cooling need and complexity inside the hood)

System specs:

I chose to go with a setup from  This system uses tubular heatsinks (square aluminum tubing) and a blower-style fan to achieve active cooling.  I liked this because it would allow me to keep the necessary low profile to keep everything contained in the original hood and still use the stock light-cover.  I’m sure this could still be done with a standard block-fin style heatsink, but it seems like it would be more challenging.

Parts used:

  • 3′ 1.5″ Aluminum heatsink tubing
  • 7 Royal Blue Luxeon ES LED
  • 4 Cool White Luxeon ES LED
  • 3 Neutral White Luxeon ES LED
  • 1 Pressurized cooling fan
  • 2 Single Drivers (these are manufactured by Steve’s LEDs)
  • 1 200w 24v switching power supply

You’ll notice above that I have a mix of two different white LED types.  After doing some research on forums such as and I noticed that some people like the look of a warmer white than the standard cool whites that are being used (see this thread for a very detailed discussion on LED color aesthetics).  After some consideration and viewing both, I found the color temperatures of the Luxeon Cool and Neutrals to be fairly similar.  I decided to just use both on the white ‘channel’ in order to give a little more warmth to the color.

The Build:

This is the hood before installation, 2x 32w Power Compacts:

The thing I really like about the blower fans that come with this kit is that they are easily mounted by removing the cover and drilling mounting holes as appropriate:

As you can see, the intake doesn't line up perfectly with the fan grate on the tank hood (the bottom of the fan hits the edge of the hood), but it's good enough.

Below, you can see the back-side of the hood.  I’ve had this tank for about 4 years now, and there is a lot of salt creep inside here.  Kind of scary considering that this is all high voltage (for now).  I decided to just strip off the ends of the 120v cords and use them to power each channel of the LED setup.  This will keep a stock look.  All drivers/power supply/controllers will be remote.

The heat sinks were very easy to install into the hood using pre-existing screw holes.  I just drilled an access hole into the top of the heatsink (to get a screwdriver through) and a screw hole through the bottom and used hardware scavenged from dis-assembly.  And now for the part of the build that I am not particularly proud of, I used JB weld to attach the heat-sink pieces together.  Welding the pieces together would have been superior both in terms of structural integrity and thermal management.  Frankly, I just didn’t feel like making the effort.  I drilled holes through the sides of the adjoining tubing pieces that met at 90 degree angles and capped the end of the tube coming out of the blower-fan with tape.  Below you can see the heat-sinks installed and blower-fan mounted.  Sorry for the lack of intermediate photographs.  As you can see, I also added a piece of scrap aluminum tubing to help with rigidity and as an additional thermal mass.

Below, all LEDs are mounted n the heatsink and wired.  The color of the wires does not correspond with anything.

A note about the LED pattern.  After reading about color-shadowing issues (the effect of point-light sources of different colors leaving multicolor shadows in the tank) on reef-central, I decided to locate the blue and white LEDs as close to eachother as possible.  What you see above are groups of one blue and one white butted (where possible) to one another.

The Power Supply unit:

I lucked out on finding a ‘project box’ for the power supply and drivers.  I had an old SFF PC case laying around that I just couldn’t bring myself to throw away.  It worked out perfectly in that it’s big enough to put all the components in, and it’s made of aluminum.  So it looks good and should be easy enough to keep cool.  It’s pretty big, but for this application that will be allright.  I plan on adding an arduino to control the drivers via PWM later, so having some extra space will be helpful:

LED channels plug into the terminal block, Pots for dimming stick out of already machined holes in the case.
Power supply mounted perfectly in the HDD tray.
Kind of hard to make this out in the picture, but the LED drivers are both mounted to the bottom of a cpu cooler which hangs from the same assembly the Power Supply sits in.
Complete, with panels on.

One thing I wanted to mention is that I wired the blower fan in series with the two fans inside the power supply case.  That is, the two power supply fans are parallel and then in series with the blower.  I did this because while the blower fan has a voltage regulator built in, it gets quite hot when throttling the 24v from the power supply down to the needed 12v.  As well, I found that I didn’t need the blower running at full speed to keep things cool. This setup runs very quietly and still moves quite a bit of air.  All temps so far seem to be okay so far (haven’t measured exit temps above 90 degrees on the heat sinks).

Here is the setup installed and operational:

Yes, I am aware that this picture is horrible.


I’m very pleased with both the light quality and output of this retrofit.  The perceivable brightness has been greatly increased.  I would say that running the dimmers at about 50% is about comparable to stock.  I have not yet run this setup at 100% for a long period of time (my understanding is that corals should be acclimated to more intense lighting provided by LEDs).  Even once the corals are acclimated, I don’t think I’d want to have the setup running at 100% for too long, it’s just a bit too bright for my liking.  Besides, this tank is all softies and LPS right now.  Also, being able to dim each channel independently is a must-have, in my opinion.  Being able to set the color temperature at will is very cool.
I had quite a bit of success with avoiding color-shadowing by placing the whites and blues right next to each other.  However, there is still some perceivable color-shadowing in some areas, but it’s not distracting.  I think a certain amount of this is unavoidable in a tank like this.

Next steps:

I plan on controlling the dimming via Arduino at some point.  The drivers have both the option for potentiometer dimming (as currently setup) or PWM.