|
@ -6,13 +6,21 @@ export DB_NAME="$SERVICE_NAME" ## general type of datab |
|
|
export DB_DATADIR=/var/lib/postgresql/data |
|
|
export DB_DATADIR=/var/lib/postgresql/data |
|
|
|
|
|
|
|
|
export DATA_DIR=$SERVICE_DATASTORE$DB_DATADIR |
|
|
export DATA_DIR=$SERVICE_DATASTORE$DB_DATADIR |
|
|
export HOST_DB_PASSFILE="$DATA_DIR/pgpass" |
|
|
|
|
|
|
|
|
export LOCAL_DB_PASSFILE="$DATA_DIR/pgpass" |
|
|
|
|
|
|
|
|
export CLIENT_DB_PASSFILE="/root/.pgpass" |
|
|
export CLIENT_DB_PASSFILE="/root/.pgpass" |
|
|
export PG_HBA="$DATA_DIR/pg_hba.conf" |
|
|
export PG_HBA="$DATA_DIR/pg_hba.conf" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is_db_locked() { |
|
|
is_db_locked() { |
|
|
is_volume_used "$DATASTORE/${SERVICE_NAME}" |
|
|
|
|
|
|
|
|
local host_db_volume |
|
|
|
|
|
if [ "${HOST_DATASTORE+x}" ]; then |
|
|
|
|
|
host_db_volume="$HOST_DATASTORE/${SERVICE_NAME}$DB_DATADIR" |
|
|
|
|
|
else |
|
|
|
|
|
host_db_volume="$DATASTORE/${SERVICE_NAME}$DB_DATADIR" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
is_volume_used "$host_db_volume" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -23,6 +31,15 @@ _set_server_db_params() { |
|
|
_set_db_params() { |
|
|
_set_db_params() { |
|
|
local docker_ip="$1" docker_network="$2" |
|
|
local docker_ip="$1" docker_network="$2" |
|
|
|
|
|
|
|
|
|
|
|
if [ "${HOST_DATASTORE+x}" ]; then |
|
|
|
|
|
export HOST_DB_PASSFILE="$HOST_DATASTORE/${SERVICE_NAME}$DB_DATADIR/pgpass" |
|
|
|
|
|
else |
|
|
|
|
|
export HOST_DB_PASSFILE="$CLIENT_DB_PASSFILE" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
[ -f "$CLIENT_DB_PASSFILE" ] || touch "$CLIENT_DB_PASSFILE" |
|
|
|
|
|
|
|
|
|
|
|
debug "HOST_DB_PASSFILE is '$HOST_DB_PASSFILE'" |
|
|
db_docker_opts+=("--network" "$docker_network" |
|
|
db_docker_opts+=("--network" "$docker_network" |
|
|
"-e" PGHOST="$docker_ip" |
|
|
"-e" PGHOST="$docker_ip" |
|
|
"-e" PGUSER=postgres |
|
|
"-e" PGUSER=postgres |
|
|