Troubleshooting Guide
This guide helps you resolve common issues when using Suthep.
Common Issues
Configuration File Not Found
Error:
Configuration file not found: suthep.ymlSolution:
- Ensure you're in the correct directory
- Check if
suthep.ymlexists:ls -la suthep.yml - Create configuration file:
suthep init - Or specify custom path:
suthep deploy -f /path/to/config.yml
Port Already in Use
Error:
Error: Port 3000 is already in useSolution:
-
Find what's using the port:
sudo lsof -i :3000 # or sudo netstat -tulpn | grep 3000 -
Stop the conflicting service or change the port in
suthep.yml:services: - name: api port: 3001 # Changed from 3000
SSL Certificate Creation Failed
Error:
Failed to obtain SSL certificate for example.comSolutions:
-
Check DNS Configuration
nslookup example.com # Ensure domain points to your server IP -
Verify Ports Are Open
# Check if ports 80 and 443 are open sudo ufw status # or sudo iptables -L -
Use Staging Mode for Testing
certbot: staging: true # Use staging to avoid rate limits -
Check Domain Accessibility
curl -I http://example.com # Should return HTTP response -
Check Certbot Logs
sudo tail -f /var/log/letsencrypt/letsencrypt.log
Nginx Configuration Errors
Error:
nginx: configuration file /etc/nginx/nginx.conf test failedSolutions:
-
Test Nginx Configuration
sudo nginx -t -
Check Nginx Error Logs
sudo tail -f /var/log/nginx/error.log -
Check Generated Config Files
ls -la /etc/nginx/sites-available/ cat /etc/nginx/sites-available/example_com.conf -
Verify Nginx Syntax
sudo nginx -t -c /etc/nginx/nginx.conf
Docker Container Issues
Error:
Error: Docker container failed to startSolutions:
-
Check Docker Status
docker ps docker ps -a # Show all containers -
Check Container Logs
docker logs <container-name> -
Verify Docker Image
docker images docker pull <image-name> # Pull latest image -
Check Port Conflicts
docker ps | grep <port> -
Remove Old Containers
docker rm <container-name>
Health Check Failures
Error:
Health check failed for service apiSolutions:
-
Verify Health Check Endpoint
curl http://localhost:3000/health -
Check Service is Running
# For Docker docker ps docker logs <container-name> # For non-Docker ps aux | grep <service> -
Increase Health Check Timeout
deployment: healthCheckTimeout: 60000 # Increase to 60 seconds -
Verify Health Check Path
services: - name: api healthCheck: path: /health # Ensure this path exists
Permission Denied Errors
Error:
Permission denied: /etc/nginx/sites-available/example.confSolutions:
-
Use Sudo
sudo suthep deploy -
Check File Permissions
ls -la /etc/nginx/sites-available/ -
Verify User Permissions
groups # Check your user groups
Service Not Accessible
Issue: Service deployed but not accessible via domain.
Solutions:
-
Check Nginx Status
sudo systemctl status nginx -
Verify Site is Enabled
ls -la /etc/nginx/sites-enabled/ # Should have symlink to sites-available config -
Check DNS Resolution
nslookup example.com dig example.com -
Test Local Connection
curl http://localhost:3000 -
Check Firewall
sudo ufw status sudo ufw allow 80/tcp sudo ufw allow 443/tcp
Zero-Downtime Deployment Issues
Issue: Deployment causes downtime.
Solutions:
-
Verify Deployment Strategy
deployment: strategy: rolling # or blue-green -
Check Container Health
docker ps # Both old and new containers should be running during deployment -
Monitor Nginx Reload
sudo nginx -t # Test before reload sudo systemctl reload nginx # Graceful reload
Multiple Services on Same Domain
Issue: Path-based routing not working.
Solutions:
-
Verify Path Configuration
services: - name: api path: /api # Ensure path is set - name: ui path: / # Root path -
Check Nginx Config
cat /etc/nginx/sites-available/example_com.conf # Should have location blocks for each path -
Test Paths
curl http://example.com/api/health curl http://example.com/
Debugging Tips
Enable Verbose Output
Some commands support verbose output. Check logs:
# Check Nginx logs
sudo tail -f /var/log/nginx/error.log
sudo tail -f /var/log/nginx/access.log
# Check Docker logs
docker logs <container-name>
# Check system logs
sudo journalctl -u nginx -fTest Configuration
Before deploying, test your configuration:
# Validate YAML syntax
yamllint suthep.yml
# Test Nginx config
sudo nginx -t
# Test Docker image
docker run --rm <image-name>Step-by-Step Deployment
Deploy step by step to isolate issues:
# 1. Deploy without Nginx
suthep deploy --no-nginx
# 2. Deploy without HTTPS
suthep deploy --no-https
# 3. Full deployment
suthep deployGetting Help
If you're still experiencing issues:
-
Check Logs
- Nginx:
/var/log/nginx/ - Certbot:
/var/log/letsencrypt/ - Docker:
docker logs <container>
- Nginx:
-
Verify Configuration
- Review
suthep.ymlsyntax - Check all required fields are present
- Validate port numbers and domains
- Review
-
Test Components Individually
- Test Nginx manually
- Test Docker containers
- Test SSL certificates
-
Check System Resources
# Check disk space df -h # Check memory free -h # Check CPU top
Prevention
To avoid common issues:
-
Use Staging for Testing
certbot: staging: true -
Validate Configuration
suthep init # Interactive validation -
Test Before Production
- Test on staging environment first
- Verify all services work individually
- Test deployment process
-
Monitor Health Checks
- Set appropriate intervals
- Monitor health check endpoints
- Set reasonable timeouts
Next Steps
- Advanced Topics - Advanced configuration and optimization
- Examples - Review working examples
Previous: Examples | Next: Advanced Topics →