CLI Overview
Quick Start Guide
wheels info
wheels reload
wheels deps
wheels destroy
wheels watch
wheels generate app
wheels generate app-wizard
wheels generate controller
wheels generate model
wheels generate view
wheels generate property
wheels generate route
wheels generate resource
wheels generate api-resource
wheels generate frontend
wheels generate test
wheels generate snippets
wheels scaffold
wheels db create
wheels db drop
wheels db setup
wheels db reset
wheels db status
wheels db version
wheels db rollback
wheels db seed
wheels db dump
wheels db restore
wheels db shell
wheels db schema
wheels dbmigrate info
wheels dbmigrate latest
wheels dbmigrate up
wheels dbmigrate down
wheels dbmigrate reset
wheels dbmigrate exec
wheels dbmigrate create blank
wheels dbmigrate create table
wheels dbmigrate create column
wheels dbmigrate remove table
wheels test
wheels test run
wheels test coverage
wheels test debug
wheels config list
wheels config set
wheels config env
wheels env
wheels env setup
wheels env list
wheels env switch
wheels environment
wheels console
wheels runner
wheels server
wheels server start
wheels server stop
wheels server restart
wheels server status
wheels server log
wheels server open
wheels plugins
wheels plugins list
wheels plugins install
wheels plugins remove
wheels analyze
wheels analyze code
wheels analyze performance
wheels analyze security
wheels security
wheels security scan
wheels optimize
wheels optimize performance
wheels docs
wheels docs generate
wheels docs serve
wheels ci init
wheels docker init
wheels docker deploy
wheels deploy
wheels deploy audit
wheels deploy exec
wheels deploy hooks
wheels deploy init
wheels deploy lock
wheels deploy logs
wheels deploy proxy
wheels deploy push
wheels deploy rollback
wheels deploy secrets
wheels deploy setup
wheels deploy status
wheels deploy stop
Configuration Management
Creating Commands
Service Architecture
Migrations Guide
Testing Guide
Object Relational Mapping
Creating Records
Reading Records
Updating Records
Deleting Records
Column Statistics
Dynamic Finders
Getting Paginated Data
Associations
Nested Properties
Object Validation
Object Callbacks
Calculated Properties
Transactions
Dirty Records
Soft Delete
Automatic Time Stamps
Using Multiple Data Sources
wheels env setup
Setup a new environment configuration for your Wheels application.
Synopsis
wheels env setup [name] [options]
Description
The wheels env setup
command creates and configures new environments for your Wheels application. It generates environment-specific configuration files, database settings, and initializes the environment structure.
Arguments
| Argument | Description | Default |
|----------|-------------|---------|
| name
| Environment name (e.g., staging, qa, production) | Required |
Options
| Option | Description | Default |
|--------|-------------|---------|
| --base
| Base environment to copy from | development
|
| --database
| Database name | wheels_[name]
|
| --datasource
| CF datasource name | wheels_[name]
|
| --debug
| Enable debug mode | false
|
| --cache
| Enable caching | Based on name |
| --reload-password
| Password for reload | Random |
| --skip-database
| Skip database creation | false
|
| --force
| Overwrite existing environment | false
|
| --help
| Show help information |
Examples
Setup basic environment
wheels env setup staging
Setup with custom database
wheels env setup qa --database=wheels_qa_db --datasource=qa_datasource
Copy from production settings
wheels env setup staging --base=production
Setup with specific options
wheels env setup production --debug=false --cache=true --reload-password=secret123
Skip database setup
wheels env setup testing --skip-database
What It Does
-
Creates Configuration Directory:
/config/[environment]/ └── settings.cfm
-
Generates Settings File:
- Database configuration
- Environment-specific settings
- Debug and cache options
- Security settings
-
Sets Up Database (unless skipped):
- Creates database
- Configures datasource
- Tests connection
-
Updates Environment Registry:
- Adds to available environments
- Sets up environment detection
Generated Configuration
Example config/staging/settings.cfm
:
<cfscript>
// Environment: staging
// Generated: 2024-01-15 10:30:45
// Database settings
set(dataSourceName="wheels_staging");
// Environment settings
set(environment="staging");
set(showDebugInformation=true);
set(showErrorInformation=true);
// Caching
set(cacheFileChecking=false);
set(cacheImages=false);
set(cacheModelInitialization=false);
set(cacheControllerInitialization=false);
set(cacheRoutes=false);
set(cacheActions=false);
set(cachePages=false);
set(cachePartials=false);
set(cacheQueries=false);
// Security
set(reloadPassword="generated_secure_password");
// URLs
set(urlRewriting="partial");
// Custom settings for staging
set(sendEmailOnError=true);
set(errorEmailAddress="dev-team@example.com");
</cfscript>
Environment Types
Development
- Full debugging
- No caching
- Detailed errors
- Hot reload
Testing
- Test database
- Debug enabled
- Isolated data
- Fast cleanup
Staging
- Production-like
- Some debugging
- Performance testing
- Pre-production validation
Production
- No debugging
- Full caching
- Error handling
- Optimized performance
Custom
Create specialized environments:
wheels env setup performance-testing --base=production --cache=false
Database Configuration
Automatic Setup
wheels env setup staging
# Creates: wheels_staging database
# Datasource: wheels_staging
Custom Database
wheels env setup staging \
--database=staging_db \
--datasource=myapp_staging
Database URL
wheels env setup production \
--database-url="mysql://user:pass@host:3306/db"
Environment Variables
The command sets up support for:
# .env.staging
WHEELS_ENV=staging
WHEELS_DATASOURCE=wheels_staging
WHEELS_DEBUG=true
WHEELS_CACHE=false
DATABASE_URL=mysql://localhost/wheels_staging
Configuration Inheritance
Environments can inherit settings:
// config/staging/settings.cfm
<cfinclude template="../production/settings.cfm">
// Override specific settings
set(showDebugInformation=true);
set(cacheQueries=false);
Validation
After setup, the command validates:
- Configuration file syntax
- Database connectivity
- Directory permissions
- Environment detection
Environment Detection
Configure how environment is detected:
// config/environment.cfm
if (cgi.server_name contains "staging") {
set(environment="staging");
} else if (cgi.server_name contains "qa") {
set(environment="qa");
} else {
set(environment="production");
}
Best Practices
- Naming Convention: Use clear, consistent names
- Base Selection: Choose appropriate base environment
- Security: Use strong reload passwords
- Documentation: Document environment purposes
- Testing: Test configuration before use
Advanced Configuration
Multiple Databases
wheels env setup reporting \
--database=wheels_reporting \
--read-database=wheels_replica
Load Balancing
wheels env setup production \
--servers=web1,web2,web3 \
--load-balancer=nginx
Feature Flags
// In settings.cfm
set(features={
newCheckout: true,
betaAPI: false,
debugToolbar: true
});
Troubleshooting
Database Creation Failed
- Check database permissions
- Verify connection settings
- Use
--skip-database
and create manually
Configuration Errors
- Check syntax in settings.cfm
- Verify file permissions
- Review error logs
Environment Not Detected
- Check environment.cfm logic
- Verify server variables
- Test detection rules
Use Cases
- Multi-Stage Pipeline: dev → staging → production
- Feature Testing: Isolated feature environments
- Performance Testing: Dedicated performance environment
- Client Demos: Separate demo environments
- A/B Testing: Multiple production variants
Notes
- Environment names should be lowercase
- Avoid spaces in environment names
- Each environment needs unique database
- Restart application after setup
- Test thoroughly before using
See Also
- wheels env - Environment management overview
- wheels env list - List environments
- wheels env switch - Switch environments
- wheels config - Configuration management
- Synopsis
- Arguments
- Options
- Examples
- Setup basic environment
- Setup with custom database
- Copy from production settings
- Setup with specific options
- Skip database setup
- What It Does
- Generated Configuration
- Environment Types
- Development
- Testing
- Staging
- Production
- Custom
- Database Configuration
- Automatic Setup
- Custom Database
- Database URL
- Environment Variables
- Configuration Inheritance
- Validation
- Environment Detection
- Best Practices
- Advanced Configuration
- Multiple Databases
- Load Balancing
- Feature Flags
- Troubleshooting
- Database Creation Failed
- Configuration Errors
- Environment Not Detected
- Use Cases
- Notes
- See Also