What version of Postgres should I be using on 1.6+

AI-generated summary

A user running Discourse 1.6+ noticed their Postgres version was 9.3 after a rebuild, despite a recent Docker upgrade to 9.5. watchmanmonitor shared the rebuild logs, which showed Postgres 9.5 being removed and 9.3 being installed. mpalmer explained that the issue is likely due to an outdated container definition, specifically the line templates: - "templates/postgres.9.3.template.yml", which should be updated to remove the .9.3 to use a more up-to-date version. watchmanmonitor confirmed this and believes the issue arose from a recent upgrade, specifically the Discourse Docker image version 1.3.3 release.

There was a major docker upgrade about 1-2 months ago, and I think it upgraded to postgres 9.5?

I just did a ./launcher rebuild app today and saw that postgres 9.3 is in use…

:/var/discourse# ./launcher rebuild app
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 10 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2016-08-25T01:35:26.444275 #13]  INFO -- : Loading --stdin
I, [2016-08-25T01:35:26.452811 #13]  INFO -- : > echo cron is now included in base image, remove from templates
I, [2016-08-25T01:35:26.454853 #13]  INFO -- : cron is now included in base image, remove from templates

I, [2016-08-25T01:35:26.455114 #13]  INFO -- : > apt-get remove -y postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5
I, [2016-08-25T01:35:29.102101 #13]  INFO -- : Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 26.0 MB disk space will be freed.
(Reading database ... 34207 files and directories currently installed.)
Removing postgresql-contrib-9.5 (9.5.3-1.pgdg16.04+1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/9.5/man/man1/postmaster.1.gz because link group postmaster.1.gz is broken
Removing postgresql-9.5 (9.5.3-1.pgdg16.04+1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Removing postgresql-client-9.5 (9.5.3-1.pgdg16.04+1) ...
Processing triggers for postgresql-common (174.pgdg16.04+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:

I, [2016-08-25T01:35:29.103654 #13]  INFO -- : > apt-get update && apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
dpkg-preconfigure: unable to re-open stdin: 
I, [2016-08-25T01:35:40.684581 #13]  INFO -- : Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease

(the logs continue normally, and the site is up & running now.

But I wonder.. did I skip a step in the recent upgrade, and if so, what changes do I need to make (ostensibly in my app.yml)?

Thanks!

In general, you should be running PostgreSQL 9.5.

The commands that pups ran are only present in the postgres.9.3.template.yml file; presumably, somewhere in your container definition you’ve got something that looks like:

templates:
  - "templates/postgres.9.3.template.yml"

If you remove the .9.3 from there, you’ll have a much more up-to-date time.

Ah, perfect, thanks!

It was this upgrade:

https://meta.discourse.org/t/discourse-docker-image-version-1-3-3-released/44778

that brought this on, I think, and it’s because this discourse of mine was set up so long ago.

I’ll post a new topic about cleaning up the mess that change made :wink: