Update PostgreSQL version to 13 in TravisCI

I have some issues with the TravisCI platform when I try to test the code when Pull Requesting some changes. It works fine so far, but now I get this warning in the build-run log when I run the travis_apt_get_update command:

The PostgreSQL version 9.4 is obsolete, but the server or client packages are still installed. Please install the latest packages (postgresql-13 and postgresql-client-13) and upgrade the existing clusters with pg_upgradecluster (see manpage).

I have added the postgresql-13 and postgresql-client-13 packages, here is the .travis.yml file:

language: perl
perl:
  - "5.30"
dist: xenial
env:
  - HOST_URL="localhost"
cache:
  directories:
    - $HOME/path/to/local
services:
  - postgresql
addons:
  postgresql: 13
  apt:
    packages:
    - postgresql-13
    - postgresql-client-13
    - libpq-dev
    - build-essential
    - libssl-dev
    - zlib1g-dev
    - clang-tidy
env:
  global:
    - PGPORT=5433
before_install:
  - wget http://mirrors.kernel.org/ubuntu/pool/universe/a/astyle/astyle_3.1-1ubuntu2_amd64.deb
  - sudo dpkg -i astyle_3.1-1ubuntu2_amd64.deb
  - sudo chmod -R 777 /var/log/

Now, in the log it says that I have to upgrade the clusters with pg_upgradecluster , but I really don’t know what that means. Any help would be appreciated.

I’ve coded out an example that shows you how to run Postgres13 within your Ubuntu jobs on Travis. You can configure/add additional configuration as your setup and see if that helps:

dist: focal
language: ruby

addons:
  postgresql: '13'
  apt:
      packages:
        - postgresql-13
env:
  global:
   - PGUSER=postgres
   - PGPORT=5432
   - PGHOST=localhost
before_install:
 - sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
 - sudo service postgresql restart
 - sleep 1
 - postgres --version

script:
  - psql -c 'create database travis_ci_test;' -U postgres

This should do the trick.

1 Like

thanks @montana! this worked

Hey,

No problem @Spineswitch.

Cheers,
Montana Mendy (Travis CI Staff)