Skip to content

Commit 5d35432

Browse files
authored
docs(deployment): how to guides (#92)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 54aaa51 commit 5d35432

File tree

1 file changed

+164
-10
lines changed

1 file changed

+164
-10
lines changed

deployment/chainloop/README.md

Lines changed: 164 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ This chart bootstraps a [Chainloop](https://github.com/chainloop-dev/chainloop)
1010

1111
- Kubernetes 1.19+
1212
- Helm 3.2.0+
13-
- PV provisioner support in the underlying infrastructure
14-
- ReadWriteMany volumes for deployment scaling
13+
- PV provisioner support in the underlying infrastructure (If built-in PostgreSQL is enabled)
1514

1615
## TL;DR
1716

@@ -25,6 +24,8 @@ helm install [RELEASE_NAME] oci://ghcr.io/chainloop-dev/charts/chainloop \
2524
--set controlplane.auth.oidc.clientSecret=[clientSecret]
2625
```
2726

27+
> **CAUTION**: Do not use this mode in production, for that, use the [standard mode](#standard-default) instead.
28+
2829
## Installing the Chart
2930

3031
This chart comes in **two flavors**, `standard` and [`development`](#development).
@@ -47,17 +48,12 @@ During installation, you'll need to provide
4748
- Connection settings for a secrets storage backend, either [Hashicorp Vault](https://www.vaultproject.io/) or [AWS Secret Manager](https://aws.amazon.com/secrets-manager)
4849
- ECDSA (ES512) key-pair used for Controlplane <-> CAS Authentication
4950

50-
You can generate the ECDSA key-pair by running
51-
52-
```console
53-
# Private Key (private.ec.key)
54-
openssl ecparam -name secp521r1 -genkey -noout -out private.ec.key
55-
# Public Key (public.pem)
56-
openssl ec -in private.ec.key -pubout -out public.pem
57-
```
51+
Instructions on how to create the ECDSA keypair can be found [here](#generate-a-ecdsa-key-pair).
5852

5953
#### Installation Examples
6054

55+
> **NOTE**: **We do not recommend passing nor storing sensitive data in plain text**. For production, please consider having your overrides encrypted with tools such as [Sops](https://github.com/mozilla/sops), [Helm Secrets](https://github.com/jkroepke/helm-secrets) or [Sealed Secrets](https://github.com/bitnami-labs/sealed-secrets).
56+
6157
Deploy Chainloop configured to talk to the bundled PostgreSQL an external OIDC IDp and a Vault instance.
6258

6359
```console
@@ -121,6 +117,8 @@ The Helm Chart in this mode includes
121117
- A PostgreSQL dependency enabled by default
122118
- **A pre-configured Hashicorp Vault instance running in development mode (unsealed, in-memory, insecure)**
123119

120+
> **CAUTION**: Do not use this mode in production, for that, use the [standard mode](#standard-default) instead.
121+
124122
During installation, you'll need to provide
125123

126124
- Open ID Connect Identity Provider (IDp) settings i.e [Auth0 settings](https://auth0.com/docs/get-started/applications/application-settings#basic-information)
@@ -138,7 +136,163 @@ helm install [RELEASE_NAME] oci://ghcr.io/chainloop-dev/charts/chainloop \
138136
--set controlplane.auth.oidc.clientID=[clientID] \
139137
--set controlplane.auth.oidc.clientSecret=[clientSecret]
140138
```
139+
## How to guides
140+
141+
### Generate a ECDSA key-pair
142+
143+
An ECDSA key-pair is required to perform authentication between the control-plane and the Artifact CAS
144+
145+
You can generate both the private and public keys by running
146+
147+
```bash
148+
# Private Key (private.ec.key)
149+
openssl ecparam -name secp521r1 -genkey -noout -out private.ec.key
150+
# Public Key (public.pem)
151+
openssl ec -in private.ec.key -pubout -out public.pem
152+
```
153+
154+
Then, you can either provide it in a custom `values.yaml` file override
155+
156+
```yaml
157+
casJWTPrivateKey: |-
158+
-----BEGIN EC PRIVATE KEY-----
159+
REDACTED
160+
-----END EC PRIVATE KEY-----
161+
casJWTPublicKey: |
162+
-----BEGIN PUBLIC KEY-----
163+
REDACTED
164+
-----END PUBLIC KEY-----
165+
```
166+
167+
or as shown before, provide them as imperative inputs during Helm Install/Upgrade `--set casJWTPrivateKey="$(cat private.ec.key)"--set casJWTPublicKey="$(cat public.pem)"`
168+
169+
### Enable a custom domain with TLS
170+
171+
Chainloop uses three endpoints so we'll need to enable the ingress resource for each one of them.
172+
173+
See below an example of a `values.yaml` override
174+
175+
```yaml
176+
controlplane:
177+
ingress:
178+
enabled: true
179+
hostname: cp.chainloop.dev
180+
181+
ingressAPI:
182+
enabled: true
183+
hostname: api.cp.chainloop.dev
184+
185+
cas:
186+
ingressAPI:
187+
enabled: true
188+
hostname: api.cas.chainloop.dev
189+
```
190+
191+
A complete setup that uses
192+
193+
- NGINX as ingress Controller https://kubernetes.github.io/ingress-nginx/
194+
- [cert-manager](https://cert-manager.io/) as TLS provider
195+
196+
would look like
197+
198+
```yaml
199+
controlplane:
200+
ingress:
201+
enabled: true
202+
tls: true
203+
ingressClassName: nginx
204+
hostname: cp.chainloop.dev
205+
annotations:
206+
# This depends on your configured issuer
207+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
208+
209+
ingressAPI:
210+
enabled: true
211+
tls: true
212+
ingressClassName: nginx
213+
hostname: api.cp.chainloop.dev
214+
annotations:
215+
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
216+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
217+
218+
cas:
219+
ingressAPI:
220+
enabled: true
221+
tls: true
222+
ingressClassName: nginx
223+
hostname: api.cas.chainloop.dev
224+
annotations:
225+
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
226+
cert-manager.io/cluster-issuer: "letsencrypt-prod"
227+
# limit the size of the files that go through the proxy
228+
# 0 means to not check the size of the request so we do not get 413 error.
229+
# For now we are going to set a limit on 100MB files
230+
# Even though we send data in chunks of 1MB, this size refers to all the data sent in the streaming connection
231+
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
232+
```
233+
234+
### Connect to an external PostgreSQL database
235+
236+
```yaml
237+
# Disable built-in DB
238+
postgresql:
239+
enabled: false
240+
241+
# Provide with external connection
242+
controlplane:
243+
externalDatabase:
244+
host: 1.2.3.4
245+
port: 5432
246+
user: chainloop
247+
password: [REDACTED]
248+
database: chainloop-controlplane-prod
249+
```
250+
251+
Alternatively, if you are using [Google Cloud SQL](https://cloud.google.com/sql) and you are running Chainloop in Google Kubernetes Engine. You can connect instead via [a proxy](https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine#proxy)
252+
253+
This method can also be easily enabled in this chart by doing
254+
255+
```yaml
256+
# Disable built-in DB
257+
postgresql:
258+
enabled: false
259+
260+
# Provide with external connection
261+
controlplane:
262+
sqlProxy:
263+
# Inject the proxy sidecar
264+
enabled: true
265+
## @param controlplane.sqlProxy.connectionName Google Cloud SQL connection name
266+
connectionName: "my-sql-instance"
267+
# Then you'll need to configure your DB settings to use the proxy IP address
268+
externalDatabase:
269+
host: [proxy-sidecar-ip-address]
270+
port: 5432
271+
user: chainloop
272+
password: [REDACTED]
273+
database: chainloop-controlplane-prod
274+
```
141275

276+
### Use AWS secret manager
277+
278+
You can swap the secret manager backend with the following settings
279+
280+
```yaml
281+
secretsBackend:
282+
backend: awsSecretManager
283+
awsSecretManager:
284+
accessKey: [KEY]
285+
secretKey: [SECRET]
286+
region: [REGION]
287+
```
288+
### Send exceptions to Sentry
289+
290+
```yaml
291+
sentry:
292+
enabled: true
293+
dsn: [your secret sentry project DSN URL]
294+
environment: production
295+
```
142296
## Parameters
143297

144298
### Common parameters

0 commit comments

Comments
 (0)