Giter Site home page Giter Site logo

sushimushi / preevy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from livecycle/preevy

0.0 0.0 0.0 19.01 MB

Quickly deploy preview environments to the cloud!

Home Page: https://preevy.dev

License: Apache License 2.0

Shell 1.37% JavaScript 2.91% TypeScript 93.67% CSS 0.72% Batchfile 0.01% Dockerfile 0.16% Starlark 0.08% Nunjucks 0.21% MDX 0.87%

preevy's Introduction


Preevy

Provision preview environments with minimal configuration โ€ข made by Livecycle

GitHub GitHub last commit Version


Terminal GIF

Preevy

Preevy is a powerful Command Line Interface (CLI) tool designed to simplify the process of creating ephemeral preview environments. With Preevy, you can easily provision a preview environment for any Docker-Compose application in the cloud.
It supports various platforms, including affordable VMs from AWS Lightsail, Google Cloud, and Microsoft Azure, or any Kubernetes cluster.

Preevy makes it a breeze to create preview environments for your PRs, offering a range of exciting 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 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 new virtual machine (VM) on your cloud.
  • Build and deploy your application on the VM.
  • 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

To start using the Preevy CLI you will need:

  • Docker for desktop/Docker cli
  • Node 18
  • A Docker-Compose application (examples can be found here)
  • A cloud provider for provisioning VMs (AWS/GCP/Azure), or a Kubernetes cluster (local, remote or managed)

If you don't have an existing cloud account or prefer to try Preevy first locally, you can use the embeded Kuberentes inside Docker for Desktop at: Docker Settings -> Kuberentes -> Enable Kubernetes.
Afterwards just follow the instructions for Kuberentes driver.

For provisioning a VM, configure your provider:

  • In AWS, it could be by using aws configure
  • In GCP, it could be by using gcloud auth application-default login
  • In Azure, it could be by using az login

For provisioning a Kubernetes Pod, make sure a kubeconfig file exists and that you can run kubectl commands locally (e.g, kubectl get pod)

Running Preevy:

  1. Install the CLI using npm:npm install -g preevy , or use it directly using: npx preevy <command>
  2. Set up a profile by using: preevy init
  3. Use the preevy up command to provision a new VM with your application.
  4. Access and share your new preview environment at the *.livecycle.run link provided in the command output.
  5. Code changed? Re-run preevy up to quickly sync the preview environment with your changes on the existing VM.
  6. Remove the environment by using: preevy down.

Under the hood

Preevy has two main components:

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.

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 on livecycle.run, and it can be self-hosted as well.

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

CI Integration

Preevy is also designed to work seamlessly with your CI, allowing you to easily import a shared preview profile shared in AWS S3 and Google Cloud Storage (GCS).

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

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

Examples

Security

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

Notice on preview environments exposure

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

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 can be specified using the --id flag of the preevy up command, or automatically generated by git context.
  • 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 our free service at *.livecycle.run.

When using the default *.livecycle.run domain, environments are publicly accessible to those who know the URLs. You can create private environments by hosting the tunnel service yourself, e.g, on a private network or behind a login page.

Configuration files

Preevy extracts its runtime settings from the Compose file.

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

An additional option --system-compose-file can be used to specify paths to Compose files without overriding the default loading order. This is useful for scripts invoking the Preevy CLI (e.g, a GitHub Action), to accept user-provided compose files (including the default loading order) while ensuring a specific file is always loaded.

Preevy-specific configuration

Additional Preevy-specific configuration, if needed, can be specified by adding a x-preevy top-level element to the Compose file(s). Currently only the plugins section is supported:

services:
  ...
x-preevy:
  plugins:
    ...

See Plugins below.

Plugins

Plugins are a way to extend Preevy's functionality via externally-published NPM packages.

A plugin can execute code in response to events. It can also defined new commands, and add flags to existing commands to customize their behavior.

Plugins are specified in the Preevy configuration. Add a plugins section to the x-preevy top-level element:

services:
  ...
x-preevy:
  plugins:
    - module: '@preevy/plugin-github-pr-link'
      disabled: false # optional, set to true to disable plugin
      # ...additional plugin-specific configuration goes here

See the included GitHub PR Link Plugin for an example.

Docs and support

Read about Preevy's components and learn how to use them in our documentation.

Ask a question or join our Slack community to get support.

Telemetry

The Preevy CLI collects telemetry data to help us understand product usage and direct future development.

The data collected is anonymous and cannot be used to uniquely identify a user. Access to the data is limited to Livecycle's employees and not shared with 3rd parties.

We appreciate the usage data sent to us as - it's the most basic and raw type of feedback we get from our users. However, if you are concerned about sending out data, you may choose to disable telemetry.

Telemetry collection can be disabled by setting the environment variable PREEVY_DISABLE_TELEMETRY to 1 or true.

preevy's People

Contributors

yshayy avatar assafkr avatar eliyabar avatar naorzr avatar dependabot[bot] avatar yaara-hendel avatar hassansuhaib avatar panquesito7 avatar kburakozdemir avatar dromzeh avatar priyankarpal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.