Provision preview environments with minimal configuration•made by Livecycle
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
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 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.
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.
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.
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:
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.
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).