Ephemeral Environments: The Modern Approach for Better and Faster Testing
Tech companies are gradually adopting the modern CI/CD flow that facilitates rapid releases and fast collaboration between team members. Traditional staging environments are being replaced with ephemeral environments because the shared staging environments do not support the culture of fast-release cycles mentioned earlier. As the traditional staging or testing environments are shared, one developer’s feature can cause bugs, making the whole environment unusable. Similarly, the shared environments do not allow team members to collaborate frequently, so the product does not get the internal feedback it deserves. Ephemeral environments solve all these problems. They have revolutionized the way you perform testing and deployment. Let’s go through the benefits of ephemeral environments and discuss a real-life use case of a company that used ephemeral environments to accelerate its business.
Morgan Perry
November 23, 2022 · 7 min readLet’s start with what is actually an ephemeral environment.
#What Are Ephemeral Environments?
Ephemeral means temporary. An ephemeral environment is a temporary but fully functional lightweight deployment environment that is a copy of your existing staging, UAT, or production environment. Once you define your existing environments in the form of a template, it is super easy to spin up their cloned copies which are actually ephemeral environments. Each ephemeral environment works in complete isolation from other ephemeral environments, and other team members can access each ephemeral environment through its unique URL.
#Why it Matters?
Infrastructure is a key part of an application's behavior. The architecture and requirements are continually evolving. The question then arises as to how to incorporate these changes and developments into a suitable testing workflow with a high degree of confidence. This is where the Ephemeral environments come into play. Ephemeral environments allow you to integrate infrastructure and deployment processes into a testing suite. They ensure your testing environment is always in-sync with production, allowing you to iterate quickly to meet new requirements. In addition, Ephemeral environments encourage you to lean on automated tests over manual tests, ensuring that your application behaves as expected.
#How and When to Use Ephemeral Environments: A Use Case
Let’s discuss a use case of a real company that solved its efficiency problems by adopting ephemeral environments.
#Context
The company is developing a rich API that a SaaS application will consume, but clients would also need to consume those API’s directly to be integrated into their existing systems. There is one production environment and one staging environment, and API’s are containerized through docker containers. The CI/CD pipeline is fully automated. As soon as the code is pushed, a suite of automated testing runs, and if it is successful, then the build is deployed on production. If the test suite fails, then the build is rolled back. The team comprises front-end/back-end developers, product managers, QA engineers, and DevOps engineers.
#Problem
Although the current setup is fully automated because of automating testing suite and automated pipeline, however, the team is struggling in the following areas:
- As the staging environment is shared and static, when all features and bug fixes are deployed to staging at the end of the sprint, all hell breaks loose. The QA engineers complain that the developer did not test his/her tickers properly, while the developers claim that it worked fine in the development environment. When a showstopper bug is faced in staging, all the teams stop work because they cannot resume testing on staging unless that showstopper bug is resolved.
- The release happens only after two weeks; however, the staging cloud infrastructure is billed 24/7. This is causing much money which should be saved somehow.
- The end product cannot benefit from the mutual collaboration and feedback from the other stakeholders like the product manager, UX designer, and head of product development because there are too many features and bug fixes waiting for review in the staging environment. After all the pieces finally start working, there needs to be more time left for feedback incorporation.
#Solution
The team needs to adopt ephemeral environments, also known as preview environments. Let’s see how ephemeral environments solve the above problems.
- Each developer can thoroughly test his/her features on the temporary, ephemeral environment, a replica of the staging environment. Each code push by a developer will provision an ephemeral environment having just one code branch. Anyone can test that particular features in complete isolation in that ephemeral environment. A large team might have dozens of temporary, ephemeral environments open during the sprint and closed within a few hours or days. The ability to test each feature in isolation allows teams to test efficiently. Even if a showstopper bug is faced that only affects the particular ephemeral environment where it is deployed, other teams using other ephemeral environments at the same time will keep testing other features in their respective ephemeral environments.
- The infrastructure of ephemeral environments is temporary. Only when you provision the ephemeral environment the underlying infrastructure is allocated. Developers quickly spin up an ephemeral environment, test, and close the feature. As soon as they close the ephemeral environment, its associated infrastructure is also removed. You do not need to pay the 24/7 cost of the infrastructure.
- Now developers provision the ephemeral environment for each feature and share the unique URL of that ephemeral environment with QA engineers and other stakeholders for quick feedback. When code PR is updated because the developer incorporated some feedback, the ephemeral environment is also automatically updated.
#Results & Benefits of Ephemeral Environments
#Reduce bugs in production and downtime
Ephemeral environments reduce production bugs because most are reported and fixed in ephemeral staging environments. As the ephemeral environments can be a replica of staging or production, bugs can be produced and fixed during testing on staging replica ephemeral environments. Overall downtime of production and staging environment is also reduced because the issues that cause downtime are identified and fixed on ephemeral environments before final deployment on production. Clones of staging and production environment allow everyone to develop in a production-like environment. This results in fewer regression bugs and cleaner code, and you can merge the code without worrying about breaking the application.
#Reduce bottlenecks and speed up release cycles
Ephemeral environments reduce the bottlenecks caused by shared staging environments. You can test each feature in isolation and share each ephemeral environment with other team members for quick feedback. Any blocker bug is blocking just the ephemeral environment where it is deployed; other ephemeral environments will be unaffected because each ephemeral environment works in complete isolation. This allows you to speed up your release cycles and market your product much faster. You can now also incorporate the feedback of different stakeholders at the early stage instead of waiting for one massive final deployment at the end of the sprint.
#Gain a self-serve approach for developers
Ephemeral environments bring autonomy and confidence in developers because they do not depend on the Ops team for environment provisioning. Using the self-service portal, they can spin different ephemeral environments independently. Using a self-service portal allows them to have better control of the deployments and releases. The ability to self-govern the deployment environments also improves the code quality of the developers.
#Promote team collaboration
The biggest beneficiary of ephemeral environments is the product itself. When different cross-functional team members collaborate through ephemeral environments, they can add a lot of business value to the product being developed. This allows teams to go the extra mile in refining the product; after all, whatever they are doing is confined to a specific ephemeral environment that is working in complete isolation. The end result is a product that is a rich blend of different ideas from all the stakeholders. This is impossible if you still use the traditional shared staging environments.
#Save time and money
Businesses can save a lot of money and time if they adopt ephemeral environments. You do not waste much time setting up a complex deployment environment, saving valuable time. The time which you can invest in making the product more valuable. The infrastructure cost is also reduced because you pay for only the time you actually use the environment instead of 24/7 infrastructure. Once you have set up the template or blueprint of your staging or production environment, developers can easily replicate these environments without relying on Ops teams; this reduces your DevOps bill too. You also save time on blocker issues in shared environments where everyone is affected by a regression bug and waiting for this bug to be fixed so that the environment is operational again.
#Conclusion
Ephemeral environments are a modern approach for better and faster testing. It provides a more scalable and effective solution to environment management, especially if your team is growing. A market-leading solution like Qovery can help you adopt such a solution easily. With the help of Qovery, you can quickly implement a full fledge ephemeral environment system on your existing setup in just minutes instead of spending months on recreating a complex deployment environment.
To experience first-hand the power of Qovery's Ephemeral Environments, start a 14-day free trial.
Sign–up here - no credit card required!
Your Favorite DevOps Automation Platform
Qovery is a DevOps Automation Platform Helping 200+ Organizations To Ship Faster and Eliminate DevOps Hiring Needs
Try it out now!Your Favorite DevOps Automation Platform
Qovery is a DevOps Automation Platform Helping 200+ Organizations To Ship Faster and Eliminate DevOps Hiring Needs
Try it out now!