Skip to content

Creating Environments

Set up environments to organize your deployment pipeline.

An environment represents a stage in your deployment pipeline:

Each environment contains:

  • A set of assigned targets
  • Environment-specific variable values
  • A position in the environment list
  1. Open Lens in your browser
  2. Open the Tenancy group in the top navigation, then the Environments pill
  3. Click New Environment
┌─────────────────────────────────────────────────────────────┐
│ Create Environment │
├─────────────────────────────────────────────────────────────┤
│ │
│ Name: [Production ] │
│ Description: [Live customer-facing environment ] │
│ │
│ Sort Order: [30 ] │
│ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ Sort order orders the list; it does not promote. │ │
│ │ Lower values are earlier in the pipeline. │ │
│ └───────────────────────────────────────────────────────┘ │
│ │
│ [Cancel] [Create] │
│ │
└─────────────────────────────────────────────────────────────┘

Sort order is the order environments are listed in, and what the UI offers as the likely next environment. It does not authorize a promotion: a promotion needs a promotion rule naming the exact source and target environments, and without one the promotion is refused however the environments are ordered. See Promotion Rules for that setup.

EnvironmentSort OrderPosition
Development0First
Test10Second
Staging20Third
Production30Last
PropertyRequiredDescription
NameYesDisplay name (the slug derived from it must be unique within scope)
SlugNoURL-safe key; derived from the name if omitted; must be unique within scope
DescriptionNoHuman-readable description
Sort OrderNoPosition in the environment list. Defaults to 0 if omitted.
GoodAvoid
Productionprod, prd
Stagingstage, stg
Developmentdev
QA-Testingqa_test_env
┌─────────────────────────────────────────────────────────────┐
│ Environment Pipeline │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │Development │ -> │ Staging │ -> │ Production │ │
│ │ Order: 0 │ │ Order: 10 │ │ Order: 20 │ │
│ │ 2 targets │ │ 4 targets │ │ 12 targets │ │
│ └────────────┘ └────────────┘ └────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘

For larger organizations:

EnvironmentSort OrderPurpose
Development0Developer testing
Integration5CI/CD automated testing
QA10Quality assurance testing
UAT15User acceptance testing
Staging20Pre-production validation
Production30Live environment

Create standard environments via the REST API (environments are managed in Lens or through /api/v1/environments; there is no mantisctl environment subcommand). sort_order controls the listed order:

Terminal window
for env in '{"name":"Development","description":"Developer testing environment","sort_order":0}' \
'{"name":"Staging","description":"Pre-production environment","sort_order":10}' \
'{"name":"Production","description":"Live customer environment","sort_order":20}'; do
curl -X POST "$MANTIS_URL/api/v1/environments" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "$env"
done

After creation, verify the environment list:

┌─────────────────────────────────────────────────────────────┐
│ Environments │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┬───────────┬─────────┬─────────────────┐ │
│ │ Name │ Order │ Targets │ Description │ │
│ ├─────────────┼───────────┼─────────┼─────────────────┤ │
│ │ Development │ 0 │ 0 │ Developer tes...│ │
│ │ Staging │ 10 │ 0 │ Pre-productio...│ │
│ │ Production │ 20 │ 0 │ Live customer...│ │
│ └─────────────┴───────────┴─────────┴─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
PropertyCan EditNotes
NameYesMust remain unique
DescriptionYesFree-form text
Sort OrderYesAffects list order
  1. Click environment name
  2. Click Edit
  3. Modify properties
  4. Click Save

Before deleting an environment:

  • Remove all target assignments
  • Ensure no active deployments
  • Consider historical data impact
┌─────────────────────────────────────────────────────────────┐
│ Delete Environment │
├─────────────────────────────────────────────────────────────┤
│ │
│ Are you sure you want to delete "Test"? │
│ │
│ This will: │
│ • Remove all target assignments │
│ • Remove environment from promotion pipeline │
│ • Preserve historical deployment data │
│ │
│ ⚠ This action cannot be undone │
│ │
│ [Cancel] [Delete] │
│ │
└─────────────────────────────────────────────────────────────┘

Each environment has its own variable values:

Solution: customer-portal
Variable: database_host
Development: dev-db.local
Staging: staging-db.company.com
Production: prod-db.company.com

See Variables for details.

Create environments that match your actual workflow:

Your process: Environments:
Code → Review → Development
Build → Test → Integration, QA
UAT → Deploy → UAT, Staging
Release Production

Establish naming standards:

StandardExample
Title caseProduction, Staging
Hyphenated compoundsPre-Production, User-Acceptance
Clear purposeQA-Testing, not Env3

Use gaps for future flexibility:

Current: Future possible:
Development (0) Development (0)
Staging (10) Integration (5)
Production (20) Staging (10)
Canary (15)
Production (20)

Maintain documentation of each environment:

EnvironmentPurposeAccessContact
DevelopmentFeature testingDevelopersdev-team@
StagingPre-prod validationQA, DevOpsqa-team@
ProductionLive trafficOperationsops-team@

Begin with essential environments:

Minimum viable:
Development → Production
Standard:
Development → Staging → Production
Extended (as needed):
Development → QA → Staging → Production

Cause: A slug derived from (or matching) the requested name already exists in this scope. Uniqueness is enforced on the slug, not the name.

Solution: Use a different name, or supply an explicit unique slug via the API.

Cause: No promotion rule names this environment as the target for the source you are promoting from. Sort order does not authorize a promotion.

Solution: Add a promotion rule for the source/target pair in the lifecycle.