Skip to content

Commit

Permalink
fixes after docs update
Browse files Browse the repository at this point in the history
- add redirect plugin
- fixed links to renamed docs
  • Loading branch information
Roy Razon committed Dec 7, 2023
1 parent eaaca0a commit b079021
Show file tree
Hide file tree
Showing 9 changed files with 2,732 additions and 2,544 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ If you already have a locally stored Preevy Profile, it can be migrated to a rem
Once the profile is created, it can be imported to the CI runtime using `preevy init --from <profile-url>`

Examples:
- [Using AWS Lightsail](https://preevy.dev/ci/example-github-actions)
- [Using Google Cloud Engine](https://preevy.dev/ci/example-github-actions-gce)
- [Using AWS Lightsail](https://preevy.dev/ci-integration/example-github-actions)
- [Using Google Cloud Engine](https://preevy.dev/ci-integration/example-github-actions-gce)

### Faster builds in CI

Expand Down
6 changes: 3 additions & 3 deletions site/docs/ci-integration/example-github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In this section we'll show an example of how to run Preevy using our GitHub Acti
## Authentication

In this example Preevy will get your stored profile from AWS S3, and will deploy the repo using docker compose file to AWS Lightsail.
Make sure the action has [sufficient permissions](/drivers/aws-lightsail#required-permissions) to AWS.
Make sure the action has [sufficient permissions](/cloud-providers/aws-lightsail#required-permissions) to AWS.
See: [Assume a rule](https://github.com/aws-actions/configure-aws-credentials#assuming-a-role)

Once configured, use the [AWS for GitHub Actions](https://github.com/marketplace/actions/configure-aws-credentials-for-github-actions) action:
Expand Down Expand Up @@ -46,7 +46,7 @@ Make sure your code is checked out before using the preevy up action, using the
- uses: actions/checkout@v3
```

Specify the required `profile-url` input arg to load the Preevy profile you [configured earlier](/ci/overview#how-to-run-preevy-from-the-ci).
Specify the required `profile-url` input arg to load the Preevy profile you [configured earlier](/ci-integration/overview#how-to-run-preevy-from-the-ci).

Specify paths to the Docker Compose file using the `docker-compose-yaml-paths` input arg. If more than a single file exists, a comma-separated list of paths can be specified. The defaults are `docker-compose.ya?ml` or `compose.ya?ml` in the root directory.

Expand Down Expand Up @@ -97,7 +97,7 @@ Just like the preevy-up action, we need to authenticate and checkout.
- uses: actions/checkout@v3
```
With the `profile-url` arg, load the Preevy profile you [configured earlier](/ci/overview#how-to-run-preevy-from-the-ci), with the AWS S3 permissions we granted earlier.
With the `profile-url` arg, load the Preevy profile you [configured earlier](/ci-integration/overview#how-to-run-preevy-from-the-ci), with the AWS S3 permissions we granted earlier.

```yaml
- uses: livecycle/[email protected]
Expand Down
138 changes: 138 additions & 0 deletions site/docs/ci/example-github-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
sidebar_position: 2
title: "Example: Github Actions + AWS"
---

# GitHub Actions

In this section we'll show an example of how to run Preevy using our GitHub Actions [preevy-up](https://github.com/marketplace/actions/preevy-up) and [preevy-down](https://github.com/marketplace/actions/preevy-down) with AWS as the VM provider.

# Preevy-Up

## Authentication

In this example Preevy will get your stored profile from AWS S3, and will deploy the repo using docker compose file to AWS Lightsail.
Make sure the action has [sufficient permissions](/cloud-providers/aws-lightsail#required-permissions) to AWS.
See: [Assume a rule](https://github.com/aws-actions/configure-aws-credentials#assuming-a-role)

Once configured, use the [AWS for GitHub Actions](https://github.com/marketplace/actions/configure-aws-credentials-for-github-actions) action:

```yml
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: [your-aws-role]
aws-region: [your-aws-region]
```
## Permissions
Preevy requires the following [GitHub Actions permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs):
* `contents: read`: used by Preevy to read the Docker Compose file(s)
* `pull-requests: write`: used by the Preevy GitHub plugin to write the deployed URLs on the PR

In addition, if you're using GitHub's OIDC Token endpoint to authenticate to your cloud provider (as in the below examples), `id-token: write`: is also needed.

```yaml
permissions:
id-token: write
contents: read
pull-requests: write
```

## Running Preevy
Make sure your code is checked out before using the preevy up action, using the [Checkout](https://github.com/marketplace/actions/checkout) action:

```yaml
- uses: actions/checkout@v3
```

Specify the required `profile-url` input arg to load the Preevy profile you [configured earlier](/ci-integration/overview#how-to-run-preevy-from-the-ci).

Specify paths to the Docker Compose file using the `docker-compose-yaml-paths` input arg. If more than a single file exists, a comma-separated list of paths can be specified. The defaults are `docker-compose.ya?ml` or `compose.ya?ml` in the root directory.

```yaml
- uses: livecycle/[email protected]
with:
profile-url: "s3://preview-12345678-ci?region=us-east-1"
docker-compose-yaml-paths: "./docker/docker-compose.yaml"
```

## Complete workflow example

```yml
name: Deploy Preevy environment
on:
pull_request:
types:
- opened
- synchronize
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::12345678:role/my-role
aws-region: eu-west-1
- uses: actions/checkout@v3
- uses: livecycle/preevy-up-action@latest
id: preevy
with:
profile-url: "s3://preevy-12345678-my-profile?region=eu-west-1"
# docker-compose-yaml-paths arg will point to the `docker-compose.yml` file. if you have multiple docker compose files, you can add them as a comma seperated string like so `'docker-compose.yml,docker-compose.dev.yml'`
docker-compose-yaml-paths: "./docker/docker-compose.yaml"
```
# Preevy-Down
Use this action to stop and delete a preview environment using the Preevy CLI when the Pull Request is merged or closed.
## Teardown the Preevy environment
Just like the preevy-up action, we need to authenticate and checkout.
```yaml
- uses: actions/checkout@v3
```
With the `profile-url` arg, load the Preevy profile you [configured earlier](/ci-integration/overview#how-to-run-preevy-from-the-ci), with the AWS S3 permissions we granted earlier.

```yaml
- uses: livecycle/[email protected]
with:
profile-url: "s3://preevy-12345678-my-profile?region=eu-west-1"
docker-compose-yaml-paths: "./docker/docker-compose.yaml"
```
This part is a bit different from the preevy-up action,
you should pass the args as if you are passing them to the [preevy down command](/cli-reference/down),
note the `-f` before the docker-compose file path.
```yaml
```
for multiple docker files you can use `"-f ./docker/docker-compose.yaml -f ./docker/docker-compose.dev.yaml"`

```yml
name: Teardown Preevy environment
on:
pull_request:
types:
- closed
permissions:
id-token: write
contents: read
jobs:
teardown:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::12345678:role/my-role
aws-region: eu-west-1
- uses: actions/checkout@v3
- uses: livecycle/preevy-down-action@latest
id: preevy
with:
profile-url: "s3://preevy-12345678-my-profile?region=eu-west-1"
args: "-f ./docker/docker-compose.yaml"
```
8 changes: 4 additions & 4 deletions site/docs/cloud-providers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parent: /cloud-providers


Preevy allows you to easily provision preview environments for your Docker Compose applications to the cloud provider or Kubernetes cluster you're using:
- For AWS: use `aws configure`. See [AWS lightsail credentials configurations](/drivers/aws-lightsail#credentials-configuration).
- For GCP: use `gcloud auth application-default login`. See [GCP credentials configuration](/drivers/gcp-gce#credentials-configuration)
- For Azure: use `az login`. See [Azure credentials configuration](/drivers/azure#credentials-configuration)
- For Kubernetes: See [Kubernetes credentials configuration](/drivers/kube-pod#requirements)
- For AWS: use `aws configure`. See [AWS lightsail credentials configurations](/cloud-providers/aws-lightsail#credentials-configuration).
- For GCP: use `gcloud auth application-default login`. See [GCP credentials configuration](/cloud-providers/gcp-gce#credentials-configuration)
- For Azure: use `az login`. See [Azure credentials configuration](/cloud-providers/azure#credentials-configuration)
- For Kubernetes: See [Kubernetes credentials configuration](/cloud-providers/kube-pod#requirements)
10 changes: 5 additions & 5 deletions site/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Preevy is designed to be easy to use, with an API smiliar to [Docker Compose](ht
```

2. Choose the cloud provider or Kubernetes cluster you're going to use and configure credentials:
- For AWS: use `aws configure`. See [AWS lightsail credentials configurations](/drivers/aws-lightsail#credentials-configuration).
- For GCP: use `gcloud auth application-default login`. See [GCP credentials configuration](/drivers/gcp-gce#credentials-configuration)
- For Azure: use `az login`. See [Azure credentials configuration](/drivers/azure#credentials-configuration)
- For Kubernetes: See [Kubernetes credentials configuration](/drivers/kube-pod#requirements)
- For AWS: use `aws configure`. See [AWS lightsail credentials configurations](/cloud-providers/aws-lightsail#credentials-configuration).
- For GCP: use `gcloud auth application-default login`. See [GCP credentials configuration](/cloud-providers/gcp-gce#credentials-configuration)
- For Azure: use `az login`. See [Azure credentials configuration](/cloud-providers/azure#credentials-configuration)
- For Kubernetes: See [Kubernetes credentials configuration](/cloud-providers/kube-pod#requirements)

3. Set up a profile

Expand All @@ -62,5 +62,5 @@ Managing and provisioning preview environments in Preevy, requires access and cr
Once you install and initialize your cloud provider CLI, Preevy will recognize and employ your configuration settings.


For more info, see [AWS lightsail credentials configurations](/drivers/aws-lightsail#credentials-configuration), [GCP credentials configuration](/drivers/gcp-gce#credentials-configuration), [Azure credentials configuration](/drivers/azure#credentials-configuration) and [Kubernetes credentials configuration](/drivers/kube-pod#requirements).
For more info, see [AWS lightsail credentials configurations](/cloud-providers/aws-lightsail#credentials-configuration), [GCP credentials configuration](/cloud-providers/gcp-gce#credentials-configuration), [Azure credentials configuration](/cloud-providers/azure#credentials-configuration) and [Kubernetes credentials configuration](/cloud-providers/kube-pod#requirements).
:::
8 changes: 4 additions & 4 deletions site/docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ sidebar_position: 14

## More cloud drivers

- [x] [AWS lightsail](drivers/aws-lightsail.md)
- [x] [GCP Compute Engine](drivers/gcp-gce.md)
- [x] [Azure](https://azure.microsoft.com/)
- [x] [Kubernetes](drivers/kube-pod.md)
- [x] [AWS lightsail](/cloud-providers/aws-lightsail.md)
- [x] [GCP Compute Engine](/cloud-providers/gcp-gce.md)
- [x] [Azure](/cloud-providers/azure.md)
- [x] [Kubernetes](/cloud-providers/kube-pod.md)
- [ ] [fly.io](https://fly.io/)

## Plugins
Expand Down
28 changes: 27 additions & 1 deletion site/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula')
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Preevy',
tagline: 'Provision preview environments with minimal configuration m',
tagline: 'Provision preview environments with minimal configuration',
favicon: 'img/favicon.svg',

// Set the production url of your site here
Expand Down Expand Up @@ -95,6 +95,32 @@ const config = {
darkTheme: darkCodeTheme,
},
}),

plugins: [
[
'@docusaurus/plugin-client-redirects',
/** @type {import('@docusaurus/plugin-client-redirects').Options} */
{
redirects: [
// {
// from: '/integrations/github-plugin.md',
// to: '/ci-integration/.md',
// },
],
createRedirects: existingPath => {
if (existingPath.startsWith('/ci-integration/')) {
return existingPath.replace('/ci-integration/', '/ci/')
}

if (existingPath.startsWith('/cloud-providers/')) {
return existingPath.replace('/cloud-providers/', '/drivers/')
}

return undefined
}
},
],
],
}

module.exports = config
9 changes: 5 additions & 4 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
},
"dependencies": {
"@docsearch/js": "3",
"@docusaurus/core": "2.3.1",
"@docusaurus/preset-classic": "2.3.1",
"@docusaurus/remark-plugin-npm2yarn": "^2.3.1",
"@docusaurus/core": "2.4.3",
"@docusaurus/plugin-client-redirects": "2.4.3",
"@docusaurus/preset-classic": "2.4.3",
"@docusaurus/remark-plugin-npm2yarn": "2.4.3",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.3.1",
"@docusaurus/module-type-aliases": "2.4.3",
"@tsconfig/docusaurus": "^1.0.5",
"typescript": "^4.7.4"
},
Expand Down
Loading

0 comments on commit b079021

Please sign in to comment.