Preview environments
Branch preview environments have quickly become an integral part of software development. By spinning up an ephemeral staging environment for each branch, teams can reduce the risk of shipping bugs, improve collaboration, and increase overall development speed.
Coherence deploys branch previews in your cloud — offering you enhanced transparency and security compared to a Platform-as-a-Service. Notably, our previews are “full-stack”, meaning they support a backend and database in addition to a frontend, thus achieving higher production parity.
Example workflow
- Create: just open a PR in GitHub, or create one in the Coherence dashboard.
- Infra config Coherence runs a TF job to create your preview infrastructure and submits a build pipeline.
- GitHub comment Coherence posts a comment with the link and build pipline status to the PR.
- Git push new code: a new build pipeline is submitted automatically to deploy your changes.
- Share: your preview will be live with a successful build pipeline. Send around to your team for review, QA, and feedback.
- Merge: once the PR is closed, Coherence automatically spins down the infrastructure.
Key features
- Variables: Coherence let's you add scoped secrets and variables to preview environments as a safer way to integrate new services.
- Cost management: previews automatically spin down their infrastructure after a configurable timeout period.
- Built-in REPL: launch a web-based SSH shell into your deployed environment for running one-off seeding, data migrations, or other useful operations.
- Custom domains: all environemnts in Coherence can be served from a custom domain.
Infrastructure in detail
Each Account (AWS) or Project (GCP) will deploy some shared resources and some resources specific to each preview environment. A few notable call-outs:
AWS and GCP
- VPC, Load Balancer, and Redis are shared by all environments
GCP
- One Cloud SQL instance per resource definition is shared by all Branch Previews, each environment gets its own database on the instance
- One Cloud Run service per application service per environment.
- User defined GCS buckets are provisioned on a per-environment basis
AWS
- One RDS instance per resource definition per environment
- One CloudFront distribution per environment per domain
- Coherence assigns a subdomain from
coherencesites.com
by default - Any custom domains also provision a distribution
- Coherence assigns a subdomain from
- User defined S3 buckets and SQS message queues are provisioned on a per-environment basis
Lifecycle
- Active: this is the default status for new previews. Once it's initial build succeeds, the preview will be available on the web at its URL.
- Paused: after a user defined number of hours (the
preview_inactivity_timeout_hours
property incoherence.yml
config) following the last successful build, the preview will be automatically paused. All infrastructure (excluding the DB/DB instance) will be removed. A subsequent push or manual change to Active will redeploy the infrastructure. - Archived: previews tracking branches that have been merged will be automatically archived. Coherence cleans up all environment infrastructure including DB's. Only a manual change back to active or paused will restore it.