-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guide to run Piped on CloudRun #2231
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f110020
Add guide to run Piped on CloudRun
nghialv 7c5ee9b
Add note
nghialv 61814e8
Update docs/content/en/docs/operator-manual/piped/installation/_index.md
nghialv 6983b0c
Update docs/content/en/docs/operator-manual/piped/installation/instal…
nghialv f64cb23
Fix
nghialv File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
docs/content/en/docs/operator-manual/piped/installation/_index.md
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,9 @@ | ||
--- | ||
title: "Installation" | ||
linkTitle: "Installation" | ||
weight: 1 | ||
description: > | ||
This page describes how to install a Piped. | ||
--- | ||
|
||
Since Piped is a stateless agent, no database or storage is required to run. In addition, a Piped can interact with one or multiple cloud providers, so the number of Piped and where they should run is entirely up to your preference. For example, you can run your Pipeds in a Kubernetes cluster to deploy not just Kubernetes applications but your Terraform and CloudRun applications as well. |
121 changes: 121 additions & 0 deletions
121
docs/content/en/docs/operator-manual/piped/installation/installing-on-cloudrun.md
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,121 @@ | ||
--- | ||
title: "Installing on CloudRun" | ||
linkTitle: "Installing on CloudRun" | ||
weight: 2 | ||
description: > | ||
This page describes how to install Piped on CloudRun. | ||
--- | ||
|
||
## Prerequisites | ||
|
||
##### Having piped's ID and Key strings | ||
- Ensure that the `piped` has been registered and you are having its PIPED_ID and PIPED_KEY strings. | ||
- If you are not having them, this [page](/docs/operator-manual/control-plane/registering-a-piped/) guides you how to register a new one. | ||
|
||
##### Preparing SSH key | ||
- If your Git repositories are private, `piped` requires a private SSH key to access those repositories. | ||
- Please checkout [this documentation](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) for how to generate a new SSH key pair. Then add the public key to your repositories. (If you are using GitHub, you can add it to Deploy Keys at the repository's Settings page.) | ||
|
||
## Installation | ||
|
||
- Preparing a piped configuration file as the following: | ||
|
||
``` yaml | ||
apiVersion: pipecd.dev/v1beta1 | ||
kind: Piped | ||
spec: | ||
projectID: {PROJECT_ID} | ||
pipedID: {PIPED_ID} | ||
pipedKeyData: {BASE64_ENCODED_PIPED_KEY} | ||
webAddress: {CONTROL_PLANE_WEB_ADDRESS} | ||
# Write in a format like "host:443" because the communication is done via gRPC. | ||
apiAddress: {CONTROL_PLANE_API_ADDRESS} | ||
|
||
git: | ||
sshKeyData: {BASE64_ENCODED_PRIVATE_SSH_KEY} | ||
|
||
repositories: | ||
- repoId: {REPO_ID_OR_NAME} | ||
remote: git@github.com:{GIT_ORG}/{GIT_REPO}.git | ||
branch: {GIT_BRANCH} | ||
|
||
# Optional | ||
# Enable this Piped to handle CLOUD_RUN application. | ||
cloudProviders: | ||
- name: cloudrun-in-project | ||
type: CLOUDRUN | ||
config: | ||
project: {GCP_PROJECT_ID} | ||
region: {GCP_PROJECT_REGION} | ||
|
||
# Optional | ||
# Uncomment this if you want to enable this Piped to handle Terraform application. | ||
# - name: terraform-gcp | ||
# type: TERRAFORM | ||
|
||
# Optional | ||
# Uncomment this if you want to enable SecretManagement feature. | ||
# https://pipecd.dev/docs/user-guide/secret-management | ||
# secretManagement: | ||
# type: KEY_PAIR | ||
# config: | ||
# privateKeyData: {BASE64_ENCODED_PRIVATE_KEY} | ||
# publicKeyData: {BASE64_ENCODED_PUBLIC_KEY} | ||
``` | ||
|
||
- Creating a new secret in [SecretManager](https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets) to store above configuration data securely | ||
|
||
``` console | ||
gcloud secrets create cloudrun-piped-config --data-file={PATH_TO_CONFIG_FILE} | ||
``` | ||
|
||
- Running Piped in CloudRun | ||
|
||
khanhtc1202 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Prepare a CloudRun service manifest file as below. | ||
|
||
Note: Fields which set to '1' are strict to be set with that value to ensure piped work correctly. | ||
nghialv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` yaml | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
name: piped | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
autoscaling.knative.dev/maxScale: '1' # This must be 1. | ||
autoscaling.knative.dev/minScale: '1' # This must be 1. | ||
run.googleapis.com/ingress: internal | ||
run.googleapis.com/ingress-status: internal | ||
spec: | ||
containerConcurrency: 1 # This must be 1. | ||
containers: | ||
- image: gcr.io/pipecd/piped:v0.11.1 | ||
args: | ||
- piped | ||
- --metrics=true | ||
- --config-file=/etc/piped-config/config.yaml | ||
ports: | ||
- containerPort: 9085 | ||
volumeMounts: | ||
- mountPath: /etc/piped-config | ||
name: piped-config | ||
resources: | ||
limits: | ||
cpu: 1000m | ||
memory: 512Mi | ||
volumes: | ||
- name: piped-config | ||
secret: | ||
secretName: cloudrun-piped-config | ||
items: | ||
- path: config.yaml | ||
key: latest | ||
``` | ||
|
||
nghialv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` console | ||
gcloud beta run services replace cloudrun-piped-service.yaml | ||
``` | ||
|
||
Note: Make sure that the created secret is accessible from this Piped service. See more [here](https://cloud.google.com/run/docs/configuring/secrets#access-secret). |
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
51 changes: 51 additions & 0 deletions
51
...tent/en/docs/operator-manual/piped/installation/installing-on-single-machine.md
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,51 @@ | ||
--- | ||
title: "Installing on a single machine" | ||
linkTitle: "Installing on a single machine" | ||
weight: 3 | ||
description: > | ||
This page describes how to install a Piped on a single machine. | ||
--- | ||
|
||
## Prerequisites | ||
|
||
##### Having piped's ID and Key strings | ||
- Ensure that the `piped` has been registered and you are having its PIPED_ID and PIPED_KEY strings. | ||
- If you are not having them, this [page](/docs/operator-manual/control-plane/registering-a-piped/) guides you how to register a new one. | ||
|
||
##### Preparing SSH key | ||
- If your Git repositories are private, `piped` requires a private SSH key to access those repositories. | ||
- Please checkout [this documentation](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) for how to generate a new SSH key pair. Then add the public key to your repositories. (If you are using GitHub, you can add it to Deploy Keys at the repository's Settings page.) | ||
|
||
## Installation | ||
|
||
- Downloading the latest `piped` binary for your machine | ||
|
||
https://github.com/pipe-cd/pipe/releases | ||
|
||
- Preparing a piped configuration file as the following: | ||
|
||
``` yaml | ||
apiVersion: pipecd.dev/v1beta1 | ||
kind: Piped | ||
spec: | ||
projectID: {PROJECT_ID} | ||
pipedID: {PIPED_ID} | ||
pipedKeyFile: {PATH_TO_PIPED_KEY_FILE} | ||
webAddress: {CONTROL_PLANE_WEB_ADDRESS} | ||
# Write in a format like "host:443" because the communication is done via gRPC. | ||
apiAddress: {CONTROL_PLANE_API_ADDRESS} | ||
git: | ||
sshKeyFile: {PATH_TO_SSH_KEY_FILE} | ||
repositories: | ||
- repoId: {REPO_ID_OR_NAME} | ||
remote: git@github.com:{GIT_ORG}/{GIT_REPO}.git | ||
branch: {GIT_BRANCH} | ||
syncInterval: 1m | ||
``` | ||
|
||
- Start running the `piped` | ||
|
||
``` console | ||
./piped piped --config-file={PATH_TO_PIPED_CONFIG_FILE} | ||
``` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Optional comments like these makes it clear what to configure at least.