TFGrid WordPress Guide¶
Self-hosted WordPress with Caddy and MariaDB on ThreeFold Grid.
Overview¶
Deploy a production-ready WordPress installation with automatic SSL, database management, and backup capabilities.
Key Features:
- π One-click deployment - Deploy in under 5 minutes
- π Automatic SSL - Caddy handles Let's Encrypt certificates
- πΎ Persistent storage - Docker volumes for data safety
- π¦ Easy backups - Built-in backup and restore commands
- π§ WP-CLI included - Full command-line management
Quick Start¶
Prerequisites¶
- TFGrid account with mnemonic configured
tfgrid-composeinstalled (Installation Guide)
Deploy¶
# Deploy from registry
tfgrid-compose up tfgrid-wordpress
# Or with custom configuration
tfgrid-compose up tfgrid-wordpress --var DOMAIN=blog.example.com
Access Your Site¶
After deployment completes:
- WordPress:
https://your-domain.com - Admin Panel:
https://your-domain.com/wp-admin
Complete the WordPress setup wizard to create your admin account.
Configuration¶
Environment Variables¶
| Variable | Required | Default | Description |
|---|---|---|---|
DOMAIN |
Yes | - | Public domain for WordPress |
SSL_EMAIL |
No | - | Email for Let's Encrypt |
DB_PASSWORD |
No | Auto-generated | MariaDB password |
DB_ROOT_PASSWORD |
No | Auto-generated | MariaDB root password |
Example Configuration¶
Create a .env file:
Or pass variables directly:
tfgrid-compose up tfgrid-wordpress \
--var DOMAIN=blog.example.com \
--var SSL_EMAIL=admin@example.com
Architecture¶
βββββββββββββββ βββββββββββββββββ ββββββββββββββββ
β Internet ββββββΆβ Caddy :443 ββββββΆβ WordPress β
β β β (auto-SSL) β β :8080 β
βββββββββββββββ βββββββββββββββββ ββββββββ¬ββββββββ
β
ββββββββΌββββββββ
β MariaDB β
β :3306 β
ββββββββββββββββ
Components:
- Caddy - Reverse proxy with automatic HTTPS
- WordPress - Official Docker image (latest)
- MariaDB - Database with health checks
Commands¶
Backup & Restore¶
# Create full backup
tfgrid-compose backup
# List available backups
tfgrid-compose list-backups
# Restore from backup
tfgrid-compose restore --backup /path/to/backup.tar.gz
Logs¶
# All logs
tfgrid-compose logs
# Specific service
tfgrid-compose logs wordpress
tfgrid-compose logs db
tfgrid-compose logs caddy
# Follow logs
tfgrid-compose logs wordpress --follow
Management¶
# Open WordPress container shell
tfgrid-compose shell
# Run WP-CLI commands
tfgrid-compose wp core version
tfgrid-compose wp plugin list
tfgrid-compose wp user list
tfgrid-compose wp cache flush
# Restart services
tfgrid-compose restart
# Health check
tfgrid-compose healthcheck
Resource Requirements¶
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 core | 2 cores |
| Memory | 1 GB | 2 GB |
| Disk | 20 GB | 50 GB |
Estimated Cost: $10-20/month on ThreeFold Grid
Backup Details¶
What's Backed Up¶
- Database - Full MySQL dump
- WordPress files - wp-content, themes, plugins, uploads
- Configuration - .env and Caddyfile
Backup Location¶
Backups are stored in /opt/wordpress/backups/ with format:
Automated Backups¶
Set up a cron job for automated backups:
SSL Configuration¶
Automatic SSL (Default)¶
Caddy automatically obtains and renews Let's Encrypt certificates when you provide a domain.
Requirements for SSL¶
- Domain DNS must point to your server's IP
- Ports 80 and 443 must be accessible
- (Optional) Provide
SSL_EMAILfor certificate notifications
Local Development¶
For local development without SSL:
Caddy will serve HTTP only when using localhost or IP addresses.
Customization¶
Installing Plugins¶
# Via WP-CLI
tfgrid-compose wp plugin install woocommerce --activate
# Or via WordPress admin panel
# https://your-domain.com/wp-admin/plugins.php
Installing Themes¶
PHP Configuration¶
To modify PHP settings, edit the WordPress container:
tfgrid-compose shell
# Inside container:
echo "upload_max_filesize = 64M" >> /usr/local/etc/php/conf.d/uploads.ini
echo "post_max_size = 64M" >> /usr/local/etc/php/conf.d/uploads.ini
Troubleshooting¶
Common Issues¶
"Error establishing database connection"
- Check MariaDB is running:
- Verify database credentials in
/opt/wordpress/.env - Check database logs:
SSL certificate not working
- Ensure domain DNS points to server IP:
- Check Caddy logs:
- Verify ports 80/443 are open
WordPress is slow
- Install a caching plugin (e.g., W3 Total Cache)
- Check available memory:
- Consider upgrading VM resources
White screen of death
- Enable WordPress debug mode:
- Check WordPress logs:
Health Check¶
Run a comprehensive health check:
This checks: - Docker service status - Container health - HTTP response - Disk space
Migration¶
From Existing WordPress¶
- Export your existing site using a plugin (e.g., All-in-One WP Migration)
- Deploy TFGrid WordPress
- Install the same migration plugin
- Import your backup
To Another Server¶
- Create a backup:
- Copy backup file to new server
- Deploy TFGrid WordPress on new server
- Restore:
Security Best Practices¶
- Keep WordPress updated - Enable auto-updates or update regularly
- Use strong passwords - For admin and database
- Install security plugins - Wordfence, Sucuri, etc.
- Regular backups - Set up automated daily backups
- Limit login attempts - Use a plugin to prevent brute force
- Use HTTPS - Already enabled by default with Caddy
Related Documentation¶
TFGrid Studio Ecosystem
Integrated tools and resources