Browse Source

minor fixes

main
Nicolas Massé 3 days ago
parent
commit
246d4f4696
  1. 3
      postgresql/config/config.env
  2. 5
      postgresql/config/init.sql
  3. 4
      postgresql/config/upgrade.sh
  4. 2
      postgresql/postgresql-backup.container
  5. 7
      postgresql/postgresql-init.container
  6. 6
      postgresql/postgresql-server.container
  7. 5
      postgresql/postgresql-upgrade.container

3
postgresql/config/config.env

@ -3,6 +3,7 @@ POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
POSTGRES_HOST_AUTH_METHOD=scram-sha-256
POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256
POSTGRES_ARGS=-h 127.0.0.1
PGPORT=5432
PG_MAJOR=14
PG_MAJOR=17
POSTGRES_BACKUP_RETENTION=7

5
postgresql/config/init.sql

@ -0,0 +1,5 @@
-- Initialization script for Nextcloud database and user
CREATE USER nextcloud WITH PASSWORD 'nextcloud';
CREATE DATABASE nextcloud OWNER nextcloud;
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
ALTER ROLE nextcloud SET client_encoding TO 'utf8';

4
postgresql/config/upgrade.sh

@ -144,6 +144,10 @@ fi
unset PGPASSWORD
docker_temp_server_stop
# Remove old data directory
echo "Removing old PostgreSQL data directory: ${SOURCE_PGDATA}"
rm -rf "${SOURCE_PGDATA}"
# Clean up lock files
rm -f "${SOURCE_PGDATA}/upgrade_in_progress.lock"
echo "PostgreSQL upgrade from version ${SOURCE_MAJOR_VERSION} to ${TARGET_MAJOR_VERSION} completed successfully."

2
postgresql/postgresql-backup.container

@ -19,6 +19,8 @@ EnvironmentFile=/etc/quadlets/postgresql/config.env
# Use a custom backup script
Entrypoint=/usr/local/bin/backup.sh
# No need for root privileges
User=postgres
# Volume mounts

7
postgresql/postgresql-init.container

@ -29,9 +29,16 @@ EnvironmentFile=/etc/quadlets/postgresql/config.env
# Use our entrypoint script to initialize the database
Entrypoint=/usr/local/bin/init.sh
# Set PostgreSQL command line arguments
Exec=${POSTGRES_ARGS}
# No need for root privileges
User=postgres
# Volume mounts
Volume=/var/lib/quadlets/postgresql:/var/lib/postgresql:z
Volume=/etc/quadlets/postgresql/init.sh:/usr/local/bin/init.sh:z,ro
Volume=/etc/quadlets/postgresql/init.sql:/docker-entrypoint-initdb.d/init.sql:z,ro
[Service]
Restart=no

6
postgresql/postgresql-server.container

@ -34,6 +34,12 @@ EnvironmentFile=/etc/quadlets/postgresql/config.env
# Volume mounts
Volume=/var/lib/quadlets/postgresql:/var/lib/postgresql:z
# Set PostgreSQL command line arguments
Exec=${POSTGRES_ARGS}
# No need for root privileges
User=postgres
# Health check
HealthCmd=pg_isready -U $POSTGRES_USER -d $POSTGRES_DB -p $PGPORT
HealthInterval=30s

5
postgresql/postgresql-upgrade.container

@ -27,8 +27,13 @@ EnvironmentFile=/etc/quadlets/postgresql/config.env
# Use our entrypoint script to upgrade the database
Entrypoint=/usr/local/bin/upgrade.sh
# No need for root privileges
User=postgres
# Set PostgreSQL command line arguments
Exec=${POSTGRES_ARGS}
# Volume mounts
Volume=/var/lib/quadlets/postgresql:/var/lib/postgresql:z
Volume=/etc/quadlets/postgresql/upgrade.sh:/usr/local/bin/upgrade.sh:z,ro

Loading…
Cancel
Save