Preevy Documentation
repository·main·Indexed 25 days ago
https://github.com/livecycle/preevyA CLI tool for creating ephemeral preview environments for Dockerized applications. Preevy enables developers to deploy Pull Requests as live environments on AWS, GCP, Azure, or Kubernetes clusters. It includes a GitHub integration plugin (@preevy/plugin-github) for automatic PR commenting and build cache support, and allows configuration via the x-preevy Docker Compose element.
What's inside Preevy
- Preevy is an open-source tool designed to provision, manage, and expose ephemeral preview environments for containerized applications (specifically Docker Compose applications) in the cloud. It is intended to be integrated into pull/merge request workflows to provide inexpensive, customizable, and accessible environments for both technical and non-technical users without requiring deep DevOps knowledge.
Use the GitHub integration plugin
mainThe
@preevy/plugin-githubplugin provides GitHub integration for Preevy, allowing it to automatically post or update comments on Pull Requests with environment URLs.Automatic PR Comments
When running
preevy uporpreevy downin a supported CI environment (like GitHub Actions) where aGITHUB_TOKENand PR context are detected, Preevy will automatically post a comment to the PR containing the service URLs. When the environment is destroyed, it updates the comment to indicate deletion.Manual PR Comments
You can manually manage PR comments using the following commands:
preevy github pr comment: Creates or updates a comment for an existing environment with current URLs.preevy github pr uncomment: Updates the comment to state the environment has been deleted.
Understand the Livecycle Docker Extension features
mainThe Livecycle Docker Extension is a tool integrated with Docker that provides several features for sharing and managing development environments:
- Docker Integration: Provides a smoother experience for Docker users compared to generic tunneling tools.
- Consistent URLs & Private Environments: Supports stable URLs and the ability to restrict access via private URLs.
- Authentication: Supports Google and GitHub authentication out of the box.
- Debugging Capabilities: The Livecycle dashboard allows for log inspection, shell access, and container inspection.
- Preevy CLI Integration: Allows you to create remote ephemeral preview environments for Pull Requests (useful when your local machine is offline or within a CI pipeline).
- Security: Uses a secure SSH tunnel to expose local environments via Livecycle's tunnel server, which is only accessible via HTTPS.
- Language Agnostic: Works with any framework or language that can run inside a Docker container.
Preevy System Components
mainCLI
A Node.js program that manages the environment lifecycle. It handles:
- Provisioning/tearing down VMs.
- Managing profile data.
- Setting up Docker tooling on VMs.
- Syncing Compose source and volumes.
- Running the application and the tunneling daemon.
Tunnel Server
A Node.js-based server that exposes friendly HTTPS URLs for your Compose services.
- Public Instance: Hosted at
livecycle.run. - Self-hosted: Can be deployed via Kubernetes.
Use the Livecycle Dashboard to review ephemeral environments
mainThe Livecycle Dashboard is used to manage and share ephemeral environments created by Preevy. It allows you to:
- Share code changes: Invite teammates to specific ephemeral environments to review latest changes.
- Collect feedback: Enable team members to provide feedback in context.
- Manage projects: Team members can view open projects assigned to them and review changes directly in their browser.
What is the Livecycle Dashboard?
mainThe Livecycle Dashboard is a web application providing a graphical user interface (GUI) for managing Livecycle environments. It includes features for team collaboration and environment management, such as:
- Remote Access: Remote terminal access and remote log access.
- Inspection: Container inspection capabilities.
- Collaboration: Integrated chat and pointing tools to facilitate teamwork.
Security and access control
mainPreevy uses a secure SSH tunnel to expose local development environments via Livecycle's tunnel server, which is accessible only via HTTPS. To restrict access to your environment, you can enable private URLs.How Preevy provisions preview environments
mainWhen you run the
preevy upcommand, Preevy automates the following lifecycle to create a preview environment:- Configuration Loading: Reads Compose files, tunneling keys, and default flags from your profile. It calculates an environment ID (usually based on the current git branch or a provided
--idflag). - Target Provisioning: Queries your configured cloud provider (Azure, GCE, etc.) or Kubernetes cluster. If a deployment target (VM or Pod) doesn't exist, Preevy provisions a new one.
- Tunnel Setup: Establishes an SSH tunnel to the Docker server on the target machine.
- Build Process: Generates an interim build Compose file and runs
docker buildx bake. Images are then loaded to the target machine or an image registry. - Deployment: Executes
docker compose upon the remote machine. Local volume mounts are synced to the remote machine first. - Proxy Injection: Augments your project with a
preevy_proxyhelper service that connects to the Tunnel Server. - URL Generation: The
preevy_proxycreates tunnels for each service, and Preevy fetches and prints the resulting public HTTPS URLs.
- Configuration Loading: Reads Compose files, tunneling keys, and default flags from your profile. It calculates an environment ID (usually based on the current git branch or a provided
Use the Livecycle Dashboard for collaboration
mainThe Livecycle Dashboard is a web-based interface accessible via a browser when logged into a Livecycle account. It is used to:
- Invite teammates to existing preview environments for review and feedback.
- View open projects assigned to team members.
- Review the latest changes directly in the browser.
Manage Preevy plugins
mainPlugins extend Preevy via NPM packages and can add hooks, commands, or flags. The
@preevy/plugin-githubplugin is enabled by default.Enabling/Disabling Plugins
- Via Compose file: Add a
pluginssection tox-preevy. - Via Environment Variables: Use
PREEVY_ENABLE_PLUGINSorPREEVY_DISABLE_PLUGINSwith a comma-separated list of package names. - Via CLI Flags: Use
--enable-plugin=<module>or--disable-plugin=<module>. CLI flags have the highest priority.
x-preevy: plugins: - module: '@preevy/plugin-github' disabled: false # optional, set to true to disable- Via Compose file: Add a
Supported frameworks and languages
mainThe Preevy CLI is language and framework agnostic. It can work with any application or service that runs within a Docker container.Understand Deploy Runtimes
mainA Deploy Runtime is the underlying infrastructure where Preevy builds and deploys preview environments. Supported runtimes include:
- Kubernetes (
kube-pod) - AWS Lightsail
- Google Cloud Platform (GCE)
- Microsoft Azure
- Kubernetes (