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

67
docker-compose-s3.yaml Normal file
View File

@@ -0,0 +1,67 @@
services:
palmr:
image: kyantech/palmr:latest # Make sure to use the correct version (latest) of the image
container_name: palmr-application
depends_on:
postgres:
condition: "service_healthy"
environment:
# S3 Configuration (only used when ENABLE_S3=true)
- ENABLE_S3=true # Set to true to use S3 storage
- S3_ENDPOINT=${S3_ENDPOINT} # S3 endpoint (you have to set this to the s3 endpoint of the s3 server) CHANGE THIS TO YOUR S3 ENDPOINT
- S3_USE_SSL=${S3_USE_SSL:-true} # Use ssl for the s3 server always true for s3
- S3_ACCESS_KEY=${S3_ACCESS_KEY} # S3 access key (you have to generate this key in s3 server)
- S3_SECRET_KEY=${S3_SECRET_KEY} # S3 secret key (you have to generate this key in s3 server)
- S3_REGION=${S3_REGION:-us-east-1} # S3 region (us-east-1 is the default region) but it depends on your s3 server region
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-palmr-files} # Bucket name for the S3 storage (here we are using palmr-files as the bucket name to understand that this is the bucket for palmr)
- S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE:-false} # For S3 compatibility we have to set this to false
# Server environment variables
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgresRootPassword}@postgres:${DB_EXTERNAL_PORT:-5432}/${POSTGRES_DB:-palmr_db}?schema=public # Database URL with configurable credentials through env vars
- FRONTEND_URL=http://palmr:${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
- MAX_FILESIZE=${MAX_FILESIZE:-1073741824} # Max Filesize for upload - Declared in Bytes. Default is 1GiB. can be changed by admin in the frontend.
# Web environment variables
- NODE_ENV=production # Always set to production for better performance
- NEXT_TELEMETRY_DISABLED=1 # Disable telemetry for better performance
- API_BASE_URL=http://palmr:3333 # Using Docker service name for internal communication
ports:
- "${API_EXTERNAL_PORT:-3333}:3333" # Server port (default: 3333) can be overridden by env var
- "${APP_EXTERNAL_PORT:-5487}:5487" # Web port (default: 5487) can be overridden by env var
networks:
- palmr-network # Network for the application to communicate with the database
restart: unless-stopped
healthcheck:
test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://palmr:3333/health && wget --no-verbose --tries=1 --spider http://palmr:5487"] # Healthcheck for the application
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
postgres:
image: postgres:16-alpine # You can use any postgres version you prefer, but remember that some versions might not be compatible
container_name: palmr-database
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres} # PostgreSQL username (default: postgres) can be overridden by env var
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgresRootPassword} # PostgreSQL password (default: postgresRootPassword) can be overridden by env var
- POSTGRES_DB=${POSTGRES_DB:-palmr_db} # PostgreSQL database name (default: palmr_db) can be overridden by env var
volumes:
- postgres_data:/var/lib/postgresql/data # PostgreSQL data volume for the application
ports:
- "${DB_EXTERNAL_PORT:-5432}:5432" # PostgreSQL port (default: 5432) can be overridden by env var
networks:
- palmr-network # Network for the application to communicate with the database
restart: unless-stopped
healthcheck:
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}", "-d", "${POSTGRES_DB:-palmr_db}"] # Healthcheck for the database
interval: 5s
timeout: 3s
retries: 6
start_period: 30s
volumes:
postgres_data:
networks:
palmr-network:
driver: bridge