postgres dir var, nginx variable replacement, more permission modification

This commit is contained in:
dekzter 2025-04-02 16:28:58 -04:00
parent 88446fa753
commit 1b75fbc90a
2 changed files with 15 additions and 6 deletions

View file

@ -1,9 +1,9 @@
#!/bin/bash
# Temporary migration from postgres in /data to /data/db. Can likely remove
# Temporary migration from postgres in /data to $POSTGRES_DIR. Can likely remove
# some time in the future.
if [ -e "/data/postgresql.conf" ]; then
echo "Migrating PostgreSQL data from /data to /data/db..."
echo "Migrating PostgreSQL data from /data to $POSTGRES_DIR..."
# Create a temporary directory outside of /data
mkdir -p /tmp/postgres_migration
@ -12,17 +12,17 @@ if [ -e "/data/postgresql.conf" ]; then
mv /data/* /tmp/postgres_migration/
# Create the target directory
mkdir -p /data/db
mkdir -p $POSTGRES_DIR
# Move the files from temporary directory to the final location
mv /tmp/postgres_migration/* /data/db/
mv /tmp/postgres_migration/* $POSTGRES_DIR/
# Clean up the temporary directory
rmdir /tmp/postgres_migration
# Set proper ownership and permissions for PostgreSQL data directory
chown -R postgres:postgres /data/db
chmod 700 /data/db
chown -R postgres:postgres $POSTGRES_DIR
chmod 700 $POSTGRES_DIR
echo "Migration completed successfully."
fi

View file

@ -13,3 +13,12 @@ if [ "$(id -u)" = "0" ]; then
chown -R $PUID:$PGID /app
echo "Created and set permissions for cached_m3u directory"
fi
mkdir -p /data/logos
chown -R $PUID:$PGID /data/logos
# Permissions
chown -R postgres:postgres /data/db
# Set nginx port from ENV
sed -i "s/NGINX_PORT/${DISPATCHARR_PORT}/g" /etc/nginx/sites-enabled/default