opendatacube / datacube-wps

Web Processing Service running on opendatacube
Other
7 stars 3 forks source link

Continuous Integration error configuring sample db #137

Closed benjimin closed 2 years ago

benjimin commented 2 years ago

Tests failing in CI, for runs that previously succeeded and that still succeed locally. (Also impacts #134.) Involves populating the sample database, i.e. in setup-db.sh.

One example run:

CREATE TABLE
FATAL:  terminating connection due to administrator command
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

Another example run:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Note, the docker compose file appears to pin the postgres image version.

benjimin commented 2 years ago

Wondering if it could be a conflict with the Postgres provided by the GitHub Actions environment? (Apparently there was a version bump in early october?)

benjimin commented 2 years ago

It seems like the CI broke sometime between roughly Nov 16th and 25th.

Incidentally, the Nov 22 update to the virtual environment used by github actions is claiming to have bumped the version of docker compose (not docker-compose) from 2.0 to 2.1 (and docker buildx from 0.6 to 0.7). It also bumped postgres from 14.0 to 14.1, with further postgres install script changes (using a toolset rather than directly installing the client).

The offending code seems to be, more or less:

docker-compose up -d
docker-compose exec -T -u postgres postgres psql < dump.sql

which now evokes psql: could not connect to server etc (but previously succeeded).

The docker-compose.yml contains:

services:
  postgres:
    image: postgres:11.5-alpine
    ports:
      - "127.0.0.1:5432:5432"
benjimin commented 2 years ago

Seems the problem was a race condition, that the runner was trying to use the psql client before the postgres service was ready (i.e. when the postgres container had only just started).