Preview environments for Docker Compose applications

6 min read

Cover Image for Preview environments for Docker Compose applications

In the fast-paced world of software development, it's crucial to test and validate changes thoroughly before deploying them to production. One effective way to achieve this is by creating preview environments, isolated spaces where you can preview the behaviour of your applications. In this blog, we'll explore how to preview environments for Docker Compose applications using Preevy, an open-source CLI that simplifies the process and provides secure access to your services.

What are Preview Environments?

Preview environments are temporary and isolated environments where developers can test code changes, new features, or bug fixes before they are merged into the main codebase and deployed to production. These environments help catch issues early, streamline collaboration, and ensure that changes won't negatively impact users.

Introducing Preevy

Preevy is an open-source CLI tool designed to make creating and managing preview environments for Docker Compose applications a breeze. It offers seamless integration with various cloud platforms and addresses the challenges of ingress management by providing secure HTTPS URLs for every service within your application.

How to use Preevy?

Prerequisites:

  1. Docker installed on your machine.

  2. Access to a cloud provider (e.g., AWS, Azure, GCP) with credentials configured.

Demo Steps:

  1. Install Preevy:

    Follow the installation instructions provided on the official Preevy documentation to install Preevy on your machine.

  2. Initialize or import a new profile Run the following command in your project directory to import a new profile.

     preevy init
    
  3. Provision a Preview Environment:

    Run the following command in your project directory to provision a new VM on your chosen cloud provider and deploy your app to it:

     preevy up
    

    Preevy will output the public URLs for each service of your app.

  4. Share the Preview Environment:

    Share the generated URLs with your team or stakeholders to showcase your app in the preview environment.

  5. Manage the Preview Environment:

    You can use the Preevy CLI commands to manage your preview environment. For example:

    • To delete the environment when you're done:

        preevy down
      
    • To delete all cloud provider machines and potentially other resources:

        preevy purge
      

Additionally, once you've generated the environments, you can easily modify some code and then trigger preevy up again to observe the changes taking effect instantly.

That's it! You've successfully created a preview environment for your docker-compose application using Preevy. It allows you to automate the process of creating and managing preview environments, making it easier to collaborate with your team and stakeholders during development and testing.

Advantages

Setting up preview environments for Docker Compose applications using Preevy offers numerous advantages that can significantly benefit your development workflow and project management.

Early Issue Detection

Preview environments allow developers to catch issues, bugs, and inconsistencies early in the development process. This reduces the likelihood of critical problems making their way into production.

Streamlined Collaboration

Preview environments provide a centralized space where team members, stakeholders, and quality assurance (QA) teams can collaborate and review changes without disrupting the main development or production environment.

Isolation:

Each preview environment is isolated from others, ensuring that changes made in one environment do not affect others. This isolation guarantees a clean testing environment for each feature or branch.

Security

Security Preevy's tunnelling solution ensures secure access to preview environments, mitigating security risks associated with exposing services to the public internet during testing and development.

Efficiency

Preevy simplifies the process of provisioning and managing preview environments, reducing the time and effort required to set up test environments manually.

Cost-Efficiency

By automating the provisioning and teardown of cloud resources, Preevy helps optimize cloud infrastructure costs, ensuring resources are only allocated when needed.

In summary, using Preevy to set up preview environments for Docker Compose applications offers a range of benefits, including improved development efficiency, enhanced code quality, and a more streamlined collaboration process. These advantages ultimately contribute to more successful and reliable software development projects.

Use Cases

  1. Feature Branch Testing:

    Imagine a scenario where the software development team is working on a complex web application with multiple features in development simultaneously. Each feature is developed on a separate Git branch. The team needs a way to quickly create isolated preview environments for each feature branch to test and review changes. In this case, we can use Preevy. It can be integrated into the team's CI/CD pipeline. Whenever a new feature branch is created or a pull request is submitted, Preevy automatically provisions a preview environment using the Docker Compose configuration specific to that branch. This allows developers and QA testers to thoroughly test each feature in isolation before merging it into the main codebase.

  2. Client Demos:

    Imagine an agency is building a custom e-commerce platform for a client. The client wants to see regular updates and test new features before the final release. However, exposing the entire application to the client's network is a security risk. The agency can use Preevy to create secure preview environments for each milestone or feature demo. Preevy generates HTTPS URLs that can be shared with the client, giving them a convenient and secure way to review the application's progress without compromising security.

  3. Continuous Testing for Microservices:

    Let's say the company is developing a microservices-based architecture for its e-commerce platform. Testing the interaction between these microservices is crucial, but setting up and managing multiple interconnected services in development and staging environments is challenging.

    Here, Preevy is life's saviour. It simplifies the process by automatically provisioning and linking the necessary microservices in isolated environments. The DevOps team can easily create, test, and tear down these environments as needed, ensuring that microservices work correctly together.

  4. Resource Optimization:

    Just think about a startup that is on a tight budget and wants to optimize cloud resource usage. They are concerned about developers forgetting to tear down development environments after use, leading to unnecessary costs. By integrating Preevy into their development workflow, the startup ensures that resources are automatically released when environments are no longer needed. This prevents unexpected cloud expenses and allows the team to stay within budget constraints.

  5. Cross-Team Collaboration:

    Large enterprise organization has separate development, QA, and security teams working on critical application. Collaboration and communication among these teams are essential to ensure a robust and secure release. Preevy provides a common platform where development, QA, and security teams can collaborate. Secure preview environments with dedicated HTTPS URLs enable each team to review, test, and validate changes while maintaining a high level of security and efficiency.

By providing a streamlined and automated process for creating and managing preview environments, Preevy enhances the overall development experience and project success.

Conclusion

Creating preview environments for Docker Compose applications using Preevy is a powerful way to enhance your development workflow. By simplifying provisioning, automating ingress management, and ensuring secure access, Preevy empowers teams to test and validate changes with confidence. Give it a try, streamline your development process, and embrace the benefits of preview environments for your projects.

Get involved

  1. Check out the documentation

  2. Star the GitHub repo

  3. Follow LiveCycle on Twitter

  4. Join the LiveCycle Slack channel