Comprehensive DeployHQ Guide for ExpressionEngine
Introduction
ExpressionEngine (EE) is a flexible, secure, and powerful content management system built on CodeIgniter PHP framework. It's known for its robust features, including: - Custom fields and content types - Template engine with variables and conditionals - Built-in member management - Multiple site manager - Extensive add-on ecosystem - Strong security features
1. Set Up ExpressionEngine Project
Method A: Using Downloaded Version
1- Download ExpressionEngine from expressionengine.com 2- Create a database for your project 3- Unzip the downloaded files 4- Initial file structure setup:
git init
git add .
git commit -m "Initial ExpressionEngine setup"
Method B: Using Repository
1- Create a database for your project 2- Clone the repository:
git clone https://github.com/ExpressionEngine/ExpressionEngine.git your-project-name
cd your-project-name
3- Create empty config file:
touch system/user/config/config.php
4- Configure installation mode in .env.php:
define('EE_INSTALL_MODE', TRUE);
For Both Methods
Create .gitignore file:
/system/user/cache/*
/system/user/config/config.php
/images/avatars/*
/images/captchas/*
/images/member_photos/*
/images/pm_attachments/*
/images/uploads/*
/themes/user/*
.env
.env.php
vendor/
node_modules/
File Permissions
chmod 666 system/user/config/config.php
chmod -R 777 system/user/cache/
chmod -R 777 images/uploads/
Initial Installation
- Access /admin.php in your browser
- Follow the Installation Wizard steps:
- Database configuration
- Admin account creation
- Site preferences setup
Post-Installation
- Change EEINSTALLMODE back to FALSE in .env.php
- Remove install.php
- Secure file permissions
2. Set Up DeployHQ
- Create account at deployhq.com
- Create new project
- Connect Git repository (GitHub, GitLab, Bitbucket, or custom)
3. Configure Deployment in DeployHQ
Server Setup
- Go to "Servers & Groups"
- Add new server:
- Choose protocol (SFTP/SSH recommended)
- Enter server details (hostname, username, password/key)
- Set deployment path
- Configure deployment settings
4. Environment Configuration
Create system/user/config/config.php.example:
<?php
$config['app_version'] = '7.0.0';
$config['database'] = array(
'hostname' => '{{DB_HOST}}',
'database' => '{{DB_NAME}}',
'username' => '{{DB_USER}}',
'password' => '{{DB_PASS}}',
'dbprefix' => 'exp_'
);
$config['site_url'] = '{{SITE_URL}}';
$config['encryption_key'] = '{{ENCRYPTION_KEY}}';
5. Build Pipeline Configuration
Create .deploybuild.yaml:
build_languages:
- name: "php"
version: "8.0"
- name: "node"
version: "16"
build_commands:
- description: "Install Dependencies"
command: |
composer install --no-dev --optimize-autoloader
npm ci
npm run build
halt_on_error: true
build_cache_files:
- path: node_modules/**
- path: vendor/**
6. Deployment Hooks
Configure post-deployment commands:
#!/bin/bash
php system/ee/cli/cli.php cache:clear
chmod -R 755 system/user/cache/
chmod -R 755 images/uploads/
7. Server Environment Setup
Requirements
- PHP 7.4+ (8.0+ recommended)
- MySQL 5.7+ or MariaDB 10.2+
- Apache/Nginx
- PHP Extensions: curl, gd2, mbstring, xml
Nginx Configuration
server {
listen 80;
server_name yourdomain.com;
root /path/to/ee;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
8. Database Setup
- Create MySQL database
- Note credentials for environment variables
- Consider using database migration tools
- Ensure proper character set (utf8mb4) and collation (utf8mb4unicodeci)
9. Deployment Process
- Push changes to repository:
git add .
git commit -m "Your commit message"
git push origin main
- Deploy through DeployHQ interface:
- Select branch to deploy
- Review changes
- Click "Deploy Now"
- Monitor deployment logs for any issues
10. ExpressionEngine Installation
After first deployment:
- Verify file permissions
- Access admin.php
- Complete installation wizard:
- Database configuration
- Create admin account
- Configure site settings
- Initial setup tasks:
- Configure template groups
- Set up channels and fields
- Configure member groups
11. Post-Installation
- Enable SSL/TLS
- Set up cron jobs:
*/5 * * * * php /path/to/ee/system/ee/cli/cli.php tasks:run
- Configure email settings:
- SMTP settings
- Email templates
- Email notification preferences
- Set up backup strategy:
- Database backups
- File system backups
- Backup scheduling
12. Continuous Deployment
Automatic Deployments
- Configure webhook URLs
- Set up branch-specific deployments
- Configure deployment triggers
Deployment Workflow
- Set up deployment approval process
- Configure notification settings:
- Email notifications
- Slack integration
- Discord webhooks
- Enable deployment rollback options
13. Performance Optimization
Server-side Optimization
- Enable PHP OpCache:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
- Implement Caching:
- Configure Redis/Memcached
- Set up static file caching
- Enable browser caching
Content Delivery
- Configure CDN for static assets:
- Images
- CSS/JS files
- Downloads
- Enable GZip compression
- Implement lazy loading for images
14. Security Measures
File Permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R 777 system/user/cache/
chmod -R 777 images/uploads/
Security Configuration
- Enable two-factor authentication
- Configure IP access restrictions
- Set up security headers:
- CORS policies
- CSP headers
- X-Frame-Options
Regular Maintenance
- Update ExpressionEngine core
- Update add-ons
- Monitor security logs
- Perform security audits
15. Add-on Management
Version Control
- Track add-ons in Git
- Document add-on dependencies
- Manage add-on configurations
License Management
- Store license keys securely
- Track license renewals
- Document add-on purchases
16. Monitoring and Maintenance
Uptime Monitoring
- Set up monitoring service
- Configure alert thresholds
- Set up status page
Performance Monitoring
- Configure error logging
- Set up performance metrics
- Monitor resource usage
Database Maintenance
- Regular optimization:
sql OPTIMIZE TABLE exp_channels, exp_channel_data, exp_members;
- Index management
- Query performance monitoring
Backup Strategy
- Daily database backups
- Weekly full site backups
- Offsite backup storage
- Backup testing and verification
17. Troubleshooting
Common Issues
Permission problems:
- Check file ownership
- Verify directory permissions
- Review upload directory access
Cache-related issues:
- Clear EE cache
- Purge server cache
- Reset browser cache
Database connectivity:
- Verify credentials
- Check database server status
- Review connection settings
Debug Mode
- Enable debug mode in config:
php $config['debug'] = '1';
- Monitor system logs
- Use development tools
18. Documentation
Project Documentation
- Maintain README.md
- Document custom configurations
- Keep deployment procedures updated
Developer Guidelines
- Coding standards
- Git workflow
- Deployment checklist
Remember to adjust these configurations and procedures based on your specific needs and requirements. Always refer to the official ExpressionEngine documentation for the most up-to-date information.