Opinions & Insights
Automated environment provisioning with branch deploys
Building and delivering web sites, stores, and applications professionally demands rigour. When we have clients, customers, and users, we need to ensure a suitable level of quality and stability in what we deliver.
To help this, professional web projects typically make use of more than one environment so that suitable development, testing, and approval processes can happen in safety, set aside from the live production system, keeping experiments and work-in-progress from impacting the end users.
At the very least, separate environments for development and production are needed, but it is common to also need environments for:
- testing - where QA (Quality Assurance) can test new features and identify any bugs;
- staging - where stakeholders can give final approval of upcoming changes before they are released to the public.
The costs of multiple environments
For this to work, each environment needs to be a faithful replication of the production environment to provide confidence that the code we write, test, and review in one place is going to behave the same way when it is goes live.
Development operations, or “Devops“, manages the processes by which code, content, and environment changes flow through these distinct environments, keeping them all in-step and healthy. The more environments we have, the more work this involves. Things can get complicated quickly.
Many bugs have reached production where this process was not in good shape. In addition a great deal of time can be spent on ensuring that each environment stays the same over the life of a project. Software patches, security updates, code changes, configuration updates, and content updates all need to be kept in step on hardware (physical or virtualized) that is consistent.
It’s a whole thing.
Luckily, Netlify has a way to normalize these environments, to automate the workflows when using them, and even how they are created.
How to create new environments instantly
By providing one, globally managed hosting platform, Netlify allows all projects to make use of this so that they never need to explicitly design and create their own infrastructure. As a result, development environments lives within the same global platform as their associated production environments. These are uniquely addressable, but under the surface they all share identical infrastructure.
This allows projects on Netlify to create an unlimited number of environments instantly and without the additional costs and maintenance overheads you’d get from doing this manually.
How? With branch deploys.
What are “branch deploys”?
Branch deploys build on the git model of branches in your code repository. For any branch found in your project repo (or just specified named branches if you prefer) Netlify will create another build pipeline and deployed site version with a URL derived from the name of the branch.
# Your production URL # (these conventions can also be configured for custom domains) your-fancy-project.netlify.app # Git branches gets their own URL [BRANCH-NAME]--your-fancy-project.netlify.app # For example a "staging" branch gets its own URL staging--your-fancy-project.netlify.app # The "main" branch is the production branch but even that # can also be explicily accessed in the same way main--your-fancy-project.netlify.app
Branch deploys use identical containerised build pipelines and hosting infrastructure as their production siblings, so provide consistent experiences for testing and evaluating changes before they are promoted to production via a standard version control method of merging into the production branch.
No more disparate infrastructure to wrestle with. A new environment is just a
git branch my-new-environment away.
Going even further with feature branches and deploy previews
The friction of creating and deploying to new environments is so low under this paradigm, that we can go even further. New features can all be developed, tested, and released via their own feature branches, automatically sandboxed into their own testing environments.
Even suggested iterations can be tested in their own environments based on git pull requests, which, by triggering builds in the same way as branch deploys, provide a chance to review what the impacts of accepting suggested changes to our projects will be before they are even merged in to a branch.
Netlify also add some utilities and services to these deploy previews to make it even easier to review and share feedback on the suggested changes and speed up the path to production.
See Collaborative Deploy Previews for more information on that.
An end to planning multiple parallel environments
If you like the sound of saying goodbye to the process of planning, estimating, costing, provisioning, and maintaining multiple environments for each project, take a look at our information on branch deploys, and deploy a project today to explore more.