Environment Types
In Coherence, environment types define the characteristics and behavior of deployment environments. Choosing the appropriate environment type is crucial for optimizing development workflow, resource utilization, and security.
This guide will help you understand the different environment types and when to use each.
Choosing an environment type
Coherence offers three environment types, each tailored to specific use cases in the development life cycle:
- Preview
- Staging
- Production
Comparison table
Feature | Preview | Staging | Production |
---|---|---|---|
Database protection | No delete protection | Delete protection | Enhanced protection |
Instance type | Spot instances | Regular instances | Regular instances |
Auto-archiving | Based on PR status | No | No |
Auto-pausing | After inactivity | No | No |
Deployment restrictions | None | None | Limited to Admin or Release Managers |
Preview environments
Preview environments are designed for short-lived, dynamic use cases.
Use cases: Feature branches, pull request testing, temporary demos
Key features:
- Run on cost-effective spot instances.
- Automatically pause after a period of inactivity (configurable in
cnc.yml
). - Automatically archived when the associated PR is closed or deleted.
Considerations:
- Not suitable for persistent data storage.
- Ideal for rapid iteration and testing.
Staging environments
Staging environments provide stable, persistent environments for pre-production testing.
Use cases: QA testing, user acceptance testing (UAT), integration testing
Key features:
- Run on regular (non-spot) instances for stability.
- Not subject to auto-pausing or auto-archiving.
Considerations:
- Should mirror production as closely as possible.
- Useful for final checks before production deployment.
Production environments
Production environments are designed for live, customer-facing deployments with enhanced security and stability.
Use cases: Live application hosting, critical business operations
Key features:
- Restricted deployment access (admins only).
- Enhanced database protection.
- Run on regular instances for maximum stability
Considerations:
- Require careful change management.
- See the production environment best practices documentation.
Changing environment types
Once an environment has been created, you can't change its type. However, you can clone an existing environment to a new type:
- Navigate to the Environments tab on your collection homepage.
- Click New environment.
- Use the Clone From Existing option to copy configuration from an existing environment.
- Under Name/Type, enter an environment name and use the dropdown to set the desired new environment type.
- Click Create.
Best practices
- Use preview environments liberally for feature development and testing.
- Maintain at least one staging environment that closely mirrors production.
- Limit production environment access and implement strict deployment protocols.
FAQ
Q: Can I have multiple production environments?
A: Yes, you can create multiple production environments if needed, for example, for different geographical regions.
Q: How long do preview environments stay active?
A: Coherence pauses preview environments after a set period of inactivity, which can be configured in the cnc.yml
file for each environment.
Q: Can I manually archive a staging environment?
A: Yes, you can manually archive any environment type through the Coherence dashboard.
Related documentation
By understanding how to use environment types effectively, you can create a robust, efficient, and secure development pipeline in Coherence.