> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ale.run/llms.txt
> Use this file to discover all available pages before exploring further.

# aleのインストール

> GKEクラスタにaleをインストールし、初期設定を行うためのガイドです。

***

## エールのインストール

> 以下のkubectlコマンドでaleをインストールします。

```bash theme={null}
kubectl apply -f https://raw.githubusercontent.com/ale-run/ale/refs/heads/main/k8s/dist/latest/ale.yaml
```

<Info>
  デプロイ完了は以下のコマンドで確認し、STATUSが全てRunningならインストール完了です。

  ```bash theme={null}
  kubectl get pod -n ale
  ```

  ```bash theme={null}
  NAME                             READY   STATUS    RESTARTS   AGE
  ale-agent-77dbd775c8-rtqzc       1/1     Running   0          165m
  ale-controller-bf5c46899-8lrgt   1/1     Running   0          57m
  mongodb-0                        1/1     Running   0          165m
  ```
</Info>

<Note>
  クラスター状況によってはインストールに時間がかかる場合があります。長時間経ってもSTATUSがRunningにならない、またはPodが失敗する場合、`kubectl describe pod <pod名> -n ale`で原因を確認してください。
</Note>

## データベース設定 (任意)

> エールはデフォルトで、クラスター内にStatefulSetとしてデプロイされた`mongodb`を使用します。他のデータベースを使用したい場合は、以下のコマンドを実行してください。

* MongoDB Atlasの場合:

  ```bash theme={null}
  export DB_USERNAME=[DB ユーザー名]
  export DB_PASSWORD=$(echo '[DB パスワード]' | jq -Rr @uri)
  export DB_NAME=[DB 名]

  kubectl patch secret ale-secrets -n ale \
    -p '{"data": {"DB_URL": "'$(echo -n "mongodb+srv://${DB_USERNAME}:${DB_PASSWORD}@cluster0.nbyq0.mongodb.net/${DB_NAME}?retryWrites=true&w=majority&appName=Cluster0" | base64)'"}}'
  kubectl rollout restart deployment ale-controller -n ale
  ```
