|
| 1 | +# Deploy Coder on Rancher |
| 2 | + |
| 3 | +You can deploy Coder on Rancher as a |
| 4 | +[Workload](https://ranchermanager.docs.rancher.com/getting-started/quick-start-guides/deploy-workloads/workload-ingress). |
| 5 | + |
| 6 | +## Requirements |
| 7 | + |
| 8 | +- [SUSE Rancher Manager](https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster) running Kubernetes (K8s) 1.19+ with [SUSE Rancher Prime distribution](https://documentation.suse.com/cloudnative/rancher-manager/latest/en/integrations/kubernetes-distributions.html) (Rancher Manager 2.10+) |
| 9 | +- Helm 3.5+ installed |
| 10 | +- Workload Kubernetes cluster for Coder |
| 11 | + |
| 12 | +## Overview |
| 13 | + |
| 14 | +Installing Coder on Rancher involves four key steps: |
| 15 | + |
| 16 | +1. Create a namespace for Coder |
| 17 | +1. Set up PostgreSQL |
| 18 | +1. Create a database connection secret |
| 19 | +1. Install the Coder application via Rancher UI |
| 20 | + |
| 21 | +## Create a namespace |
| 22 | + |
| 23 | +Create a namespace for the Coder control plane. In this tutorial, we call it `coder`: |
| 24 | + |
| 25 | +```shell |
| 26 | +kubectl create namespace coder |
| 27 | +``` |
| 28 | + |
| 29 | +## Set up PostgreSQL |
| 30 | + |
| 31 | +Coder requires a PostgreSQL database to store deployment data. |
| 32 | +We recommend that you use a managed PostgreSQL service, but you can use an in-cluster PostgreSQL service for non-production deployments: |
| 33 | + |
| 34 | +<div class="tabs"> |
| 35 | + |
| 36 | +### Managed PostgreSQL (Recommended) |
| 37 | + |
| 38 | +For production deployments, we recommend using a managed PostgreSQL service: |
| 39 | + |
| 40 | +- [Google Cloud SQL](https://cloud.google.com/sql/docs/postgres/) |
| 41 | +- [AWS RDS for PostgreSQL](https://aws.amazon.com/rds/postgresql/) |
| 42 | +- [Azure Database for PostgreSQL](https://docs.microsoft.com/en-us/azure/postgresql/) |
| 43 | +- [DigitalOcean Managed PostgreSQL](https://www.digitalocean.com/products/managed-databases-postgresql) |
| 44 | + |
| 45 | +Ensure that your PostgreSQL service: |
| 46 | + |
| 47 | +- Is running and accessible from your cluster |
| 48 | +- Is in the same network/project as your cluster |
| 49 | +- Has proper credentials and a database created for Coder |
| 50 | + |
| 51 | +### In-Cluster PostgreSQL (Development/PoC) |
| 52 | + |
| 53 | +For proof-of-concept deployments, you can use Bitnami Helm chart to install PostgreSQL in your Kubernetes cluster: |
| 54 | + |
| 55 | +```console |
| 56 | +helm repo add bitnami https://charts.bitnami.com/bitnami |
| 57 | +helm install coder-db bitnami/postgresql \ |
| 58 | + --namespace coder \ |
| 59 | + --set auth.username=coder \ |
| 60 | + --set auth.password=coder \ |
| 61 | + --set auth.database=coder \ |
| 62 | + --set persistence.size=10Gi |
| 63 | +``` |
| 64 | + |
| 65 | +After installation, the cluster-internal database URL will be: |
| 66 | + |
| 67 | +```text |
| 68 | +postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable |
| 69 | +``` |
| 70 | + |
| 71 | +For more advanced PostgreSQL management, consider using the |
| 72 | +[Postgres operator](https://github.com/zalando/postgres-operator). |
| 73 | + |
| 74 | +</div> |
| 75 | + |
| 76 | +## Create the database connection secret |
| 77 | + |
| 78 | +Create a Kubernetes secret with your PostgreSQL connection URL: |
| 79 | + |
| 80 | +```shell |
| 81 | +kubectl create secret generic coder-db-url -n coder \ |
| 82 | + --from-literal=url="postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable" |
| 83 | +``` |
| 84 | + |
| 85 | +> [!Important] |
| 86 | +> If you're using a managed PostgreSQL service, replace the connection URL with your specific database credentials. |
| 87 | +
|
| 88 | +## Install Coder through the Rancher UI |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +1. In the Rancher Manager console, select your target Kubernetes cluster for Coder. |
| 93 | + |
| 94 | +1. Navigate to **Apps** > **Charts** |
| 95 | + |
| 96 | +1. From the dropdown menu, select **Partners** and search for `Coder` |
| 97 | + |
| 98 | +1. Select **Coder**, then **Install** |
| 99 | + |
| 100 | +1. Select the `coder` namespace you created earlier and check **Customize Helm options before install**. |
| 101 | + |
| 102 | + Select **Next** |
| 103 | + |
| 104 | +1. On the configuration screen, select **Edit YAML** and enter your Coder configuration settings: |
| 105 | + |
| 106 | + <details> |
| 107 | + <summary>Example values.yaml configuration</summary> |
| 108 | + |
| 109 | + ```yaml |
| 110 | + coder: |
| 111 | + # Environment variables for Coder |
| 112 | + env: |
| 113 | + - name: CODER_PG_CONNECTION_URL |
| 114 | + valueFrom: |
| 115 | + secretKeyRef: |
| 116 | + name: coder-db-url |
| 117 | + key: url |
| 118 | + |
| 119 | + # For production, uncomment and set your access URL |
| 120 | + # - name: CODER_ACCESS_URL |
| 121 | + # value: "https://coder.example.com" |
| 122 | + |
| 123 | + # For TLS configuration (uncomment if needed) |
| 124 | + #tls: |
| 125 | + # secretNames: |
| 126 | + # - my-tls-secret-name |
| 127 | + ``` |
| 128 | + |
| 129 | + For available configuration options, refer to the [Helm chart documentation](https://github.com/coder/coder/blob/main/helm#readme) |
| 130 | + or [values.yaml file](https://github.com/coder/coder/blob/main/helm/coder/values.yaml). |
| 131 | + |
| 132 | + </details> |
| 133 | + |
| 134 | +1. Select a Coder version: |
| 135 | + |
| 136 | + - **Mainline**: `2.20.x` |
| 137 | + - **Stable**: `2.19.x` |
| 138 | + |
| 139 | + Learn more about release channels in the [Releases documentation](./releases.md). |
| 140 | + |
| 141 | +1. Select **Next** when your configuration is complete. |
| 142 | + |
| 143 | +1. On the **Supply additional deployment options** screen: |
| 144 | + |
| 145 | + 1. Accept the default settings |
| 146 | + 1. Select **Install** |
| 147 | + |
| 148 | +1. A Helm install output shell will be displayed and indicates the installation status. |
| 149 | + |
| 150 | +## Manage your Rancher Coder deployment |
| 151 | + |
| 152 | +To update or manage your Coder deployment later: |
| 153 | + |
| 154 | +1. Navigate to **Apps** > **Installed Apps** in the Rancher UI. |
| 155 | +1. Find and select Coder. |
| 156 | +1. Use the options in the **⋮** menu for upgrade, rollback, or other operations. |
| 157 | + |
| 158 | +## Next steps |
| 159 | + |
| 160 | +- [Create your first template](../tutorials/template-from-scratch.md) |
| 161 | +- [Control plane configuration](../admin/setup/index.md) |
0 commit comments