Issue Opened
Issue #51 opened: feat: Clone environment to create staging/dev environments
Summary
Add the ability to clone an existing environment (e.g., production) to create new environments (e.g., staging, dev) with identical infrastructure stack.
Use Cases
- Create staging environment from production for QA testing
- Create dev environment that auto-deploys from
developbranch - Spin up feature branch environments for PR previews
Proposed Implementation
Dashboard UI
- "Clone Environment" button in environment switcher or dashboard
- Modal with options:
- Environment name (e.g., "staging")
- Server selection
- Git branch (e.g., "develop" for staging)
- Domain (e.g., staging.example.com)
- Options to include: database, cache, services
Artisan Command
php artisan coolify:clone-environment production staging \
--branch=develop \
--domain=staging.example.com \
--server=xxx \
--with-postgres \
--with-dragonfly
Technical Details
The building blocks already exist:
ApplicationRepository::createPrivateDeployKey()- create appDatabaseRepository::createPostgres()/createDragonfly()- create DBs- All accept
environment_nameparameter - Coolify auto-creates environment
New work needed:
- Clone logic - Copy app config, adjust branch/domain
- Env var handling - Copy from source env, adjust DATABASE_URL, REDIS_URL, APP_URL
- Dashboard UI - Modal for clone options
- API endpoint -
POST /api/environments/clone
Per-Environment Deploy Strategies (Future)
Once multi-environment is working, add per-environment settings:
- Production: Manual deploy only (click to deploy)
- Staging: Auto-deploy on push to
main - Dev: Auto-deploy on push to
develop
Related
- Builds on multi-environment support added in #50