diff --git a/nextcloud/actions/occ b/nextcloud/actions/occ index 98f7496..7c7a2db 100755 --- a/nextcloud/actions/occ +++ b/nextcloud/actions/occ @@ -28,7 +28,7 @@ fi ## supposed to exist). For that we need to make sure nextcloud have ## be ran and setup prior to running this next command. compose -q --no-init --no-relations run \ - -v "$CHARM_PATH/src/occ.batch:/var/www/html/occ.batch" \ + -v "$HOST_CHARM_STORE/${CHARM_REL_PATH#${CHARM_STORE}/}/src/occ.batch:/var/www/html/occ.batch" \ -T --rm -u www-data "$SERVICE_NAME" /var/www/html/occ.batch "$@" | cat exit "${PIPESTATUS[0]}" \ No newline at end of file diff --git a/postgres/hooks/init b/postgres/hooks/init index 60a5446..87c5419 100755 --- a/postgres/hooks/init +++ b/postgres/hooks/init @@ -19,13 +19,13 @@ set -e -if ! [ -f "$HOST_DB_PASSFILE" ]; then +if ! [ -f "$LOCAL_DB_PASSFILE" ]; then POSTGRES_ROOT_PASSWORD="$(gen_password)" ddb < <(echo "ALTER USER postgres WITH ENCRYPTED password '$POSTGRES_ROOT_PASSWORD'") - cat < "$HOST_DB_PASSFILE" + cat < "$LOCAL_DB_PASSFILE" *:*:*:postgres:$POSTGRES_ROOT_PASSWORD EOF - chmod 600 "$HOST_DB_PASSFILE" + chmod 600 "$LOCAL_DB_PASSFILE" info "New root password for postgres. " fi diff --git a/postgres/lib/common b/postgres/lib/common index 5fda527..cbdfc9f 100644 --- a/postgres/lib/common +++ b/postgres/lib/common @@ -6,13 +6,21 @@ export DB_NAME="$SERVICE_NAME" ## general type of datab export DB_DATADIR=/var/lib/postgresql/data 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 PG_HBA="$DATA_DIR/pg_hba.conf" 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() { 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" "-e" PGHOST="$docker_ip" "-e" PGUSER=postgres