Page MenuHomeSoftware Heritage

[docker-compose] Harmonize and factorize PGSQL configuration
ClosedPublic

Authored by anlambert on Mar 27 2019, 1:59 PM.

Details

Summary

Previously, PostgreSQL configuration for the different swh services was not really consistent
(sometimes through an env file, sometimes overriding environment directly in docker-compose.yml).

Moreover, some bash code for pgsql service setup was duplicated in numerous entry points.

That diff aims to harmonize and factorize the pgsql setup through:

  • adding dedicated env files for pgsql database configuration
  • factorizing pgsql service setup in a bash function

The way to wait for a pgsql database to be up has also been improved and all swh services
should now be in a running state after a call to docker-compose up.

Diff Detail

Repository
rCDFD Dockerfiles for developers
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added a subscriber: ardumont.

I'm wondering if the unset PGHOST instruction could not be inverted though.

That is depending on the number occurrences (did not check), remove the PGHOST from the env file and explicit it where it's needed.
That'd avoid setting in the env and removing it in the declaration.

This revision is now accepted and ready to land.Mar 27 2019, 2:23 PM

For the record, I also tested to rename PGHOST into PG_HOST for removing the unset hacks in the docker-compose.yml file
but in that case, db initializations as performed here [1] for instance will fail.

[1] https://forge.softwareheritage.org/source/swh-docker-dev/browse/master/services/swh-vault/entrypoint.sh;c5a48242d23b80aef24ad2fca5d719a47e223ede$51-53

This revision was automatically updated to reflect the committed changes.