feat: add docker-compose files for S3 and local filesystem storage options

Introduce three new docker-compose files: docker-compose-file-system.yaml for local filesystem storage, docker-compose-s3-minio.yaml for MinIO S3-compatible storage, and docker-compose-s3.yaml for direct S3 storage. Each configuration includes environment variables for service setup, health checks, and persistent volume management. This enhances deployment flexibility for the Palmr application.
This commit is contained in:
Daniel Luiz Alves
2025-05-28 18:07:16 -03:00
parent 8290ccaaa9
commit fff4675aa3
18 changed files with 453 additions and 244 deletions

View File

@@ -1,82 +0,0 @@
services:
palmr:
image: kyantech/palmr:latest # Make sure to use the correct version (latest) of the image
container_name: palmr
depends_on:
postgres:
condition: "service_healthy"
environment:
# Storage Configuration
- ENABLE_S3=${ENABLE_S3:-false} # Set to 'false' to use local filesystem storage instead of S3/MinIO or true to use S3/MinIO
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-change-this-key-in-production-min-32-chars} # Required for filesystem encryption (min 32 chars)
# Server environment variables
- PORT=${API_INTERNAL_PORT:-3333} # Port for the backend service
- DATABASE_URL=postgresql://postgres:${POSTGRESQL_PASSWORD:-postgresRootPassword}@postgres:5432/palmr_db?schema=public # Database URL with configurable password through POSTGRESQL_PASSWORD env var
# S3/MinIO Configuration (only used when ENABLE_S3=true)
# - S3_ENDPOINT=localhost
# - S3_PORT=9000
# - S3_USE_SSL=false
# - S3_ACCESS_KEY=K0l63C4OVEMwhmudABZF
# - S3_SECRET_KEY=9xMHpE9QgAye17abq7Lf6qzkCtDMEZeIjMNXt1x7
# - S3_REGION=us-east-1
# - S3_BUCKET_NAME=palmr-files
# - S3_FORCE_PATH_STYLE=true
# Timeout Configuration
# - KEEP_ALIVE_TIMEOUT=72000000 # 20 hours in milliseconds
# - REQUEST_TIMEOUT=0 # Disabled (0)
# - TOKEN_EXPIRATION=3600000 # 1 hour in milliseconds
# Application Configuration
- FRONTEND_URL=${APP_URL:-http://${SERVER_IP:-localhost}:${APP_EXTERNAL_PORT:-5487}} # Frontend URL - Make sure to use the correct frontend URL, depends on where the frontend is running, its prepared for localhost, but you can change it to your frontend URL if needed
- SERVER_IP=${SERVER_IP:-localhost} # Server IP - Make sure to use the correct server IP if you running on a cloud provider or a virtual machine. This prepared for localhost, but you can change it to your server IP if needed
- MAX_FILESIZE=${MAX_FILESIZE:-1073741824} # Max Filesize for upload - Declared in Bytes. Default is 1GiB
# Web environment variables
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
- API_BASE_URL=http://palmr:${API_INTERNAL_PORT:-3333} # Using Docker service name for internal communication
ports:
- "${API_EXTERNAL_PORT:-3333}:3333" # Server port
- "${APP_EXTERNAL_PORT:-5487}:5487" # Web port
volumes:
# Persistent storage for filesystem mode (only used when ENABLE_S3=false)
- palmr_uploads:/app/server/uploads
- palmr_temp_chunks:/app/server/temp-chunks
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "http://palmr:${API_INTERNAL_PORT:-3333}/health", "&&", "wget", "--no-verbose", "http://palmr:${APP_INTERNAL_PORT:-5487}"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
postgres:
image: bitnami/postgresql:17.2.0 # You can use any postgres version you prefer, but remember that some versions might not be compatible
container_name: palmr-postgres
environment:
# PostgreSQL credentials configurable through environment variables
# POSTGRESQL_USERNAME, POSTGRESQL_PASSWORD, and POSTGRES_DB can be set to override defaults
- POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME:-postgres}
- POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-postgresRootPassword}
- POSTGRESQL_DATABASE=${POSTGRES_DATABASE:-palmr_db}
volumes:
- postgres_data:/bitnami/postgresql
ports:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: ["CMD", "pg_isready", "-U", "palmr"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data:
# Volumes for filesystem storage mode
palmr_uploads:
palmr_temp_chunks: