Appearance
Deployment Guide
This guide covers deploying LamaPress themes to staging and production environments using Laravel Forge.
Table of Contents
- Overview
- Pre-Deployment Checklist
- Laravel Forge Setup
- Deployment Process
- Environment Configuration
- Post-Deployment
Overview
LamaPress deployments typically follow this flow:
- Development - Local development with Herd
- Staging - Laravel Forge staging environment
- Production - Laravel Forge production environment
Pre-Deployment Checklist
Before deploying, ensure:
- [ ] All code is committed to GitHub
- [ ] Production build completed (
npm run build) - [ ] Build files committed (
dist/directory) - [ ] Database migrations completed (if any)
- [ ] Environment variables configured
- [ ] Dependencies updated (
composer install,npm install) - [ ] Tests passed (if applicable)
- [ ] Code review completed
Building for Production
bash
# Build production assets
npm run build
# Commit build files
git add dist/
git commit -m "Build production assets"
git pushImportant: Always commit the dist/ directory with production builds.
Laravel Forge Setup
Initial Setup
- Connect Repository - Link GitHub repository to Forge
- Configure Server - Set up PHP version, Node.js version
- Set Deployment Script - Configure deployment commands
- Environment Variables - Set up environment-specific configs
Server Requirements
- PHP 8.4 (or as required by WordPress)
- Node.js v24 LTS
- Composer
- Git
Deployment Script
Typical Forge deployment script:
bash
cd /home/forge/your-site.com
git pull origin main
# Install PHP dependencies
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
# Install Node dependencies
npm ci
# Build assets
npm run build
# Clear caches (if applicable)
wp cache flushDeployment Process
Automatic Deployment
Forge can automatically deploy on push:
- Push to GitHub - Push to main/master branch
- Forge Detects - Forge detects the push
- Runs Script - Executes deployment script
- Deploys - Updates files and runs commands
Manual Deployment
Deploy manually from Forge dashboard:
- Go to site in Forge
- Click "Deploy Now"
- Monitor deployment logs
- Verify deployment success
Deployment Steps
- Pull Code -
git pull origin main - Install Dependencies -
composer install,npm ci - Build Assets -
npm run build - Clear Caches - WordPress and application caches
- Run Migrations - Database updates (if any)
Environment Configuration
WordPress Configuration
Set environment-specific constants in wp-config.php:
php
// Development
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// Staging
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
// Production
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);Environment Variables
Use Forge's environment variables for sensitive data:
bash
# In Forge environment variables
LL_BUNNY_API_KEY=your_key_here
LL_GTM_ID=GTM-XXXXXXXAccess in wp-config.php:
php
define('LL_BUNNY_API_KEY', env('LL_BUNNY_API_KEY'));Theme Constants
LamaPress constants in wp-config.php:
php
// Optional: Google Tag Manager
define('LL_GTM_ID', '');
// Optional: Cookie Consent
define('LL_COOKIE_CONSENT', '');
define('LL_COOKIEBOT_ID', '');
// Optional: Bunny.net
define('LL_BUNNY_API_KEY', '');
define('LL_BUNNY_LIBRARY_ID', '');
define('LL_BUNNY_PULL_ZONE', '');Post-Deployment
Verification Steps
- Check Site - Visit site and verify it loads
- Check Assets - Verify CSS/JS are loading
- Check Console - No JavaScript errors
- Test Functionality - Test key features
- Check Performance - Run Lighthouse audit
Common Issues
Assets Not Loading:
- Verify
dist/directory exists - Check file permissions
- Verify manifest file exists
Styles Not Applied:
- Clear browser cache
- Check CSS files are loading
- Verify build completed successfully
JavaScript Errors:
- Check browser console
- Verify all dependencies installed
- Check for missing files
Best Practices
1. Always Test on Staging
Deploy to staging first, then production:
Development → Staging → Production2. Use Environment Variables
Never commit sensitive data:
php
// ✅ Good
define('API_KEY', env('API_KEY'));
// ❌ Bad
define('API_KEY', 'hardcoded-key');3. Monitor Deployments
Watch deployment logs for errors:
- Check Forge deployment logs
- Monitor error logs
- Set up error tracking
4. Rollback Plan
Keep previous deployment available:
- Tag releases in Git
- Keep backups
- Document rollback procedure
5. Database Backups
Always backup before deployment:
- Use Forge backup feature
- Manual database export
- Test restore procedure
Related Documentation
- Development Environment - Local setup
- Build Process - Build system
- Troubleshooting - Deployment issues
Next Steps:
- Review Build Process for building assets
- Check Troubleshooting for common issues
- Learn about Performance Optimization