Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is a hands-on introduction to PipeCD for the beginners.

<!-- [Go to Japanese ver](content/ja/README.md) -->
[Go to Japanese ver.](content/ja/README.md)

## The Goal

Expand Down
45 changes: 45 additions & 0 deletions content/ja/10-overview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 仕組み概説

このページでは、PipeCDの基本的な仕組みについて学びます。

## アーキテクチャ概観

PipeCDは **Control Plane** と **Piped (Agent)** の2つのコンポネントからなります。

![architecture-overview](/images/overview/architecture-role.svg)
<p align="center">アーキテクチャ概観</p>

**1. Control Plane**
- ステートの保管 (例: デプロイメントのステータス、ログ)
- コンソールのUIを提供

**2. Piped (Agent)**
- デプロイメントの計画・実行
- 定期的にステートをControl Planeに送信
- ステートレスなシングルバイナリなので、起動・管理が容易

### FAQ: PipeCDにはなぜControl PlaneとAgentとがあるのか?

**A. 組織内でスケーラブルかつセキュアに利用できるようにするため**

- もしAgentが全てを担っていたらどうなるか?

-> 各チームがステート用のストレージを管理する必要がありますが、それは難しく、またスケーラビリティを損ねます。

- もしControl Planeが全てを担っていたらどうなるか?

-> Control Planeが各チームの環境に強い権限でアクセスする必要がありますが、それはセキュアではないです。

![scalability in a organization](/images/overview/architecture-organization.svg)
<p align="center">組織内でのスケーラビリティ</p>

## 関連情報

