Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

Latest release is not working #521

Open
Holt59 opened this issue Feb 24, 2021 · 11 comments
Open

Latest release is not working #521

Holt59 opened this issue Feb 24, 2021 · 11 comments

Comments

@Holt59
Copy link

Holt59 commented Feb 24, 2021

Release 5.32.x is not working.

app fails to start because postgres 10+ is required but the Dockerfile for db specifies 9.4-alpine.

@adatamonk
Copy link

adatamonk commented Feb 26, 2021

+1 seeing the same issue

{"level":"error","ts":1614369418.4518497,"caller":"commands/server.go:77","msg":"cannot create store: minimum required postgres version is 10.0; found 9.426"} Error: cannot create store: minimum required postgres version is 10.0; found 9.426

this is using for the DB : image: mattermost/mattermost-prod-db
and this for the app: image: mattermost/mattermost-team-edition

@ouafnico
Copy link

ouafnico commented Mar 2, 2021

Hi
A lot of discussion about this postgresql version problem here: #489

@adatamonk
Copy link

Ya but at leased new setups should not be broken - currently a brand new setup is not working either

@coltoneshaw
Copy link
Member

coltoneshaw commented Mar 3, 2021

@adatamonk & @Holt59 - If you're using a brand new setup, you'll have to edit the file /db/Dockerfile. Below is what I have working on my test instance. Note the postgres version is now 13.2-alpine and the python-dev package is now python3-dev.

FROM postgres:13.2-alpine

ENV DEFAULT_TIMEZONE UTC

# Install some packages to use WAL
RUN echo "azure<5.0.0" > pip-constraints.txt
RUN apk add --no-cache \
      build-base \
      curl \
      libc6-compat \
      libffi-dev \
      linux-headers \
      python3-dev \
      py-pip \
      py-cryptography \
      pv \
      libressl-dev \
    && pip install --upgrade pip \
    && pip --no-cache-dir install -c pip-constraints.txt 'wal-e<1.0.0' envdir \
    && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

# Add wale script
COPY setup-wale.sh /docker-entrypoint-initdb.d/

#Healthcheck to make sure container is ready
HEALTHCHECK CMD pg_isready -U $POSTGRES_USER -d $POSTGRES_DB || exit 1

# Add and configure entrypoint and command
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["postgres"]

VOLUME ["/var/run/postgresql", "/usr/share/postgresql/", "/var/lib/postgresql/data", "/tmp", "/etc/wal-e.d/env"]

This will not work directly for existing installs as you'll have to migrate your database to a new version

@adatamonk
Copy link

thanks @coltoneshaw - this is helpful. But do we know if the offical docker hub images are being fixed? it's easier to deploy those directly

@coltoneshaw
Copy link
Member

@adatamonk - if you're using an existing install you can check out my comment here.

For a fresh install, I would think the version in the docker hub images will be updated soon but I'm not sure of an ETA for that. I think it's a bit more complex than just swapping the versions since it could break quite a few existing installs if not careful.

@shurrman
Copy link

gets more and more outdated

@tweibert
Copy link

Ran into the same problem today when upgrading from 5.31 to 5.33.

PostgreSQL Dockerfile was easily fixed to use PostgreSQL 13 - kudos to @coltoneshaw!

Here's how I did the cluster upgrade using the image from tianon/postgres-upgrade. This is all done inside the directory used for the /var/lib/postgresql volume.

First thing, prepare the directory layout expected by the upgrade scripts: move the existing data directory into a new 9.4 directory, and also create an empty directory 13 for the target:

$ mkdir 9.4
$ mv data 9.4
$ mkdir 13

Then run the upgrade script:

$ docker run --rm -e PGUSER=mmuser -e POSTGRES_INITDB_ARGS="-U mmuser" -v "$PWD":/var/lib/postgresql "tianon/postgres-upgrade:9.4-to-13"

Note the use of the PGUSER=mmuser and POSTGRES_INITDB_ARGS="-U mmuser" env variables here, as Mattermost is using mmuser as the superuser name, rather than the default postgres.

If all goes well, you should see:

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh

The pg_hba.conf file is not migrated automatically, so we copy it over manually:

$ cp 9.4/data/pg_hba.conf 13/data/pg_hba.conf

Then it's time to move the new data folder back to where it belongs:

$ mv 13/data .

Now start the Mattermost db and app containers. If everything is working, you can remove the 9.4 directory and the leftover log files and scripts from the upgrade-process.

This worked for me - use at your own risk, and remember to make backups!

@avoulk
Copy link

avoulk commented Mar 26, 2021

I simply used the script of @coltoneshaw and it worked like a charm!

@adatamonk
Copy link

i hope they can fix up the docker hub version though so we don't have to deploy this way....

@shurrman
Copy link

Do not try to upgrade minor 5.31 to 5.33, it will brake your MTM service

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants