Project Icon

preevy

简化Docker应用预览环境部署的开源CLI工具

Preevy是一个开源的命令行工具,用于简化Docker应用的预览环境创建。它可自动配置云端虚拟机或Kubernetes Pod,构建并部署应用,同时生成公共HTTPS URL。支持多种云服务提供商,Preevy易于集成到CI/CD流程中,能为每个Pull Request创建独立环境。这有助于提升团队协作效率,加快反馈速度,并提供安全的非生产环境测试。


Preevy

Provision preview environments with minimal configuration made by Livecycle

GitHub GitHub last commit Version


We recently launched the Livecycle Docker Extension. Now you can share local environments instantly. Get feedback while your code is still in flight. Check it out here

https://github.com/Pradumnasaraf/preevy/assets/51878265/a699a356-f524-48fc-9b6d-49f2e42e7ec7

Preevy

Preevy is a Command Line Interface (CLI) tool designed to simplify the process of creating ephemeral preview environments from Dockerized applications. Integrate Preevy into your CI flow to deploy Pull Requests as preview environments, using your existing cloud provider or Kubernetes cluster.

Preevy makes use of affordable VMs from AWS Lightsail, Google Cloud, Microsoft Azure, or any Kubernetes cluster.

Preevy can deploy your app with public or protected access, on the public internet or inside your existing private network.

Deploying a preview environment per Pull Request offers a range of benefits:

  • 🌍 Universal Access: Just by sharing a URL, you can allow anyone to try your product revision on any device.

  • 📩 Effortless Asynchronous Updates: Keep non-technical stakeholders in the loop without coordinating synchronous meetings.

  • 🎨 Hassle-free Design Reviews: Designers can verify implementation independently, minimizing interruptions.

  • 🚀 Parallel E2E Tests: Use external test agents against preview environments to expedite the testing process.

  • 💡 Streamlined Feedback Cycle: Preview environments let your team engage with and feedback on new features early in the pipeline.

  • 🧪 Non-production Experimentation: Develop and share unique versions of your product for presentations, examples, or tests.

  • 🔐 Secure Collaboration: Generate private sandboxes to share with external stakeholders, ensuring secure collaborative efforts.


Visit The full documentation here: https://preevy.dev/

Contents

What

Preevy can take any Docker-Compose application definition and with a single up command perform the following:

  • Provision and configure a virtual machine (VM) on your cloud, or a Pod on your Kubernetes cluster.
  • Build your application on the VM/Pod or on any BuildKit builder (optional)
  • Deploy your application on the VM/Pod.
  • Expose each service of your application to the web with a user-friendly public HTTPS URL without any DNS/Certificate configuration.

These environments can be managed using the Preevy command-line interface (CLI) and can be easily updated or destroyed when necessary. While Preevy can be used for sharing local environments with your team, its primary goal is to implement preview environments for pull requests. Therefore, it's designed to be easily integrated into CI/CD flows.

Why

At Livecycle, we believe that preview environments are an integral part of any development flow, in any engineering team. These non-production, ephemeral environments, created for every Pull Request, can significantly improve PR workflows. In recent years, preview environments have become increasingly popular, with some PaaS providers even offering deeply integrated preview environments. However, setting up preview environments can be a complex and costly task, which is why many teams have been hesitant to implement them. Preevy is designed to simplify this task and provide a framework for provisioning and utilizing preview environments to optimize the PR flow. You can read more about the story and philosophy behind Preevy here.

Getting started

Prerequisites

Required software

Your Docker Compose app

If you don't have an existing Docker Compose app, check out Awesome Compose - a curated list of Compose samples, from React to Minecraft.

Your cloud provider or Kubernetes cluster

Preevy deploys your app to one of the supported deploy runtimes.

Choose the cloud provider or Kubernetes cluster you're going to use and configure access credentials for it:

Note Preevy only uses your credentials when you run the Preevy CLI to set up and connect to your environments. Your credentials are not sent or stored anywhere outside of your computer.

Local Kubernetes server using Docker Desktop

If you don't have an existing cloud account or prefer to try Preevy first locally, you can use the Docker Desktop Kubernetes server. Go to: Docker Settings -> Kubernetes -> Enable Kubernetes.

Install the Preevy CLI

npm install -g preevy

Or use npx to run the CLI without installing it:

npx preevy <command>

Set up a profile

preevy init

Preevy will ask you to select a deploy target and a storage location for your profile. You can start by storing the profile locally.

Deploy your first environment

From the same directory where your docker-compose.yml or compose.yml file is located, run the command below:

preevy up

Note: Preevy uses the git repo at the current directory to calculate a stable environment ID for your project. Make sure a git repo is initialized (with at least one commit), or add the --id flag to explicitly specify the environment ID.

Access and share your new preview environment at the *.livecycle.run links provided in the command output.

Update your environment

Code changed? Re-run preevy up to quickly sync the preview environment with your changes on the existing VM or Kubernetes Pod.

List and remove your environment

Run preevy ls to show all environments in your deploy target which are linked to your profile.

Run preevy down to remove your environment. Preevy will delete the VM or Kubernetes Pod.

Service URLs

Every Compose service is exposed individually with a generated URL in the following format: https://{service}-{[port]}-{env-id}-{client-id}.{tunnel-server-domain}. If the service exposes a single port, the port part is omitted. See here for a more detailed explanation.

  • env-id is automatically generated from the Compose project and Git branch, or can be explicitly specified using the --id flag of the preevy up command.
  • client-id is a random identifier based on the profile's public tunneling SSH key (generated in preevy init).
  • tunnel-service-domain is where the tunnel service is hosted. It can be specified using the --tunnel-url flag of the preevy up command, and defaults to Livecycle's hosted service at *.livecycle.run.

Under the hood

Preevy has two main components:

CLI

The CLI is a Node.js program responsible for:

  • Provisioning and tearing down VMs.
  • Exposing environments' state and URLs to the end user.
  • Storing and accessing profile data (settings, keys, etc).
  • Setting up a VM with Docker tooling.
  • Syncing Compose source code and local volumes.
  • Running the Compose app, augmented with a daemon for connecting to the tunneling service.

Tunnel server

The tunnel server is a Node.js base server responsible for exposing friendly HTTPS URLs for the Compose services.

A free public instance is hosted by Livecycle on livecycle.run, and it can be self-hosted as well.

A public Docker/OCI image is available: ghcr.io/livecycle/preevy/tunnel-server

To host your own Tunnel Server instance, see the deployment guide.

CI Integration

Preevy is designed to work seamlessly with your CI, by importing a shared preview profile from AWS S3 Google Cloud Storage (GCS) and Azure Blob Storage (AZBlob).

Profiles are created using preevy init. Choose a S3/GCS/AZBlob URL for storing the profile - Preevy will create a bucket if one doesn't exist.

If you already have a locally stored Preevy Profile, it can be migrated to remote storage using preevy profile cp

Once the profile is created, it can be imported to the CI runtime using preevy init --from <profile-url>

Examples

Faster builds in CI

Check out our documentation to find out how to speed up your builds and reduce the costs of your preview environments by running Preevy with BuildKit Builders in CI.

Example repos

GitHub Actions

Shortcut for setting up a cost-efficient Kubernetes cluster on AWS EKS

Don't have a Kubernetes cluster? See an example repo for setting up AWS EKS using Terraform. The example includes Karpenter which can reduce the cost of running Preview Environments by automatically expanding and shrinking your cluster using EC2 Spot Instances

Security

In case you find a security issue or have something you would like to discuss, refer to our security policy.

Private environments

Preevy can add an authentication layer to your provisioned environments. When you configure your service as private the Tunnel Server restricts access based on a pre-shared secret or a Livecycle login (SSO via Google/Microsoft/GitHub).

Exposure of preview environments

Services on provisioned environments are not exposed directly, but rather via a tunnel created by the tunneling server.

Livecycle access to data

When you use Preevy, Livecycle does not get access to your credentials or code. Preevy only uses your cloud provider or Kubernetes credentials to provision and connect to environments - it does not send or store the credentials.

Encrypted traffic to and from your environments goes through Preevy's Tunnel Server. Livecycle hosts the default Tunnel Server at livecycle.run which is available as part of Livecycle's SaaS offering. Like most SaaS providers, we keep logs for monitoring and troubleshooting purposes which include metadata of the requests. The Tunnel Server code is part of the Preevy OSS project; you can run it on your own infrastructure and specify the its address via the --tunnel-url flag.

Network isolation

The Tunnel Server can be deployed on your private network (e.g. VPC), which access to your environments at the network level.

Configuration

Preevy loads its configuration from the following sources, in order:

Preevy Profile

The Preevy profile is created by the init command and can be stored locally or remotely on your cloud provider. A profile is required to create environments. The profile includes the following:

  • A tunneling key, that is used to identify your services when connecting to the Tunnel Server.
  • The default driver to use for provisioning environments.
  • Default driver options to use per driver (e.g. AWS region, K8s namespace).
  • Driver state whose contents depend on the specific driver.

Profiles can be migrated to a different storage location using preevy profile cp.

The default profile can be overridden using the global command line argument --profile.

Note: The profile currently combines context and state, and some changes are planned.

Compose files

Preevy extracts its runtime settings from the Compose file.

Project Compose files

Just like with the docker compose CLI, you can use the global --file | -f command line argument to specify the path(s) for the Compose file. If not specified, the default loading order is used. Multiple files are supported.

Preevy-specific Compose file

In addition to the project compose files, an optional Preevy-specific Compose file can be used. Preevy attempts to load files named compose.preevy.yaml, compose.preevy.yml, docker-compose.preevy.yaml or docker-compose.preevy.yml. If one of these exists, it is loaded BEFORE the project composes file(s). The name of the Preevy-specific compose file can be overridden by specifying the argument --system-compose-file.

x-preevy: Preevy-specific configuration in the Compose file(s)

A x-preevy top-level element can be added to the Compose file(s).

services:
 
项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

稿定AI

稿定设计 是一个多功能的在线设计和创意平台,提供广泛的设计工具和资源,以满足不同用户的需求。从专业的图形设计师到普通用户,无论是进行图片处理、智能抠图、H5页面制作还是视频剪辑,稿定设计都能提供简单、高效的解决方案。该平台以其用户友好的界面和强大的功能集合,帮助用户轻松实现创意设计。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号