mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
fix the database connection
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
7756826eb3
commit
e7dfb2514b
4 changed files with 29 additions and 6 deletions
|
|
@ -17,7 +17,9 @@ RUN set -ex; \
|
|||
chown -R postgres:postgres "$PGDATA"
|
||||
|
||||
COPY start.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/start.sh
|
||||
COPY init-user-db.sh /docker-entrypoint-initdb.d/
|
||||
RUN chmod +x /usr/bin/start.sh; \
|
||||
chmod +xr /docker-entrypoint-initdb.d/init-user-db.sh
|
||||
|
||||
RUN mkdir /mnt/data; \
|
||||
chown postgres:postgres /mnt/data;
|
||||
|
|
|
|||
9
Containers/postgresql/init-user-db.sh
Normal file
9
Containers/postgresql/init-user-db.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER "oc_$POSTGRES_USER" WITH PASSWORD "$POSTGRES_PASSWORD";
|
||||
GRANT ALL PRIVILEGES ON DATABASE "$POSTGRES_DB" TO "oc_$POSTGRES_USER";
|
||||
EOSQL
|
||||
|
||||
set +ex
|
||||
|
|
@ -18,11 +18,13 @@ if ! [ -w "$DUMP_DIR" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# # Delete the datadir once (needed for the migration from debian to alpine)
|
||||
# if ! [ -f "$DUMP_DIR/initial-cleanup-done" ]; then
|
||||
# rm -rf "${DATADIR:?}/"*
|
||||
# touch "$DUMP_DIR/initial-cleanup-done"
|
||||
# fi
|
||||
# Delete the datadir once (needed for setting the correct credentials on old instances once)
|
||||
if ! [ -f "$DUMP_DIR/export.failed" ] && ! [ -f "$DUMP_DIR/initial-cleanup-done" ]; then
|
||||
set -ex
|
||||
rm -rf "${DATADIR:?}/"*
|
||||
touch "$DUMP_DIR/initial-cleanup-done"
|
||||
set +ex
|
||||
fi
|
||||
|
||||
# Test if some things match
|
||||
# shellcheck disable=SC2235
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue