Skip to content

Fix logic of starting database cluster with locale #532

@NyakudyaA

Description

@NyakudyaA

Feature description

The current logic in https://github.com/kartoza/docker-postgis/blob/develop/scripts/setup-database.sh#L38 allows us to create a database cluster with specific locales only if ${RECREATE_DATADIR} is set.

This then sets INITDB to initiate a cluster with the specific locale I.e

command="$INITDB -U postgres --pwfile=<(echo $POSTGRES_PASS) -E ${DEFAULT_ENCODING} --lc-collate=${DEFAULT_COLLATION} --lc-ctype=${DEFAULT_CTYPE} --wal-segsize=${WAL_SEGSIZE} --auth=${PASSWORD_AUTHENTICATION} -D ${DATADIR} ${INITDB_WALDIR_FLAG} ${INITDB_EXTRA_ARGS}"

With the env value set to

RECREATE_DATADIR any database restarts will result in wiping the database cluster repeatedly.

Also this means this DB always gets started with the default collate that's set when you install postgresql.

Possible solution

We need to add


DATADIR_RECREATE_MODE:
#   "never"      - Never recreate (default)
#   "once"       - Recreate once per container lifetime
#   "always"     - Recreate on every start
#   "empty"      - Recreate only if datadir is empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions