Production-ready deployment scripts for CTFd on Azure Ubuntu VMs with automated SSL, Docker management, and comprehensive error handling.
- One-Command Installation - Fully automated CTFd deployment
- Azure Optimized - Handles Azure VM-specific Docker and networking issues
- SSL/TLS Automation - Let's Encrypt integration with auto-renewal
- Error Recovery - Intelligent error handling and automatic fixes
- Database Management - Automatic credential generation and recovery
- Complete Lifecycle - Install, uninstall, backup, and maintenance scripts
- Production Ready - Nginx reverse proxy, security hardening, and monitoring
- Azure Ubuntu VM (22.04 LTS or newer)
- Minimum 2 vCPUs and 4GB RAM
- Domain name pointing to your VM's public IP
- Ports 80, 443, and 22 open in Azure NSG
git clone https://github.com/therealcybermattlee/ctfd-azure-deploy.git
cd ctfd-azure-deploy
Edit install-ctfd.sh
and update:
DOMAIN="your-domain.com" # Replace with your actual domain
EMAIL="admin@your-domain.com" # For Let's Encrypt notifications
chmod +x install-ctfd.sh
sudo ./install-ctfd.sh
The script will:
- Install and configure Docker
- Set up CTFd with MariaDB and Redis
- Configure Nginx as reverse proxy
- Obtain SSL certificate from Let's Encrypt
- Create management scripts
ctfd-azure-deploy/
βββ install-ctfd.sh # Main installation script
βββ uninstall-ctfd.sh # Complete uninstall script
βββ README.md # This file
βββ LICENSE # MIT License
βββ CONTRIBUTING.md # Contribution guidelines
βββ docs/
β βββ TROUBLESHOOTING.md
β βββ AZURE-SETUP.md
β βββ SSL-SETUP.md
βββ .github/
βββ ISSUE_TEMPLATE/
βββ bug_report.md
βββ feature_request.md
After installation, the following scripts are created in ~/CTFd/
:
Script | Purpose |
---|---|
start-ctfd.sh |
Start CTFd containers |
stop-ctfd.sh |
Stop CTFd containers |
restart-ctfd.sh |
Restart CTFd containers |
logs-ctfd.sh |
View real-time logs |
backup-ctfd.sh |
Create backup |
health-ctfd.sh |
Check service health |
fix-ctfd.sh |
Auto-fix common issues |
- Automatic secure password generation
- SSL/TLS with Let's Encrypt
- Nginx security headers
- Docker security best practices
- Automated backups (daily at 2 AM)
- Isolated Docker networks
Three uninstall modes available:
sudo ./uninstall-ctfd.sh
- Remove CTFd only - Keeps Docker installed
- Remove CTFd and containers - Keeps Docker installation
- Complete removal - Removes everything including Docker
sudo groupadd -f docker
sudo usermod -aG docker $USER
sudo systemctl restart docker
cd ~/CTFd
docker compose down -v
sudo rm -rf data/mysql/*
docker compose up -d
Ensure DNS is properly configured:
# Check DNS
dig +short your-domain.com
# Manual SSL setup
sudo certbot --nginx -d your-domain.com
See docs/TROUBLESHOOTING.md for detailed solutions.
- 2 vCPUs
- 4GB RAM
- 20GB Storage
- Ubuntu 22.04 LTS
- 4 vCPUs
- 8GB RAM
- 50GB Storage
- Ubuntu 22.04/24.04 LTS
Required inbound rules:
Port | Protocol | Purpose |
---|---|---|
22 | TCP | SSH Access |
80 | TCP | HTTP Traffic |
443 | TCP | HTTPS Traffic |
The installation creates .env
with:
SECRET_KEY
- CTFd secret keyMYSQL_ROOT_PASSWORD
- Database root passwordDB_PASSWORD
- CTFd database passwordDOMAIN
- Your domain name
.env
secure and never commit to git!
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see LICENSE file for details.
- CTFd - The amazing CTF platform
- Docker - Container platform
- Let's Encrypt - Free SSL certificates
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- v1.0.0 (2025-09-02)
- Initial release
- Full Azure VM support
- Automated SSL setup
- Complete error handling
- Support for multiple CTFd instances
- Kubernetes deployment option
- AWS/GCP support
- Automated challenge deployment
- Monitoring dashboard integration
Made with β€οΈ for the CTF community