Setup Issues
Terraform Errors
Error: “Failed to initialize Terraform”- Ensure Terraform is installed:
terraform version - Check Terraform version >= 1.5.0
- Verify Digital Ocean token is valid
- Check Digital Ocean account has sufficient credits
- Verify region is available
- Check droplet size is available in selected region
- Verify SSH public key is correct
- Check firewall allows SSH (port 22)
- Wait a few minutes for droplet to fully initialize
Ansible Errors
Error: “Failed to connect to host”- Ensure SSH access works:
ssh root@SERVER_IP - Check inventory file is correctly generated
- Verify SSH key is added to droplet
- Check internet connectivity on droplet
- Verify Ubuntu 22.04 is being used
- Check Ansible logs for detailed error
- Check environment variables are set correctly
- Verify Node.js is installed:
node --version - Check orchestrator logs:
journalctl -u preview-deployer-orchestrator -f
Deployment Issues
Webhook Not Triggering
Symptoms: PR opened but no preview deployment Solutions:-
Check webhook is configured:
-
Verify webhook secret matches:
-
Check orchestrator logs:
-
Test webhook manually:
Build Failures
Symptoms: Preview deployment fails during build Solutions:-
Check Docker build logs:
- Verify Dockerfile exists and is correct
-
Check build commands in
preview-config.yml - Ensure dependencies are installable
pnpm install --prod fails (e.g. prepare script / husky)
Symptoms: Build fails at RUN pnpm install --frozen-lockfile --prod (or similar) with exit code 1.
Cause: Lifecycle scripts like prepare or postinstall in package.json can depend on devDependencies (e.g. husky). With --prod, devDependencies are not installed, so the script fails when it runs.
Fixes (in your app or its Dockerfile):
- Husky: Set
ENV HUSKY=0before the install step in your Dockerfile so the prepare script is a no-op in Docker/CI. - General: Move the script’s dependency to
dependenciesif it must run in production builds, or in the Dockerfile run install with--ignore-scriptsand then run only the commands you need (e.g. build). - Preview-deployer: When the repo has no Dockerfile, we inject a default that sets
HUSKY=0so this case is avoided for our template.
Health Check Failures
Symptoms: Containers start but preview URL doesn’t work Solutions:-
Verify health check endpoint exists:
-
Check health check path in
preview-config.yml: -
Check container logs:
-
Verify app is listening on correct port:
Port Conflicts
Symptoms: “Port already in use” error Solutions:-
Check allocated ports:
-
Find process using port:
-
Cleanup old deployment:
Nginx Configuration Errors
Symptoms: Preview URL returns 502 Bad Gateway Solutions:-
Check nginx config syntax:
-
Verify preview config exists:
-
Check nginx error logs:
-
Verify app container is running:
-
Test proxy directly:
Runtime Issues
Container Crashes
Symptoms: Preview works initially but stops responding Solutions:-
Check container status:
-
View container logs:
-
Check resource usage:
-
Restart container:
Database Connection Issues
Symptoms: App can’t connect to database Solutions:-
Verify database container is running:
-
Check database logs:
-
Test database connection:
-
Verify connection string in app:
Cleanup Not Working
Symptoms: Old previews not being cleaned up Solutions:-
Check cleanup service is running:
-
Verify TTL configuration:
-
Manually trigger cleanup:
-
Check deployment age:
Performance Issues
Slow Builds
Solutions:- Use Docker layer caching
- Optimize Dockerfile (multi-stage builds)
- Use smaller base images
- Cache dependencies in separate layer
High Resource Usage
Solutions:- Reduce max concurrent previews
- Lower container resource limits
- Use smaller droplet size
- Enable cleanup of old previews
Memory Issues
Symptoms: Droplet runs out of memory Solutions:-
Check memory usage:
- Reduce container memory limits
- Cleanup old previews
- Upgrade droplet size
Security Issues
Webhook Signature Verification Failed
Solutions:-
Verify webhook secret matches:
- Check GitHub webhook configuration
- Verify payload is not modified
Unauthorized Repository Access
Solutions:- Check
ALLOWED_REPOSenvironment variable - Verify repository format:
owner/repo - Check orchestrator logs for rejection messages
Debugging Tips
Enable Debug Logging
SetLOG_LEVEL=debug in orchestrator environment:
Check All Services
Manual Testing
Test orchestrator API:Getting Help
If you’re still stuck:- Check logs for error messages
- Review Architecture Documentation
- Check Configuration Reference
- Open an issue on GitHub with:
- Error messages
- Logs (sanitized)
- Steps to reproduce
- System information
Common Error Messages
”Repository not in allowed list”
- Add repository to
ALLOWED_REPOSenvironment variable - Restart orchestrator service
”Port allocation out of range”
- PR number too large (>56,000)
- Use smaller PR numbers or upgrade port allocation strategy
”Health check timeout”
- Verify health check endpoint exists
- Check health check path in config
- Increase timeout in docker-manager.ts
”Docker build failed”
- Check Dockerfile syntax
- Verify all dependencies are available
- Check build logs for specific errors
”Nginx reload failed”
- Check nginx config syntax:
nginx -t - Verify preview config file format
- Check nginx error logs