Implemented #217

This commit is contained in:
Xoconoch
2025-08-09 11:54:44 -06:00
parent 92656cc50e
commit 984cf6803e
3 changed files with 39 additions and 36 deletions

View File

@@ -28,6 +28,8 @@ PGID=1000
# Optional: Sets the default file permissions for newly created files within the container. # Optional: Sets the default file permissions for newly created files within the container.
UMASK=0022 UMASK=0022
# Whether to setup file permissions on startup. May improve performance on remote/slow filesystems
SKIP_SET_PERMISSIONS=false
### ###
### Multi-user settings, disabled by default. ### Multi-user settings, disabled by default.

View File

@@ -2,42 +2,17 @@ name: spotizerr
services: services:
spotizerr: spotizerr:
image: cooldockerizer93/spotizerr image: cooldockerizer93/spotizerr:beta
volumes: volumes:
- ./data:/app/data - ./data:/app/data
- ./downloads:/app/downloads # <-- Change this for your music library dir - ./downloads:/app/downloads # <-- Change this for your music library dir
- ./logs:/app/logs # <-- Volume for persistent logs - ./logs:/app/logs # <-- Volume for persistent logs
ports: ports:
- 7171:7171 - 7171:7171
build:
context: .
dockerfile: Dockerfile
container_name: spotizerr-app container_name: spotizerr-app
restart: unless-stopped restart: unless-stopped
environment: env_file:
- PUID=${PUID} # Replace with your desired user ID | Remove both if you want to run as root (not recommended, might result in unreadable files) - .env
- PGID=${PGID} # Replace with your desired group ID | The user must have write permissions in the volume mapped to /app/downloads
- UMASK=${UMASK} # Optional: Sets the default file permissions for newly created files within the container.
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
- REDIS_DB=${REDIS_DB}
- REDIS_PASSWORD=${REDIS_PASSWORD} # Optional, Redis AUTH password. Leave empty if not using authentication
- REDIS_URL=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}
- REDIS_BACKEND=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}
- EXPLICIT_FILTER=${EXPLICIT_FILTER} # Set to true to filter out explicit content
- ENABLE_AUTH=${ENABLE_AUTH} # Set to true to enable authentication
- JWT_SECRET=${JWT_SECRET} # Set to a random string for production
- JWT_EXPIRATION_HOURS=${JWT_EXPIRATION_HOURS} # Set to 24 for 24 hours
- DEFAULT_ADMIN_USERNAME=${DEFAULT_ADMIN_USERNAME} # Set to admin
- DEFAULT_ADMIN_PASSWORD=${DEFAULT_ADMIN_PASSWORD} # Set to admin123
- SSO_ENABLED=${SSO_ENABLED} # Set to true to enable SSO
- SSO_BASE_REDIRECT_URI=${SSO_BASE_REDIRECT_URI} # Set to http://127.0.0.1:7171/api/auth/sso/callback
- FRONTEND_URL=${FRONTEND_URL} # Frontend URL for SSO redirects
- DISABLE_REGISTRATION=${DISABLE_REGISTRATION} # Set to true to disable registration
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID} # Google SSO client ID
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET} # Google SSO client secret
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID} # GitHub SSO client ID
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET} # GitHub SSO client secret
depends_on: depends_on:
- redis - redis
@@ -46,11 +21,11 @@ services:
image: redis:alpine image: redis:alpine
container_name: spotizerr-redis container_name: spotizerr-redis
restart: unless-stopped restart: unless-stopped
environment: env_file:
- REDIS_PASSWORD=${REDIS_PASSWORD} - .env
volumes: volumes:
- redis-data:/data - redis-data:/data
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes command: sh -c 'redis-server --requirepass "$REDIS_PASSWORD" --appendonly yes'
volumes: volumes:
redis-data: redis-data:

View File

@@ -1,4 +1,3 @@
#!/bin/bash
set -e set -e
# Set umask if UMASK variable is provided # Set umask if UMASK variable is provided
@@ -6,6 +5,28 @@ if [ -n "${UMASK}" ]; then
umask "${UMASK}" umask "${UMASK}"
fi fi
# Compose Redis URLs from base variables if not explicitly provided
if [ -z "${REDIS_URL}" ]; then
REDIS_HOST=${REDIS_HOST:-redis}
REDIS_PORT=${REDIS_PORT:-6379}
REDIS_DB=${REDIS_DB:-0}
if [ -n "${REDIS_PASSWORD}" ]; then
if [ -n "${REDIS_USERNAME}" ]; then
AUTH_PART="${REDIS_USERNAME}:${REDIS_PASSWORD}@"
else
AUTH_PART=":${REDIS_PASSWORD}@"
fi
else
AUTH_PART=""
fi
export REDIS_URL="redis://${AUTH_PART}${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}"
fi
if [ -z "${REDIS_BACKEND}" ]; then
export REDIS_BACKEND="${REDIS_URL}"
fi
# Redis is now in a separate container so we don't need to start it locally # Redis is now in a separate container so we don't need to start it locally
echo "Using Redis at ${REDIS_URL}" echo "Using Redis at ${REDIS_URL}"
@@ -50,10 +71,15 @@ else
echo "Created user: ${USER_NAME} (UID: ${PUID})" echo "Created user: ${USER_NAME} (UID: ${PUID})"
fi fi
# Ensure proper permissions for all app directories # Ensure proper permissions for all app directories unless skipped via env var
if [ "${SKIP_SET_PERMISSIONS}" = "true" ] || [ "${SKIP_SET_PERMISSIONS}" = "1" ]; then
echo "SKIP_SET_PERMISSIONS is set; skipping permissions for /app/downloads /app/data /app/logs"
else
echo "Setting permissions for /app directories..." echo "Setting permissions for /app directories..."
chown -R "${USER_NAME}:${GROUP_NAME}" /app/downloads /app/data /app/logs || true chown -R "${USER_NAME}:${GROUP_NAME}" /app/downloads /app/data /app/logs || true
# Ensure Spotipy cache file exists and is writable fi
# Ensure Spotipy cache file exists and is writable (fast, local to container)
touch /app/.cache || true touch /app/.cache || true
chown "${USER_NAME}:${GROUP_NAME}" /app/.cache || true chown "${USER_NAME}:${GROUP_NAME}" /app/.cache || true