-
Notifications
You must be signed in to change notification settings - Fork 0
⭐ StartRedis
StartRedis StartRedis is the provisioning action responsible for launching Redis containers with secure defaults, persistent volumes, optional TLS/SSL support, engine‑specific runtime flags, and predictable startup behavior. Redis is one of the simplest engines to provision, but it still requires careful handling of configuration, volumes, and optional security features.
This page explains how StartRedis works, what it generates, and how it fits into the broader provisioning system.
Purpose of StartRedis The StartRedis action handles all logic required to start a Redis instance, including:
Validating configuration
Generating SSL/TLS certificates (if enabled)
Creating persistent volumes
Building environment variables
Generating Docker Compose
Applying Redis‑specific runtime flags
Configuring healthchecks
Starting the container
Redis is lightweight, but the provisioning must still be deterministic and secure.
Redis‑Specific Requirements Redis differs from SQL engines in several ways:
- No Required Password Redis does not require a password by default. However, if authentication is enabled, Redis uses:
Code requirepass This is handled automatically when configured.
- Optional TLS/SSL Redis supports TLS, but only when:
Certificates are mounted
TLS flags are passed
The container is started with TLS mode enabled
Your StartRedis action handles this automatically.
- Data Directory Redis stores data in:
Code /data This directory is mapped to a persistent volume.
- Config File Redis may require a custom config file when:
TLS is enabled
Passwords are enabled
Custom runtime flags are used
StartRedis generates and mounts this file when needed.
StartRedis Lifecycle mermaid flowchart TD A[StartRedis] --> B[Validate Configuration] B --> C[Generate SSL Certificates] C --> D[Generate Persistent Volumes] D --> E[Build Environment Variables] E --> F[Generate Docker Compose] F --> G[Start Redis Container]
- Validate Configuration StartRedis checks:
Port availability
Password (if enabled)
Volume paths
SSL/TLS settings
Custom runtime options
Redis is flexible, but misconfiguration can break TLS or persistence.
- Generate SSL Certificates (Optional) If TLS is enabled:
A CA certificate is generated
A server certificate is generated
A server key is generated
Certificates are mounted into the container
Redis is configured to use TLS
Certificates are stored under:
Code /data/coolify/ssl// 3. Generate Persistent Volumes Using GeneratesLocalPersistentVolumes, StartRedis creates:
Local data directory
SSL directory (if TLS enabled)
Config directory (if needed)
Volumes are mapped into the container:
Code /data /etc/redis/ssl /etc/redis/conf This ensures Redis persistence across restarts.
- Build Environment Variables Redis uses fewer environment variables than SQL engines, but StartRedis still builds:
Optional Code REDIS_PASSWORD System Internal variables required for provisioning.
SSL If TLS is enabled:
Code REDIS_SSL_CA REDIS_SSL_CERT REDIS_SSL_KEY 5. Generate Docker Compose StartRedis generates a full Compose service definition including:
Image Code redis: Ports Code 6379:6379 Volumes Data directory
SSL directory
Config directory
Environment Variables All normalized variables.
Healthcheck Redis healthcheck typically uses:
Code redis-cli ping Runtime Options Redis‑specific flags such as:
--requirepass
TLS flags
Custom config file path
- Start the Container The generated Compose file is passed to the provisioning engine, which:
Creates the container
Applies resource limits
Connects networks
Starts Redis
Verifies healthcheck
Marks the database as running
Example Compose Snippet (Conceptual example — your implementation generates this dynamically.)
Code services: redis: image: redis:7 ports: - "6379:6379" volumes: - /data/coolify/redis//data:/data - /data/coolify/ssl/:/etc/redis/ssl - /data/coolify/redis//conf:/etc/redis/conf command: - redis-server - /etc/redis/conf/redis.conf healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 Why StartRedis Is Important StartRedis ensures:
Secure defaults
Predictable provisioning
Optional TLS support
Persistent storage
Clean environment variable handling
Consistent Docker orchestration
Redis may be simple, but provisioning must still be reliable and repeatable.