How to upgrade Dokku's PostgreSQL?

August 8, 2015 907 views
Dokku PostgreSQL Ubuntu

Hey guys, I am using this potsgres plugin:
But they don't provide any info on how to upgrade the postgresql version.

There is a fork that supports 9.4 version ( so I removed the old one, installed the new one, but nothing happens.

The old db is still running and I don't want to mess with it since there is no manual on how to do it.

Hopefully this helps other folks than just me.

1 Answer

Unfortunately, there is no easy way to accomplish this except for forking the plugin. With Dokku, everything is running inside of Docker containers including the database. If you look at the install script for Kloadut/dokku-pg-plugin, you'll see that it builds a Docker image based on this Dockerfile:

FROM    ubuntu:trusty
MAINTAINER  kload ""

# prevent apt from starting postgres right after the installation
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d; chmod +x /usr/sbin/policy-rc.d

RUN apt-get update
RUN LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y -q postgresql-9.3 postgresql-contrib-9.3
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get clean

# allow autostart again
RUN rm /usr/sbin/policy-rc.d

ADD . /usr/bin
RUN chmod +x /usr/bin/
RUN echo 'host all all md5' >> /etc/postgresql/9.3/main/pg_hba.conf
RUN sed -i -e"s/var\/lib/opt/g" /etc/postgresql/9.3/main/postgresql.conf

So the only way to run a different version of Postgres would be to fork the plugin and have it use a different Dockerfile.

Have another answer? Share your knowledge.