Easily provision ephemeral preview environments at low cost
8 min read
Preview environments are non-production versions of an application that are created for every code change, allowing developers and other stakeholders to test, validate and review the changes before merging them. Preview environments can improve the development and deployment workflow by enabling faster feedback, better collaboration, and higher-quality products.
However, setting up preview environments can be a complex and costly task, especially for multi-container applications that require multiple services, dependencies, and configurations. Developers may face several challenges and pain points when trying to create and use preview environments.
The Problems with Preview Environments
One of the challenges is that new PRs take a long time to merge. Without preview environments, developers have to wait for code reviews, manual testing, and staging deployment before they can merge their changes. This can create bottlenecks and delays in the development process. For example, if a developer has to wait for a day or two to get feedback on their PR from their team members or other stakeholders, they may lose momentum or context on their work. They may also have to deal with merge conflicts or outdated code if the main branch has changed in the meantime.
Another challenge is code freezes in a development environment. When multiple developers share a single staging environment, they may encounter conflicts or errors due to different versions or dependencies of their code. This can cause code freezes or downtime in the staging environment, affecting the testing and deployment of other features. For example, if a developer deploys a new version of their service to the staging environment that breaks another service or requires a different configuration, they may block other developers from testing or deploying their changes until they fix the issue or revert the change.
A third challenge is that testing code changes takes more time than manual testing on the local machine. Testing code changes on a local machine may not reflect the actual behaviour or performance of the application in a production-like environment. Developers may have to spend more time debugging and fixing issues that arise only in the staging or production environment. For example, if a developer tests their code changes on their local machine that has a different operating system, network configuration, or resource allocation than the production environment, they may miss some bugs or errors that only occur in the production environment.
A fourth challenge is disorganized feedback from other team members and stakeholders. Without preview environments, developers have to rely on various channels and tools to communicate and collect feedback from their team members and other stakeholders, such as designers, product managers, testers, etc. This can create confusion, duplication, or inconsistency in the feedback loop. For example, if a developer receives feedback on their PR from different sources such as Slack messages, emails, screenshots, shared documents, etc., they may have to spend more time organizing and prioritizing the feedback than acting on it. They may also miss some important feedback or get conflicting feedback from different sources.
A fifth challenge is the complexity and cost of setting up preview environments. Creating preview environments for every PR can be a complex and costly task, especially if developers have to manage their infrastructure, cloud providers, CI pipelines, DNS configuration, certificates, etc. Some PaaS platforms may offer integrated preview environments, but they may not be compatible with the existing deployment pipeline or cloud provider of the developers. For example, if a developer wants to create preview environments for their application that runs on the cloud using Docker Compose, they may have to use multiple tools or scripts to provision VMs, build and deploy their application on the VMs, configure DNS and TLS for each service of their application, etc. They may also have to pay for the VMs even when they are not using them.
These problems can affect the productivity, efficiency, and quality of the development teams and their products. To solve these problems, developers need a simple and flexible solution that can easily provision and manage preview environments for any Docker Compose application across a variety of cloud platforms.
The Solution: Preevy
Preevy is a powerful command-line interface (CLI) tool that can deploy your Docker Compose application to a public, ephemeral environment, also known as a preview environment, for every code change you make. It supports various platforms, including affordable VMs from various cloud providers, or any Kubernetes cluster.
Preevy solves the problems of setting up and using preview environments by providing a number of features and benefits:
Preevy is designed with simplicity in mind, allowing developers with minimal Docker experience to utilize its features effortlessly. You only need to install Preevy on your machine and run a single up
command to create or update a preview environment for your application.
Preevy effortlessly integrates with various cloud platforms and Kubernetes by taking advantage of standard credential chains. You can choose your preferred platform or cluster without changing your application definition or configuration. Preevy also works with any CI pipeline that supports Docker Compose commands.
Preevy simplifies the environment creation process by orchestrating all the necessary steps, such as infrastructure provisioning, building, deployment, scaling, etc., into a single command. You don’t need to use multiple tools or scripts to manage your preview environments.
With Preevy’s tunnelling feature, secure access to each service within the application can be easily shared with anyone via a user-friendly HTTPS URL. You don’t need to worry about DNS or TLS configuration or additional ingress or reverse proxy layers. Preevy also handles multiple domains, subdomains, ports, protocols, etc., for you.
The Preevy CLI is designed to blend seamlessly into your existing workflow. It supports sharing remote profile contexts for teams and can easily be integrated into any Continuous Integration (CI) pipeline. Preevy also effectively organizes feedback by posting comments on your PRs with the URLs of the preview environments.
The Benefits: Faster Feedback, Better Collaboration, and Higher Quality Products
Using Preevy for creating your preview environments has several benefits. Let's look at a few of them.
You can get instant feedback on your code changes from your team members and other stakeholders by sharing the URL of your preview environment with them. They can try out your product revision on any device without installing anything. You can also run parallel E2E tests against your preview environments to expedite the testing process.
You can collaborate with your team members and other stakeholders more efficiently and securely by using preview environments. You can conduct design reviews, product demos, user testing, etc., without coordinating synchronous meetings. You can also generate private sandboxes to share with external parties, such as clients or partners, ensuring secure collaborative efforts.
You can improve the quality of your products by using preview environments to test, validate, and review your code changes in a production-like environment before merging them. You can also experiment with non-production versions of your product for presentations, examples, or tests, without affecting the main branch.
An Example: Building a Slack Clone with Preview Environments
To illustrate how Preevy can be used in different scenarios and how it solves some of the technical problems of creating preview environments, here is an example from a user who has tried Preevy:
- Building a Slack clone with preview environments: In this example, a developer shows how Preevy can be used to create a Slack clone with preview environments for every PR. The developer uses a Docker Compose file that defines three services: a web app, a backend API, and a MongoDB database. The developer then runs Preevy’s
up
command to create a preview environment for the application. Preevy automatically provisions a VM on the cloud, builds and deploys the application on the VM, and exposes each service to the web with an HTTPS URL. The developer then shares the URL of the web app with their team members and other stakeholders, who can try out the Slack clone on any device. The developer also integrates Preevy with GitHub Actions to automate the creation and destruction of preview environments for every PR. The developer says:
“Preevy is awesome! It makes it so easy to create and share preview environments for my Slack clone project. I don’t have to worry about setting up infrastructure, DNS, certificates, etc. I just run one command and I get a URL that I can share with anyone. It also integrates well with GitHub Actions, so I can have preview environments for every PR automatically. This helps me get faster feedback and better collaboration on my code changes.”
This example shows how Preevy can help developers create and share preview environments for their applications with minimal configuration and maximum convenience. It also shows how Preevy can integrate with CI pipelines and effectively organize feedback.
Conclusion
In conclusion, Preevy is a simple and flexible solution that simplifies preview environments for everyone. It solves the problems of setting up and using preview environments by providing ease of use, cross-platform compatibility, one-command orchestration, integrated ingress, and optimized workflow integration. It also offers faster feedback, better collaboration, and higher quality products as advantages. Preevy is an open-source project that is made by Livecycle, a startup that aims to make development flows more collaborative and free of back-and-forth communication.
Preevy is a very useful and innovative project that can benefit many developers and teams who want to improve their development and deployment workflow. It has a lot of potential to grow and expand its features and support more platforms and services. It also has an amazing community behind it that is passionate about making preview environments more accessible and affordable for everyone.