forked from livecycle/preevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added few docs * Update site/docs/intro/under-the-hood.md Co-authored-by: Roy Razon <[email protected]> * Update site/docs/intro/under-the-hood.md Co-authored-by: Roy Razon <[email protected]> * Update site/docs/intro/under-the-hood.md Co-authored-by: Roy Razon <[email protected]> * CR Changes * fix * Update motivation.md * Update motivation.md * fix * more fixes * fix * fix * fix * update * Update site/docs/intro/under-the-hood.md Co-authored-by: Roy Razon <[email protected]> * more CR changes * fix oci image * added light sail configuration * fix * fix * another fix * added link to lightsail * cr changes --------- Co-authored-by: Roy Razon <[email protected]>
- Loading branch information
Showing
7 changed files
with
174 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
sidebar_position: 1 | ||
title: AWS Lightsail | ||
--- | ||
|
||
`preevy` can provision virtual machines on AWS Lightsail using the `aws-lightsail` driver. | ||
[AWS lightsail](https://aws.amazon.com/lightsail) is a managed service that provides a simple low-cost solution for running VMs in the cloud. | ||
AWS lightsail provisioning time for a VM is usually around 2 minutes and their cost can be as low as $3.50 per month making them suitable for preview environments at scale. | ||
|
||
|
||
### Supported flags | ||
- `--aws-region` - The AWS region to use. | ||
|
||
### Credentials Configuration | ||
`preevy` uses AWS SDK which supports multiple ways of configuring credentials according to the [credentials provider chain](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html). | ||
The simplest way is to use `aws configure` command or setting the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. | ||
|
||
In Github actions, you can also use the [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) action to setup credentials in a secure way. | ||
|
||
### Required permissions | ||
|
||
`preevy` requires the following policy to be able to provision and manage Lightsail VMs: | ||
``` | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"lightsail:*" | ||
], | ||
"Resource": "*" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
:::note | ||
When defining fine grained permissions for `preevy`, make sure to add s3 permissions as well when using s3 as profile store. | ||
It's recommended to scope the permissions to a specific bucket and prefix if needed: | ||
``` | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:HeadBucker", | ||
"s3:GetBucketLocation", | ||
"s3:ListObjects", | ||
"s3:ListObjectsV2", | ||
"s3:PutObject", | ||
"s3:GetObject", | ||
"s3:PutObjectTagging", | ||
"s3:DeleteObjectTagging", | ||
"s3:DeleteObject", | ||
"s3:CreateBucket", //only if bucket doesn't exist | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::MY_BUCKET", | ||
"arn:aws:s3:::MY_BUCKET/*" | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: Motivation | ||
--- | ||
|
||
Preevy was designed to help development teams improve their PR workflows by providing a simple and cost-effective way to provision ephemeral environments for every Pull Request. (AKA *Preview Environments*) | ||
|
||
Our mission at [Livecycle](https://livecycle.io) is to make the development flow more collaborative and free of back and forth communication. | ||
We believe that preview environments serve an integral part for accomplishing our mission, and one of our earliest challenges as a startup was to make preview environments more accessible and affordable for all teams. | ||
|
||
To give more context, preview environments are ephemeral environments created for every Pull Request, and can be used to test, validate and review changes before merging them to the main branch. | ||
To some essence, they are a non-production version of the application that can be accessed by anyone with a link that is automatically attached to every pull request. | ||
|
||
During our work, we've seen teams that implemented preview environments for frontend applications by leveraging the power of [Vercel](https://vercel.com/), [Netlify](https://www.netlify.com/) or even our [own solution](https://livecycle.io). | ||
|
||
Yet, when it comes to deploying preview environments for a complex application with multiple services, many teams struggle to find the right solution and juggle between the different tradeoffs (fidelity, security, cost, scale, etc...) and complexities, and usually end up with either postponing/giving-up or implementing a complex (and usually costly) solution that doesn't necessarily fit in their development flow. | ||
To some degree, these challenges are risen from the inherit complexities and fragmentation presented in the configuration of production (or production-like) of enterprise applications. (e.g. Kubernetes configuration, IaC, scale, compliance/security, etc...) | ||
|
||
`preevy` lowers the bar for deploying preview environments, aiming for any developer with a minimal knowledge of Docker and a cloud provider account. | ||
|
||
In the tradeoff between fidelity and simplicity, we've chosen simplicity, and we believe that preview environments should be cheap, hackable, and accessible to everyone to provide the most value in development flows. | ||
|
||
We've originally planned `preevy` as a side-project allowing our customers to provision preview environments on their infrastructure. | ||
We've decided to open-source it as we are excited on the potential value that it can bring to the community and the possibility of establishing a ecosystem of standards, practices and tools around preview environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
# Tunnel Server | ||
|
||
`preevy` uses a tunnel server to expose the preview environments services to the end user. | ||
By default, the CLI uses a public tunnel server hosted on `livecycle.run`, but this configuration can be override using the `--tunnel-server` flag. | ||
The tunnel server can be self hosted and a Docker/OCI image is publicly available on `ghcr.io/livecycle/preevy/tunnel-server` | ||
|
||
The tunnel server itself is a node.js server responsible for creating tunnels for http services using SSH. | ||
The server accept ssh connections in port 2222, http traffic on port 3000. | ||
Assuming the tunnel server is running on `tunnel-server-host`, creating a tunnel for a http service running on port 5000 is as simple as running: | ||
```bash | ||
ssh -I {some_rsa_key} -R /my-tunnel:localhost:5000 tunnel-server-host hello | ||
``` | ||
The expected output of this command will be something like: | ||
``` | ||
{"clientId":"5rwpwhy5","tunnels":{"/test":"http://my-tunnel-5rwpwhy5.tunnel-server-host:3000/"}} | ||
``` | ||
A tunnel from `http://my-tunnel-5rwpwhy5.tunnel-server-host:3000->http://localhost:5000` was created, and can be accessed by anyone who knows the URL (assuming the tunnel server is public). | ||
|
||
## Security | ||
|
||
For connecting to tunneling server, you must use ssh private-key based authentication. | ||
Urls for tunnels are derived from the public key of the client (referred as clientId): | ||
`{tunnel_name}-{clientId}.{tunnel-server}`. | ||
|
||
`preevy` support connecting to a tunnel server over TLS which wrap the ssh connection, for these cases the tunnel server need to use an external service for TLS termination (e.g. nginx/haproxy/traefik). | ||
|
||
## Observability | ||
The tunnel server expose operational metrics on port 8888 that can be scraped by Prometheus or similar observability tool. |