This document describes the entrypoint script structure implemented for each service in the Docker Compose setup.
Each service has a dedicated entrypoint script that handles initialization, dependency checks, and startup procedures. This approach provides:
- Better error handling and logging
- Proper dependency management
- Consistent startup procedures
- Clear separation of concerns
setup/entrypoint.sh
: Database initialization and migrationsredis/entrypoint.sh
: Redis server configuration and startuphocuspocus/entrypoint.sh
: Hocuspocus service initializationserver/entrypoint.sh
: Main server startup and health checks
Each script includes:
- Error handling with
set -e
- Timestamp-based logging
- Health checks for dependencies
- Environment-specific behavior (development/production)
- Handles database creation
- Runs migrations
- Seeds initial data
- Waits for PostgreSQL to be ready
- Creates runtime configuration
- Securely handles passwords from secrets
- Configures persistence and logging
- Sets up performance tuning
- Checks PostgreSQL and Redis dependencies
- Handles development/production modes
- Provides health check endpoint
- Manages WebSocket connections
- Displays version information
- Checks all service dependencies
- Handles development/production modes
- Provides comprehensive logging
The entrypoint scripts are automatically executed when their respective containers start. No manual intervention is required.
docker-compose up
The scripts will:
- Check dependencies
- Initialize services
- Start in development mode with hot reloading
docker-compose -f docker-compose.yaml up
The scripts will:
- Perform thorough health checks
- Initialize with production settings
- Start services with optimized configurations
All scripts implement proper error handling:
- Descriptive error messages
- Non-zero exit codes on failure
- Dependency timeout handling
- Graceful shutdown procedures
Consistent logging format across all scripts:
- Timestamp prefixes
- Service identification
- Status updates
- Error details when applicable
Security measures implemented:
- Secrets management
- No hardcoded credentials
- Proper file permissions
- Non-root user execution where applicable
When updating the scripts:
- Maintain the error handling patterns
- Keep the logging format consistent
- Update dependency checks as needed
- Test both development and production modes