Browse Source

new: mac compatibility

framadate
Valentin Lab 5 years ago
parent
commit
c476af78a0
  1. 2
      nextcloud/actions/occ
  2. 6
      postgres/hooks/init
  3. 21
      postgres/lib/common

2
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]}"

6
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 <<EOF > "$HOST_DB_PASSFILE"
cat <<EOF > "$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

21
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

Loading…
Cancel
Save