- [Docs > Overview](https://pipecd.dev/docs/overview/)
- [Docs > Concepts](https://pipecd.dev/docs/concepts/)

---

[次: 前提条件 >](../20-prerequisites/README.md)

[< 戻る: 日本語版トップ](../README.md)
35 changes: 35 additions & 0 deletions content/ja/20-prerequisites/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 前提条件

このチュートリアルを実施するにあたって、事前に下記が必要となります。

- [docker-compose](https://docs.docker.com/compose/install/): `docker-compose up`を実行できること
- `git`: `git clone`と`git push`をあなたのGitHubリポジトリに対して実行できること
- 下記の中から1つ。どこにデプロイするかによって選んでください。
- **Kubernetes**向け:
- Kubernetesのクラスターを持っていること。
- そのクラスターに対して、kubectlで接続できること。
- **Google Cloud Run**向け:
- ローカルからあなたのGoogle Cloudプロジェクトに対して、Cloud Runの各種APIを実行できること。
- **Amazon ECS**向け:
- ローカルからあなたのAWSアカウントに対して、ECSとELBの各種APIを実行できること。詳細は[こちら](https://pipecd.dev/docs/installation/install-piped/required-permissions/#for-ecsapp)。
- 下記のすべて。(一般的なECSサービスを作成する際に必要なものと同じです)
- ECSのクラスター
- ELB(ECSサービスはこのELBからトラフィックを受け取ります)
- 2つのターゲットグループ(ELBはこれらを用いてECSサービスにトラフィックを流します)
- うち一つのターゲットグループは、ELBのリスナールールに紐づけておくこと
- 2つのサブネット(ECSサービスが配置されます)
- `HTTP:80`でローカルからのインバウンド通信を許可するセキュリティグループ
- [`AmazonECSTaskExecutionRolePolicy`](https://docs.aws.amazon.com/ja_jp/aws-managed-policy/latest/reference/AmazonECSTaskExecutionRolePolicy.html)をもつタスク実行ロール。詳細は[こちら](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html)。
- **AWS Lambda**向け:
- ローカルからあなたのAWSアカウントに対して、Lambdaの各種APIを実行できること。詳細は[こちら](https://pipecd.dev/docs/installation/install-piped/required-permissions/#for-lambdaapp)。
- 下記のすべて。(一般的なLambda関数を作る際に必要なものと同じです)
- ECRリポジトリにイメージがあること
- 関数の実行ロール
- **Terraform**向け:
- [`terraform` commands](https://developer.hashicorp.com/terraform/cli/commands)をローカルから実行できること。

---

[次: インストール >](../30-install/README.md)

[< 戻る: 仕組み概観](../10-overview/README.md)
30 changes: 30 additions & 0 deletions content/ja/30-install/01-git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 1. Gitリポジトリのセットアップ

このページでは、PipeCDのインストールの前に、このチュートリアル用のリポジトリをローカルとGitHubにコピーしていきます。
このリポジトリには、インストールとデプロイのための設定が含まれています。

> [!NOTE]
> ここでは`Fork`を使わないでください。あなたの設定ファイルをパブリックに公開しないようにするためです。

![setup-git-repository](/images/install/setup-git-repo.svg)
<p align="center">Gitリポジトリのセットアップの流れ</p>


1. あなたのGitHubアカウントに、空の**プライベート**リポジトリを新規作成します。リポジトリ名は任意です。
2. このリポジトリをローカルにcloneします。
```console
git clone https://github.com/pipe-cd/tutorial.git
```

3. cloneしたリポジトリを、1.で作成したリポジトリにpushします。
```console
git remote add private <YOUR_PRIVATE_REPOSITORY_URL>
git push -u private main
```


---

[次: 2. Control Planeの構築 >](02-control-plane.md)

[< 戻る: インストール トップ](README.md)
56 changes: 56 additions & 0 deletions content/ja/30-install/02-control-plane.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 2. Control Planeの構築

このページでは、`docker-compose`を用いて、Control Planeをローカルに構築していきます。

## インストール

1. 下記のコマンドを、ローカルの`src/install/control-plane/docker-compose.yaml`に対して実行します。
```sh
docker-compose up
```

コマンド実行後、下記のようなログが表示されます。
```log
pipecd-server-1 | successfully loaded control-plane configuration
pipecd-server-1 | successfully connected to file store
pipecd-server-1 | successfully connected to data store
pipecd-server-1 | grpc server will be run without tls
pipecd-server-1 | grpc server will be run without tls
pipecd-server-1 | grpc server is running on [::]:9080
pipecd-server-1 | grpc server is running on [::]:9083
pipecd-server-1 | grpc server will be run without tls
pipecd-server-1 | admin server is running on 9085
pipecd-server-1 | grpc server is running on [::]:9081
pipecd-server-1 | start running http server on :9082
```

## Confirmation

1. [http://localhost:8080](http://localhost:8080) でコンソールにアクセスします。
2. 下記の値を入力して、`CONTINUE`をクリックします。
- `Project Name`: `tutorial`

![signin-project](/images/install/signin-project.png)

3. 下記の値を入力して、`LOGIN`をクリックします。
- `Username`: `hello-pipecd`
- `Password`: `hello-pipecd`

![signin-user](/images/install/signin-user.png)

4. 成功した場合、下記の画面が表示されます。

![applications-page](/images/install/applications.png)


## 関連情報

- [Architecture Overview](https://pipecd.dev/docs/user-guide/managing-controlplane/architecture-overview/)
- [Managing Control Plane](https://pipecd.dev/docs/user-guide/managing-controlplane/)
- [Installing Control Plane on Kubernetes](https://pipecd.dev/docs/installation/install-control-plane/installing-controlplane-on-k8s/)

---

[次: 3. Pipedのインストール >](03-piped.md)

[< 戻る: 1. Gitリポジトリのセットアップ](01-git.md)
100 changes: 100 additions & 0 deletions content/ja/30-install/03-piped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 3. Pipedの構築

このページでは、シングルバイナリのPipedエージェントをローカルで実行していきます。

## インストール

1. PipedのIDをコンソールで払い出します。

1-1. Piped設定画面にアクセスします。[http://localhost:8080/settings/piped](http://localhost:8080/settings/piped)

1-2. `+ ADD`をクリックします。
![ADD Piped](/images/install/piped-add-button.png)

1-3. 任意の`Name`と`Description`を入力し、`SAVE`をクリックします。
![Input piped](/images/install/piped-add-input.png)

1-4. PipedのIDとKeyが表示されます。 **これらは以降のステップで使用します。**
![Piped is registered](/images/install/piped-registered.png)

2. [1. Gitリポジトリのセットアップ](01-git.md)でcloneしたディレクトリに移動します。
```console
cd <YOUR_CLONED_TUTORIAL_DIR>
cd src/install/piped/
```

3. 下記の`<YOUR_PIPED_KEY>`を`1-4.`で取得した`Piped Key`の値に置き換え、そのKeyのファイルを作成します。[^1]

```console
echo -n <YOUR_PIPED_KEY> > .pipedKey
```

4. ローカルの`src/install/piped/piped.yaml`を以下のように編集します。
- `spec.pipedID`: `1-4.`で取得した`Piped Id`
- `spec.pipedKeyFile`: `<YOUR_CLONED_TUTORIAL_DIR>/src/install/piped/.pipedKey`
- `spec.repositories[0].remote`: [1. Gitリポジトリのセットアップ](01-git.md)で作成したGitHub上のプライベートリポジトリのURL
- `spec.platformProviders`: デプロイ先となる環境の項目をコメントアウト解除します。

5. [pipecd/releases](https://github.com/pipe-cd/pipecd/releases/latest)からPipedの公式バイナリを取得します。OSとCPUは適宜選択してください。

```console
# OS=darwin or linux
# CPU=arm64 or amd64
curl -Lo ./piped https://github.com/pipe-cd/pipecd/releases/download/v0.48.0/piped_v0.48.0_${OS}_${CPU}
```

6. Pipedの実行権限を付与します。

```console
chmod +x ./piped
```

7. Pipedを実行します。[^2]

```console
./piped piped --config-file=./piped.yaml --insecure
```

<details>
<summary>トラブルシューティング (クリックして拡げる)</summary>

- `failed to create api client {"error": "context deadline exceeded"}`
- PipedがControl Planeへの接続に失敗したことを意味します。
- `piped.yaml`内の`apiAddress`が正しいか確認してください。
- Control Planeが`apiAddress`で指定したポートで稼働しているか確認してください。

- `rpc error: code = Unauthenticated desc = Unauthenticated`
- PipedがControl Planeへの接続に成功したものの、認証に失敗したことを意味します。
- `piped.yaml`内の`projectID`, `pipedID`, `pipedKeyFile`が正しいか確認してください。
- `pipedKeyFile`で指定したファイル内の値が正しいか確認してください。

- `failed to clone from remote`
- PipedがControl Planeへの接続・認証に成功したものの、GitHubからのcloneに失敗したことを意味します。
- `piped.yaml`内の`spec.git.repositories`> `remote`, `branch`が正しいか確認してください。

</details>


## 確認

1. Piped設定画面にアクセスします。 [http://localhost:8080/settings/piped](http://localhost:8080/settings/piped)

Pipedの起動に成功していた場合、緑(`Online`)のマークが`Name`欄に表示されます。
緑になっていない場合、1,2分ほど待機してください。
![Piped Status](/images/install/piped-status.png)

## 関連情報

- [Install Piped](https://pipecd.dev/docs/installation/install-piped/)
- [Managing Piped](https://pipecd.dev/docs/user-guide/managing-piped/)
- [Configuration Reference of Piped](https://pipecd.dev/docs/user-guide/managing-piped/configuration-reference/)

[^1]: PipedのKeyはクレデンシャルのため、公開しないでください。実運用では、Keyと `piped.yaml`はシークレット管理ツールで管理することが推奨されます。

[^2]: `--insecure`オプションによって、PipedからControl Planeへの通信のTLSを無効化しています。 (cf. [Piped's Runtime Options](https://pipecd.dev/docs/user-guide/managing-piped/runtime-options/))

---

[次: デプロイ >](../40-deploy/README.md)

[< 戻る: 2. Control Planeの構築](02-control-plane.md)
12 changes: 12 additions & 0 deletions content/ja/30-install/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# インストール

このセクションでは、Control PlaneとPipedをローカルに構築していきます。

![Installation flow](/images/install/installation-flow.svg)
<p align="center">インストールの流れ</p>

---

[次: 1. Gitリポジトリのセットアップ >](01-git.md)

[< 戻る: 前提条件](../20-prerequisites/README.md)
94 changes: 94 additions & 0 deletions content/ja/40-deploy/01-simply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# 1. シンプルなデプロイ

このページでは、シンプルな方法で、アプリケーションをデプロイしていきます。

## 1. 設定ファイルの準備

1-1. 設定ファイルを以下のように編集します。cloneしたリポジトリの`/src/deploy/`配下の1つのプラットフォームを使用してください。

> [!NOTE]
> 各プラットフォームのディレクトリは、デプロイの設定ファイル1枚(`app.pipecd.yaml`)と、プラットフォーム固有のファイルとで構成されています。

- **Kubernetes**向け:
- [helloworld](https://github.com/pipe-cd/pipecd/pkgs/container/helloworld)サービスをデプロイしていきます。
- `kubernetes/simple/`を使用してください。編集は不要です。
- **Google Cloud Run**向け:
- [helloworld](https://github.com/pipe-cd/pipecd/pkgs/container/helloworld)サービスをデプロイしていきます。
- `cloudrun/simple/`を使用してください。編集は不要です。
- **Amazon ECS**向け:
- nginxのサービスをデプロイしていきます。
- `ecs/simple/`の以下の箇所を編集してください。
- `app.pipecd.yaml`: `targetGroupArn`
- `servicedef.yaml`: `cluster`, `securityGroups`, `subnets`
- `taskdef.yaml`: `executionRoleArn`.
- **AWS Lambda**向け:
- あなたのイメージを利用して関数をデプロイしていきます。
- `lambda/simple/`の以下の箇所を編集してください。
- `function.yaml`: `role`, `image`
- **Terraform**向け:
- ファイルをローカルに生成していきます。
- `terraform/simple/`の以下の箇所を編集してください。
- `main.tf`: `path`, `filename`

1-2. 変更をcommitして、リモートにpushしてください。(Kubernetes, CloudRunは編集不要なので、commit, pushは不要です。)


## 2. アプリケーションの登録

2-1. アプリケーション一覧ページにアクセスします。 [http://localhost:8080](http://localhost:8080)

2-2. `+ ADD`をクリックします。

2-3. 下記の値を入力し、`SAVE`->`SAVE`をクリックします
- `Piped`: 構築したPiped
- `Platform Provider`: プラットフォーム
- `Application`: [1.](#1-prepare-config-files)で設定したアプリケーション

![add-application-input](/images/deploy/application-add-input.png)

2-4. 登録に成功した場合、下記画像のようなダイアログが表示されます。

![application-is-added](/images/deploy/application-is-added.png)


## 3. 最初のデプロイメントを眺める

3-1. デプロイメント一覧ページにアクセスします。 [http://localhost:8080/deployments](http://localhost:8080/deployments)

3-2. 新しいデプロイメントが自動で表示されるまで待ちます。表示されたら、クリックして詳細を見ます。

> [!NOTE]
> 自身でデプロイメントをキックする必要はありません。Pipedが自動的に開始してくれるからです。**これがGitOpsです。**

![deployment-before-appear](/images/deploy/deployment-before-appear.png)
![deployment-appear](/images/deploy/deployment-appear.png)


3-3. ステータスが`SUCCESS`または`FAILURE`になるまで待ちます。`FAILURE`が表示された場合、そのページでログを確認してください。

![deployment-deploying](/images/deploy/deployment-deploying.png)


3-4. ステータスが`SUCCESS`になったら、デプロイメントは正常に完了です。

![deployment-success](/images/deploy/deployment-success.png)

3-5. 自身のデプロイ先の環境(Kubernetesクラスターやクラウドのコンソール等)を確認し、デプロイ結果を確認します。



## 4. 設定を変更して、新しいデプロイメントを開始

4-1. デプロイした設定ファイルを編集します。(例: imageのtagやサイジングを変更)

4-2. 変更をcommitしてリモートにpushします。

4-3. デプロイメント一覧ページに再度アクセスします。[http://localhost:8080/deployments](http://localhost:8080/deployments)

4-4. しばらくすると、新しいデプロイメントが自動で開始されます。

---

[次: カスタムのパイプラインでデプロイ>](02-pipeline.md)

[< 戻る: Deploy](README.md)
Loading