Appearance
Create Staging Environment
The lamapress:staging command creates a new staging environment for a WordPress site on Laravel Forge. It automates the entire process of setting up a staging site, including database creation, DNS configuration, SSL installation, and deployment.
Usage
bash
clli lamapress:staging [subdomain]Arguments
subdomain(optional) - The subdomain for the staging environment. If not provided, you'll be prompted.
Options
-v, --verbose- Enable verbose output for debugging
Prerequisites
Before running this command, ensure you have configured:
forge_token- Laravel Forge API tokenforge_server_id- Forge server IDcloudflare_token- Cloudflare API tokencloudflare_zone_id- Cloudflare zone ID
See Configuration for details on setting these up.
Process
The command performs these steps:
- Verifies you're in a theme directory
- Checks CLLI configuration for required keys
- Creates a new isolated PHP site on Forge
- Sets up the database
- Configures Cloudflare DNS
- Installs SSL certificate
- Installs your SSH key
- Sets up deployment scripts
- Installs WordPress
- Installs plugins
- Installs theme
- Migrates local environment to staging
- Sets up final deployment script
- Updates git remote
- Enables quick deploy
Requirements
- Must be run from within a WordPress theme directory
- Theme must be in a Git repository
- You must have access to the Laravel Forge server
- You must have Cloudflare access for DNS configuration
Examples
Create staging with subdomain:
bash
cd wp-content/themes/my-theme
clli lamapress:staging myproject-stagingInteractive mode:
bash
cd wp-content/themes/my-theme
clli lamapress:stagingVerbose mode:
bash
clli lamapress:staging myproject-staging -vConfiguration
The command will prompt you for any missing configuration keys. You can also set them beforehand using:
bash
clli config:updateWhat Gets Created
Site Configuration
- Domain:
{subdomain}.lamalama.dev - PHP Version: PHP 8.3
- Site Type: Isolated PHP site
- Directory:
/public
Database
- Automatically generated database name, username, and password
- Database credentials are displayed after creation
WordPress Installation
- Fresh WordPress installation
- Admin user:
Lama Lama - Admin email:
wordpress@lamalama.nl - Randomly generated admin password (displayed after creation)
Plugins Installed
- WP Migrate DB Pro (activated and configured)
- All default WordPress plugins removed (Akismet, Hello Dolly)
Theme
- Theme cloned from your Git repository
- Default WordPress themes removed
- Assets built automatically
After Running
Once the command completes, you'll see output like:
Staging site ready on [https://myproject-staging.lamalama.dev]. Build something unexpected.
Admin ready on [https://myproject-staging.lamalama.dev/wp-admin]. Manage your website here.
Key Value
site domain: myproject-staging.lamalama.dev
server username: u_myproject_staging_lamalama_dev_...
Site id: 12345
DB name db_myproject_staging_...
DB username dbu_myproject_staging_...
DB password [random-password]Important: Save the database credentials and admin password shown in the output.
Troubleshooting
Not in Theme Directory
Not in theme directory:
- Ensure you're in
wp-content/themes/your-theme/ - The command checks for this automatically
Missing Configuration
Missing configuration:
- Run
clli config:showto see what's configured - Use
clli config:updateto add missing keys - The command will prompt for missing required keys
Forge API Errors
Forge API errors:
- Verify your Forge token is valid
- Check that you have access to the specified server
- Ensure the server has available resources
Cloudflare Errors
Cloudflare errors:
- Verify your Cloudflare token has DNS edit permissions
- Check that the zone ID is correct
- Ensure the subdomain doesn't already exist
Organization ID Issues
If you see an error about organization ID:
- Your organization has multiple owners and requires an organization ID
- Find your organization ID in the Forge dashboard URL:
https://forge.laravel.com/organizations/{organization_id}/servers - Set it manually:
clli config:update forge_organization_id
Migration Issues
If the local-to-remote migration fails:
- Ensure WP Migrate DB Pro is installed and activated locally
- Check that your local WordPress installation is accessible
- Verify the connection key is correct
- Check for version mismatches between local and remote WP Migrate DB plugins
Related Documentation
- Pull Staging Environment - Pulling staging to local
- Configuration - Setting up credentials for staging
- Deployment Guide - Laravel Forge deployment details
- CLLI Overview - Introduction to CLLI