Enterprise-grade WordPress deployment with zero-trust security, automated TLS, WWW redirect, horizontal scaling, and production monitoring for WeOwn infrastructure.
# Clone only WordPress directory for faster setup
git clone --depth 1 --filter=blob:none --sparse https://github.com/WeOwnNetwork/ai.git
cd ai
git sparse-checkout set wordpress
cd wordpress
./deploy.shRequirements: Kubernetes cluster, kubectl, helm, domain name
- WWW Redirect Options: Choose between rootβwww or wwwβroot redirects during setup
- Enhanced DNS Guidance: A record (root) + CNAME (www) instructions with validation
- Parameterized TLS Config: Configurable cipher suites and protocols in values.yaml
- MariaDB Security Fix: Updated to official UID 999 for compatibility
- WordPress 6.8.3 with PHP 8.3 and Apache
- MariaDB 11.7.2 with optimized configuration
- Redis Cache for performance enhancement
- NGINX Ingress with TLS 1.3 termination
- cert-manager for automated Let's Encrypt certificates
- Horizontal Pod Autoscaler for traffic scaling
- NetworkPolicy for zero-trust micro-segmentation
Internet β NGINX Ingress (TLS 1.3) β WordPress Pods (non-root)
β β
cert-manager NetworkPolicy
(Let's Encrypt) (Zero-trust rules)
β
MariaDB + Redis
(Internal only)
wordpress/
βββ deploy.sh # Enterprise deployment script
βββ helm/ # Helm chart directory
β βββ Chart.yaml # Helm chart metadata
β βββ values.yaml # Configuration parameters
β βββ templates/ # Kubernetes manifests
β βββ deployment.yaml # WordPress deployment
β βββ service.yaml # Service configuration
β βββ ingress.yaml # TLS ingress rules
β βββ networkpolicy.yaml # Zero-trust networking
β βββ secrets.yaml # Encrypted credentials
β βββ pvc.yaml # Persistent storage
β βββ hpa.yaml # Auto-scaling rules
β βββ backup-cronjob.yaml # Automated backups
β βββ configmap.yaml # WordPress hardening
βββ README.md # This documentation
βββ CHANGELOG.md # Version history
- NetworkPolicy: Default deny with explicit ingress/egress rules
- Pod Security: Non-root containers, read-only filesystem
- Service Mesh Ready: mTLS compatible architecture
- RBAC: Least-privilege service accounts
- TLS 1.3: Modern encryption with Let's Encrypt automation
- Parameterized Ciphers: Configurable cipher suites (Mozilla "Intermediate" profile)
- HTTPS Redirect: All HTTP traffic redirected to HTTPS
- WWW Redirect: Optional rootβwww canonical domain redirect
- Security Headers: HSTS, CSP, XSS protection, frame options
- Certificate Rotation: Automated 30-day renewal cycle
- A Record: Root domain points directly to LoadBalancer IP
- CNAME Record: www subdomain aliases to root domain (DNS standard)
- Pre-Deployment Validation: Script prompts for DNS setup before certificate issuance
- Redirect Options: Choose canonical domain (root or www) during deployment
securityContext:
runAsUser: 1000 # Non-root user
runAsGroup: 1000 # Non-root group
runAsNonRoot: true # Enforce non-root
readOnlyRootFilesystem: true # Read-only system
allowPrivilegeEscalation: false
capabilities:
drop: [ALL] # Drop all Linux capabilities- File Editing Disabled:
DISALLOW_FILE_EDIT = true - Plugin Installation Blocked:
DISALLOW_FILE_MODS = true - Force SSL Admin:
FORCE_SSL_ADMIN = true - Automatic Updates: Core updates enabled
- Session Security: Secure cookies, HTTP-only flags
- Brute Force Protection: Rate limiting via NGINX Ingress
HPA Configuration:
Min Replicas: 1
Max Replicas: 3
CPU Target: 70%
Memory Target: 80%
Scale-up Policy: Conservative
Scale-down Policy: Gradual| Component | CPU Request | CPU Limit | Memory Request | Memory Limit |
|---|---|---|---|---|
| WordPress | 200m | 500m | 256Mi | 512Mi |
| MariaDB | 100m | 300m | 128Mi | 384Mi |
| Redis | 50m | 100m | 64Mi | 128Mi |
- WordPress Content: 8Gi (wp-content, uploads, themes)
- WordPress Config: 100Mi (configuration files)
- WordPress Cache: 1Gi (temporary cache data)
- MariaDB Data: 8Gi (database with growth capacity)
- Backup Storage: 20Gi (30-day retention)
For users who only want the WordPress deployment without the full WeOwn infrastructure:
# One-command installation
curl -fsSL https://raw.githubusercontent.com/WeOwnNetwork/ai/main/wordpress/install.sh | bash
# Or clone and run locally
git clone https://github.com/WeOwnNetwork/ai.git
cd ai/wordpress
./install.shWhat the standalone installer does:
- β Clones only the WordPress directory (sparse checkout)
- β Sets up clean directory structure optimized for deployment
- β Verifies all prerequisites (kubectl, helm, git)
- β Provides OS-specific installation instructions
- β Creates ready-to-deploy WordPress enterprise package
After installation:
cd weown-wordpress
./deploy.shIf you already have the full WeOwn infrastructure:
# Run the deployment script
./deploy.sh
# Follow the interactive prompts:
# 1. Domain name (e.g., example.com)
# 2. Subdomain (e.g., wp β wp.example.com)
# 3. Let's Encrypt email
# 4. Kubernetes namespace
# 5. Advanced options (monitoring, backups)# Non-interactive deployment with parameters
./deploy.sh \
--domain example.com \
--email admin@example.com \
--namespace wordpress \
--skip-prerequisitesAfter deployment, create an A record:
Subdomain: wp (or your chosen subdomain)
Domain: example.com
Points to: <EXTERNAL_IP> (provided by deployment script)
TTL: 300 seconds (5 minutes)
# Check deployment status
kubectl get pods -n wordpress
kubectl get ingress -n wordpress
kubectl get certificates -n wordpress
# View WordPress logs
kubectl logs -f deployment/wordpress -n wordpress
# Scale WordPress (manual)
kubectl scale deployment wordpress --replicas=2 -n wordpress
# Access WordPress admin
https://wp.yourdomain.com/wp-admin/# Check backup status (runs daily at 2 AM)
kubectl get cronjobs -n wordpress
kubectl get jobs -n wordpress
# View backup logs
kubectl logs job/wordpress-backup-<timestamp> -n wordpress
# Manual backup trigger
kubectl create job --from=cronjob/wordpress-backup manual-backup -n wordpress# Check certificate status
kubectl describe certificate wordpress-tls -n wordpress
# Force certificate renewal (if needed)
kubectl delete certificate wordpress-tls -n wordpress
# Certificate will be automatically recreated# View resource usage
kubectl top pods -n wordpress
kubectl top nodes
# Check autoscaling status
kubectl get hpa -n wordpress
# View autoscaling events
kubectl describe hpa wordpress -n wordpressSymptom: Browser shows "Not Secure" or red padlock Cause: Certificate not ready or browser cache Solution:
# Check certificate status
kubectl describe certificate wordpress-tls -n wordpress
# If certificate is ready, clear browser cache:
# Chrome/Safari: Cmd+Shift+R (hard refresh)
# Or use incognito/private modeSymptom: Script fails with "INCLUDE_WWW: unbound variable" or Kubernetes warnings Cause: Variable initialization or invalid security context fields Solution: β Fixed in v3.2.1 - Update to latest version:
git pull origin main
./deploy.sh --domain your-domain.com --email your@email.comSymptom: NGINX returns 504 error Cause: NetworkPolicy blocking ingress-nginx communication Solution:
# Ensure ingress-nginx namespace is labeled correctly
kubectl label namespace ingress-nginx name=ingress-nginx --overwrite
# Check NetworkPolicy rules
kubectl describe networkpolicy wordpress -n wordpressSymptom: Pods stuck in Pending or CrashLoopBackOff
Cause: Resource constraints or configuration issues
Solution:
# Check pod events
kubectl describe pod -l app.kubernetes.io/instance=wordpress -n wordpress
# Check resource availability
kubectl top nodes
kubectl describe node <node-name>
# Review pod logs
kubectl logs -l app.kubernetes.io/instance=wordpress -n wordpressSymptom: WordPress shows "Error establishing database connection" Cause: MariaDB not ready or credentials mismatch Solution:
# Check MariaDB status
kubectl get pods -l app.kubernetes.io/name=mariadb -n wordpress
kubectl logs -l app.kubernetes.io/name=mariadb -n wordpress
# Verify database credentials
kubectl get secret wordpress -n wordpress -o yaml | base64 -dSymptom: Slow page loading or timeouts
Cause: Resource limits or cache issues
Solution:
# Check resource usage
kubectl top pods -n wordpress
# Increase resource limits if needed:
# Edit values.yaml and run:
helm upgrade wordpress ./helm -n wordpress -f values-override.yaml
# Check Redis cache status
kubectl exec -it deployment/wordpress-redis-master -n wordpress -- redis-cli pingSymptom: Certificate stuck in "False" ready state Cause: DNS not propagated or challenge failures Solution:
# Check certificate challenge status
kubectl describe challenge -n wordpress
# Verify DNS propagation
nslookup wp.yourdomain.com
dig wp.yourdomain.com
# Check ACME challenge logs
kubectl logs -l app.kubernetes.io/name=cert-manager -n cert-manager# β οΈ WARNING: This deletes all WordPress data
helm uninstall wordpress -n wordpress
kubectl delete namespace wordpress
# Redeploy from scratch
./deploy.sh# List available backups
kubectl exec -it deployment/wordpress-backup -n wordpress -- ls -la /var/backups/wordpress/
# Restore database (replace TIMESTAMP)
kubectl exec -it deployment/wordpress-mariadb -n wordpress -- \
mariadb -u root -p < /var/backups/wordpress/wordpress_backup_db_TIMESTAMP.sql.gz# View deployment history
helm history wordpress -n wordpress
# Roll back to previous version
helm rollback wordpress <revision> -n wordpress- Pod CPU/Memory: Should stay under 70% average
- Response Time: < 2 seconds for cached pages
- Availability: 99.9% uptime target
- Certificate Expiry: Auto-renewal 30 days before expiry
- Backup Success: Daily backup completion
- Security Events: Failed login attempts, blocked requests
# If Prometheus is available in cluster:
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
name: wordpress-monitoring
namespace: wordpress
labels:
app: wordpress
monitoring: "true"
spec:
selector:
app.kubernetes.io/name: wordpress
ports:
- port: 80
name: http
EOF- Low Traffic (< 1000 visits/day): Default configuration sufficient
- Medium Traffic (1000-10k visits/day): Scale to 2-3 replicas, increase MariaDB resources
- High Traffic (> 10k visits/day): Consider external MariaDB (managed database), CDN integration
- Change Admin Password: Use generated strong password
- Install Security Plugin: Wordfence or similar
- Enable 2FA: Two-factor authentication for admin
- Review User Permissions: Remove unnecessary admin users
- Update WordPress: Keep core, themes, plugins updated
- Configure Backup: Verify automated backups working
- Test Recovery: Practice disaster recovery procedure
- Monitor Logs: Set up log monitoring and alerting
- SOC 2: Pod security contexts, encrypted secrets, audit logs
- ISO 27001: Network segmentation, access controls, incident response
- GDPR: Cookie consent, data encryption, right to deletion
- PCI DSS: If processing payments, additional security layers required
- Isolate: Scale down to 0 replicas to stop traffic
- Assess: Check logs and identify attack vector
- Contain: Update NetworkPolicy to block suspicious IPs
- Investigate: Analyze WordPress logs and access patterns
- Recover: Deploy clean backup and patch vulnerabilities
- Monitor: Enhanced logging and alerting post-incident
# Stop all traffic immediately
kubectl scale deployment wordpress --replicas=0 -n wordpress
# Block external access
kubectl patch ingress wordpress -n wordpress -p '{"spec":{"rules":[]}}'
# Enable maintenance mode
kubectl create configmap maintenance-mode --from-literal=enabled=true -n wordpress- Documentation: This README and inline code comments
- Logs:
kubectl logscommands for troubleshooting - Community: WeOwn Network support channels
- Issues: GitHub Issues for bug reports
- Fork repository and create feature branch
- Test changes on development cluster
- Update documentation for new features
- Submit pull request with detailed description
- Ensure security review for production changes
- WordPress Admin:
admin/<generated-password> - Database Root:
root/<generated-password> - Database User:
wordpress/<generated-password> - Redis:
<generated-password>
- WordPress: 80 (internal), 443 (external via ingress)
- MariaDB: 3306 (internal only)
- Redis: 6379 (internal only)
- DigitalOcean:
do-block-storage(default) - AWS:
gp2orgp3 - Google Cloud:
standardorssd
- Minimum: 2 CPU cores, 4GB RAM, 50GB storage
- Recommended: 4 CPU cores, 8GB RAM, 100GB storage
- High Availability: 3+ nodes, distributed across zones
π― WordPress Enterprise v3.2.0 - Production Ready
Deployed with β€οΈ by WeOwn Network