Skip to content
Jakob Runge edited this page Nov 20, 2015 · 3 revisions

The postgres container

Executing postgres/run.sh starts an instance of postgres:9.3.10 passing it a postgres user and password. The container will run with a name of the form lingdb_postgres_$(date -I)_$(pwgen 5 1). This makes sure that for every instance of the container we will know the date it was started and that containers from the same date have different names. If an exited container following that naming convention is found, the volumes of that container will be reused, so that the database is kept between updates and restarts. We only run version 9.3.10 of this container to make sure the lingdb/postgres_create and lingdb/postgres_backup containers are compatible with the postgres version. This is due to an issue where the ubuntu:latest image has an older postgresql client available than we want with postgres:latest.

The postgres/create container

build.sh

Executing postgres/create/build.sh creates the lingdb/postgres_create image on the base of postgres:9.3.10 by adding create.sh as the entrypoint.

run.sh

postgres/create/run.sh executes the lingdb/postgres_create container linked against a running instance of lingdb_postgres. create.sh than creates the ielexdb201510 database and sets its ownership. If a postgres/create/dump.sql file is found that file will be inserted into the database. If in addition to the dump.sql file a postgres/create/alter.sql file is found, that file will be executed against the database last.

The postgres/backup container

build.sh

Running postgres/backup/build.sh builds the lingdb/postgres_backup image on top of postgres:9.3.10. It adds postgresql-client and backup.sh, which is also the entrypoint.

run.sh

postgres/backup/run.sh starts the lingdb/postgres_backup container linking it against a running lingdb.postgres container. The container will than produce backups by performing the steps described in backup.sh:

  • Create dump with current date
  • Delete all dumps except the last 10
  • Sleep 4 hours
Clone this wiki locally