# Old Postgres on Docker Image with two containers: web and data

**URL:** https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503
**Category:** Self-hosting
**Tags:** two-container
**Created:** [November 18, 2020, 3:52pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503 "2020-11-18T15:52:55Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 3:52pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/1 "2020-11-18T15:52:55Z")

</div>

Hi All,

I’m stuck trying to upgrade a docker Discourse instance. I get the following error when I attempt to rebuild, bootstrap or in any other way setup the container:

```shell
I, [2020-11-18T15:23:37.357104 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
I, [2020-11-18T15:23:40.298932 #1] INFO -- : discourse-slack-official is already at latest compatible version
docker_manager is already at latest compatible version

I, [2020-11-18T15:23:40.299193 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

PG::SyntaxError: ERROR: syntax error at or near "NOT"
LINE 2: ADD COLUMN IF NOT EXISTS image_upload_id bigint
                      ^

```

From investigating, it seems like [postgresql 12 is required for the latest discourse](https://meta.discourse.org/t/error-with-update-stable-2-4-1-to-stable-2-5-1/162899) but this **currently isn’t packaged in the official docker image**.

It looks like there’s a development branch in the repo for [building the container with postgres12](https://github.com/discourse/discourse_docker/commit/245b0028c9db6352099b8f876f5646dd1a951f75) but no outstanding PRs or anything…

How can I go about fixing/updating my discourse installation? The update path is incorrect and now I’m fighting to get the forums back up asap!

---

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 4:03pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/2 "2020-11-18T16:03:48Z")

</div>

Additional note: the `pg12` branch also doesn’t work (even though it does seem to try and download a different container version), still getting the same error on db:migrate…

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [November 18, 2020, 4:23pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/3 "2020-11-18T16:23:37Z")

</div>

> [@stuts](#):
>
> From investigating, it seems like [postgresql 12 is required for the latest discourse](https://meta.discourse.org/t/error-with-update-stable-2-4-1-to-stable-2-5-1/162899) but this **currently isn’t packaged in the official docker image**.

That is not the case. The base image for Discourse ships with PostgreSQL for many months already, since [PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236).

Can you share you app.yml? Maybe you forced an old base image in it and forgout about it?

---

<div class="post-metadata">

### Author: ![simonk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonk/32/247950_2.png) [@simonk](https://meta.discourse.org/u/simonk)
#### Post date: [November 18, 2020, 4:24pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/4 "2020-11-18T16:24:50Z")

</div>

How old is your `discourse_docker` checkout? I know the `launcher` script is meant to update itself automatically, but iIt might be worth running `git pull` by hand just to be sure.

The latest base image [should be](https://github.com/discourse/discourse_docker/blob/master/launcher#L93):

```
image="discourse/base:2.0.20201004-2310"

```

What do you get if you run

```
docker images | grep discourse/base

```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [November 18, 2020, 4:28pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/5 "2020-11-18T16:28:25Z")

</div>

> [@stuts](#):
>
> ```plaintext
> I, [2020-11-18T15:23:40.298932 #1] INFO -- : discourse-slack-official is already at latest compatible version
> 
> ```

Also that plugin was deprecated 3 years ago 😱

---

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 4:28pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/6 "2020-11-18T16:28:35Z")

</div>

Strange, I’m on the latest commit:

```plaintext
$ git branch -v
* master 4a4b0f8 DOCS: correct syntax error in readme

```

And I seem to have the latest image:

```plaintext
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
discourse/base 2.0.20201004-2310 b64c37d7ab06 6 weeks ago 2.4GB
local_discourse/data latest 253fd4d68068 3 years ago 1.7GB

```

I’ve been sure to clear up old docker images and have attempted a rebuild of the `web` app multiple times.

Ahhh, do I need to rebuild the `data` container first or something? Haven’t touched it yet

---

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 4:29pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/7 "2020-11-18T16:29:13Z")

</div>

> Also that plugin was deprecated 3 years ago 😱

🙈 that’s next on my list to bring up-to-date but have been stuck with current update!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [November 18, 2020, 4:29pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/8 "2020-11-18T16:29:35Z")

</div>

Oh you are using the _advanced_ data setup?

You need to stop web and rebuild data to get all data software updated. There is a section for that in [PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236#data-container-install)

---

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 4:38pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/9 "2020-11-18T16:38:35Z")

</div>

Thanks for your help, rebuilding the `data` container now…

---

<div class="post-metadata">

### Author: ![stuts](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@stuts](https://meta.discourse.org/u/stuts)
#### Post date: [November 18, 2020, 4:42pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/10 "2020-11-18T16:42:38Z")

</div>

Okay that seems to have done it, thanks again all!

This is the sort of burn to be expected from inheriting a discourse installation and doing an upgrade for the first time 😅

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 18, 2020, 4:48pm UTC](https://meta.discourse.org/t/old-postgres-on-docker-image-with-two-containers-web-and-data/170503/11 "2020-12-18T16:48:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
