Deployment
FTL automates the deployment of your applications, handling everything from image transfers to SSL certificate management.
Basic Usage
To deploy your application:
bash
ftl deploy
Deployment Process
The deployment process follows these steps:
SSH Connection
- Connects to your configured server(s) via SSH
- Verifies server access and permissions
Image Handling
- For direct SSH transfer (no
image
field):- Transfers Docker images directly to servers
- Uses FTL's layer caching for optimization
- For registry-based deployment (
image
field specified):- Pulls images from configured registry
- Requires registry authentication (username/password only)
- For direct SSH transfer (no
Environment Setup
- Sets up volumes and networks
- Configures environment variables
- Starts dependencies if defined
Service Deployment
- Launches services with health checks
- Performs zero-downtime container replacement
- Configures Nginx reverse proxy
SSL/TLS Setup
- Manages SSL/TLS certificates via ACME
- Configures HTTPS endpoints
Cleanup
- Removes unused containers
- Cleans up temporary resources
Configuration
Basic Service Configuration
yaml
services:
- name: web
port: 80
health_check:
path: /
interval: 10s
timeout: 5s
retries: 3
routes:
- path: /
strip_prefix: false
Dependencies Configuration
yaml
dependencies:
- name: postgres
image: postgres:16
volumes:
- postgres_data:/var/lib/postgresql/data
env:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-app}
Volume Configuration
yaml
volumes:
- postgres_data
Environment Variables
FTL supports two types of environment variables:
Required Variables
yamlenv: - DATABASE_URL=${DATABASE_URL}
Optional Variables with Defaults
yamlenv: - POSTGRES_USER=${POSTGRES_USER:-postgres}
Health Checks
Health checks ensure your services are running correctly:
yaml
services:
- name: api
health_check:
path: /health
interval: 10s
timeout: 5s
retries: 3
Best Practices
Configuration Management
- Use environment variables for sensitive data
- Keep configuration DRY
- Document all required variables
Deployment Strategy
- Start with dependencies first
- Use health checks for all services
- Monitor logs during deployment
Security
- Use HTTPS for all services
- Keep SSL certificates up to date
- Secure sensitive environment variables
Monitoring
- Check service health after deployment
- Monitor resource usage
- Keep track of logs
Common Issues
Health Check Failures
If services fail health checks:
- Verify the health check endpoint
- Check service logs
- Ensure correct port configuration
- Verify service startup time
SSL Certificate Issues
If SSL setup fails:
- Verify domain DNS configuration
- Check email configuration
- Ensure ports 80/443 are accessible
Network Issues
If services can't communicate:
- Check network configuration
- Verify port mappings
- Ensure dependencies are running
Next Steps
After successful deployment:
- Learn about Logging
- Configure SSL Management
- Explore Zero-downtime Deployments
WARNING
Always verify your application's functionality after deployment.