@bluedynamics/cdk8s-plone 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +47 -28
- package/API.md +28 -3
- package/lib/config/plone-vinyl-backend-response.vcl +25 -0
- package/lib/config/plone-vinyl-recv-routing-volto.vcl +21 -0
- package/lib/config/plone-vinyl-recv.vcl +18 -0
- package/{examples/volto → lib}/config/varnish.tpl.vcl +1 -1
- package/lib/httpcache.js +1 -1
- package/lib/imports/vinyl.bluedynamics.eu.d.ts +398 -66
- package/lib/imports/vinyl.bluedynamics.eu.js +169 -17
- package/lib/plone.js +1 -1
- package/lib/vinylcache.d.ts +21 -0
- package/lib/vinylcache.js +21 -2
- package/package.json +3 -2
- package/.claude/claude.md +0 -39
- package/.claude/settings.local.json +0 -31
- package/CLAUDE.md +0 -352
- package/docs/superpowers/plans/2026-06-12-configurable-service-spec.md +0 -608
- package/docs/superpowers/specs/2026-06-12-configurable-service-spec-design.md +0 -192
- package/documentation/Makefile +0 -357
- package/documentation/README.md +0 -284
- package/documentation/mx.ini +0 -3
- package/documentation/sources/_static/logo.svg +0 -79
- package/documentation/sources/conf.py +0 -145
- package/documentation/sources/explanation/architecture.md +0 -336
- package/documentation/sources/explanation/cdk8s-workflow.md +0 -66
- package/documentation/sources/explanation/features.md +0 -374
- package/documentation/sources/explanation/index.md +0 -34
- package/documentation/sources/how-to/backup-and-restore.md +0 -107
- package/documentation/sources/how-to/configure-env-and-secrets.md +0 -184
- package/documentation/sources/how-to/configure-ingress-tls.md +0 -108
- package/documentation/sources/how-to/configure-security-context.md +0 -143
- package/documentation/sources/how-to/deploy-blicca.md +0 -334
- package/documentation/sources/how-to/deploy-volto.md +0 -324
- package/documentation/sources/how-to/deploy-with-httpcache.md +0 -224
- package/documentation/sources/how-to/deploy-with-vinyl-cache.md +0 -273
- package/documentation/sources/how-to/enable-prometheus-monitoring.md +0 -122
- package/documentation/sources/how-to/index.md +0 -85
- package/documentation/sources/how-to/scale-and-high-availability.md +0 -122
- package/documentation/sources/how-to/schedule-pods.md +0 -145
- package/documentation/sources/how-to/setup-prerequisites.md +0 -363
- package/documentation/sources/how-to/troubleshooting.md +0 -113
- package/documentation/sources/how-to/upgrade-and-rollout.md +0 -140
- package/documentation/sources/index.md +0 -109
- package/documentation/sources/reference/api/index.md +0 -40
- package/documentation/sources/reference/configuration-options.md +0 -352
- package/documentation/sources/reference/index.md +0 -41
- package/documentation/sources/tutorials/01-quick-start.md +0 -165
- package/documentation/sources/tutorials/index.md +0 -53
- package/examples/blicca/.env.example +0 -20
- package/examples/blicca/README.md +0 -339
- package/examples/blicca/__snapshots__/main.test.ts.snap +0 -1035
- package/examples/blicca/cdk8s.yaml +0 -6
- package/examples/blicca/config/varnish.tpl.vcl +0 -217
- package/examples/blicca/ingress.ts +0 -217
- package/examples/blicca/jest.config.js +0 -11
- package/examples/blicca/main.test.ts +0 -18
- package/examples/blicca/main.ts +0 -101
- package/examples/blicca/package.json +0 -36
- package/examples/blicca/postgres.cloudnativepg.ts +0 -63
- package/examples/blicca/postgres.plain.ts +0 -115
- package/examples/blicca/tsconfig.json +0 -33
- package/examples/volto/.env.example +0 -21
- package/examples/volto/README.md +0 -292
- package/examples/volto/__snapshots__/main.test.ts.snap +0 -1206
- package/examples/volto/cdk8s.yaml +0 -6
- package/examples/volto/ingress.ts +0 -229
- package/examples/volto/jest.config.js +0 -11
- package/examples/volto/main.test.ts +0 -18
- package/examples/volto/main.ts +0 -105
- package/examples/volto/package.json +0 -36
- package/examples/volto/postgres.cloudnativepg.ts +0 -63
- package/examples/volto/postgres.plain.ts +0 -115
- package/examples/volto/tsconfig.json +0 -33
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Deploy the production-ready Volto example: React frontend, Plone REST API backend, PostgreSQL, Varnish caching, and ingress with TLS."
|
|
5
|
-
"property=og:description": "Deploy the production-ready Volto example: React frontend, Plone REST API backend, PostgreSQL, Varnish caching, and ingress with TLS."
|
|
6
|
-
"property=og:title": "Deploy the Volto example"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, Volto, production, PostgreSQL, Varnish, ingress, TLS"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Deploy the Volto example
|
|
11
|
-
|
|
12
|
-
This guide shows you how to deploy the production-ready Volto example to your Kubernetes cluster.
|
|
13
|
-
|
|
14
|
-
## What you'll deploy
|
|
15
|
-
|
|
16
|
-
The [Volto example](https://github.com/bluedynamics/cdk8s-plone/tree/main/examples/volto) includes:
|
|
17
|
-
|
|
18
|
-
- **Plone 6.1 with Volto** (React frontend + REST API backend)
|
|
19
|
-
- **PostgreSQL** with RelStorage (plain PostgreSQL or CloudNativePG)
|
|
20
|
-
- **Varnish HTTP caching** with kube-httpcache
|
|
21
|
-
- **Ingress** with TLS (Traefik or Kong)
|
|
22
|
-
- **Three access domains** (cached, uncached, maintenance)
|
|
23
|
-
|
|
24
|
-
(volto-prerequisites)=
|
|
25
|
-
|
|
26
|
-
## Prerequisites
|
|
27
|
-
|
|
28
|
-
### Required
|
|
29
|
-
|
|
30
|
-
Ensure you have these installed on your cluster:
|
|
31
|
-
|
|
32
|
-
1. **Ingress Controller** - Either:
|
|
33
|
-
- [Traefik v3](https://doc.traefik.io/traefik/getting-started/install-traefik/) with CRDs
|
|
34
|
-
- [Kong Gateway](https://docs.konghq.com/gateway/latest/install/kubernetes/)
|
|
35
|
-
|
|
36
|
-
2. **cert-manager** - For TLS certificates:
|
|
37
|
-
```shell
|
|
38
|
-
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.0/cert-manager.yaml
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
3. **kube-httpcache Operator** - For Varnish caching:
|
|
42
|
-
```shell
|
|
43
|
-
kubectl apply -f https://github.com/mittwald/kube-httpcache/releases/latest/download/kube-httpcache.yaml
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
4. **PostgreSQL** - The example provisions the database itself; choose the backend with the `DATABASE` variable in Step 4. Prepare the cluster for your choice:
|
|
47
|
-
|
|
48
|
-
**Option A: plain** (default; no operator needed) - the example deploys a single-instance PostgreSQL StatefulSet using the official `postgres` image, so there is nothing to install.
|
|
49
|
-
|
|
50
|
-
**Option B: CloudNativePG** (recommended for production HA) - install the operator:
|
|
51
|
-
```shell
|
|
52
|
-
kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.24/releases/cnpg-1.24.0.yaml
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Local tools
|
|
56
|
-
|
|
57
|
-
- **Node.js 18+** and npm
|
|
58
|
-
- **kubectl** configured for your cluster
|
|
59
|
-
- **git** to clone the repository
|
|
60
|
-
|
|
61
|
-
## Step 1: Get the example
|
|
62
|
-
|
|
63
|
-
Clone the repository and navigate to the example:
|
|
64
|
-
|
|
65
|
-
```shell
|
|
66
|
-
git clone https://github.com/bluedynamics/cdk8s-plone.git
|
|
67
|
-
cd cdk8s-plone/examples/volto
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Step 2: Install dependencies
|
|
71
|
-
|
|
72
|
-
```shell
|
|
73
|
-
npm install
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Step 3: Import CRDs
|
|
77
|
-
|
|
78
|
-
Generate TypeScript bindings for Kubernetes CRDs:
|
|
79
|
-
|
|
80
|
-
```shell
|
|
81
|
-
npm run import
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
This imports:
|
|
85
|
-
- Kubernetes core API
|
|
86
|
-
- CloudNativePG Cluster CRDs
|
|
87
|
-
- Traefik Middleware CRDs
|
|
88
|
-
|
|
89
|
-
## Step 4: Configure environment
|
|
90
|
-
|
|
91
|
-
Create a `.env` file from the example:
|
|
92
|
-
|
|
93
|
-
```shell
|
|
94
|
-
cp .env.example .env
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Edit `.env` with your settings:
|
|
98
|
-
|
|
99
|
-
```shell
|
|
100
|
-
# Your domains
|
|
101
|
-
DOMAIN_CACHED=plone.example.com
|
|
102
|
-
DOMAIN_UNCACHED=plone-test.example.com
|
|
103
|
-
DOMAIN_MAINTENANCE=plone-admin.example.com
|
|
104
|
-
|
|
105
|
-
# Your cert-manager ClusterIssuer
|
|
106
|
-
CLUSTER_ISSUER=letsencrypt-prod
|
|
107
|
-
|
|
108
|
-
# Optional: Custom images
|
|
109
|
-
#PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
|
|
110
|
-
#PLONE_FRONTEND_IMAGE=plone/plone-frontend:16.0.0
|
|
111
|
-
|
|
112
|
-
# Database: 'plain' or 'cloudnativepg'
|
|
113
|
-
DATABASE=plain
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
:::{tip}
|
|
117
|
-
For production high availability, use `cloudnativepg`. For development and small setups, `plain` is simpler and needs no operator.
|
|
118
|
-
:::
|
|
119
|
-
|
|
120
|
-
## Step 5: Generate manifests
|
|
121
|
-
|
|
122
|
-
Synthesize Kubernetes YAML:
|
|
123
|
-
|
|
124
|
-
```shell
|
|
125
|
-
npm run synth
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
This creates `dist/plone-example.k8s.yaml` with all resources.
|
|
129
|
-
|
|
130
|
-
## Step 6: Review generated manifests
|
|
131
|
-
|
|
132
|
-
Inspect what will be deployed:
|
|
133
|
-
|
|
134
|
-
```shell
|
|
135
|
-
# Count resources
|
|
136
|
-
grep "^kind:" dist/plone-example.k8s.yaml | sort | uniq -c
|
|
137
|
-
|
|
138
|
-
# View specific resources
|
|
139
|
-
kubectl apply --dry-run=client -f dist/plone-example.k8s.yaml
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Step 7: Deploy to Kubernetes
|
|
143
|
-
|
|
144
|
-
Deploy to your cluster:
|
|
145
|
-
|
|
146
|
-
```shell
|
|
147
|
-
kubectl apply -f dist/plone-example.k8s.yaml
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Or deploy to a specific namespace:
|
|
151
|
-
|
|
152
|
-
```shell
|
|
153
|
-
kubectl apply -f dist/plone-example.k8s.yaml -n plone
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Step 8: Monitor deployment
|
|
157
|
-
|
|
158
|
-
Watch pods starting:
|
|
159
|
-
|
|
160
|
-
```shell
|
|
161
|
-
# Watch all pods
|
|
162
|
-
kubectl get pods -l app.kubernetes.io/part-of=plone -w
|
|
163
|
-
|
|
164
|
-
# Check specific components
|
|
165
|
-
kubectl get pods -l app.kubernetes.io/name=plone-backend
|
|
166
|
-
kubectl get pods -l app.kubernetes.io/name=plone-frontend
|
|
167
|
-
kubectl get pods -l app.kubernetes.io/name=plone-httpcache
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Wait for all pods to be `Running`:
|
|
171
|
-
|
|
172
|
-
```shell
|
|
173
|
-
kubectl wait --for=condition=ready pod -l app.kubernetes.io/part-of=plone --timeout=300s
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Step 9: Verify services
|
|
177
|
-
|
|
178
|
-
Check that services are created:
|
|
179
|
-
|
|
180
|
-
```shell
|
|
181
|
-
kubectl get svc -l app.kubernetes.io/part-of=plone
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
You should see:
|
|
185
|
-
- `plone-backend` (backend service)
|
|
186
|
-
- `plone-frontend` (frontend service)
|
|
187
|
-
- `plone-httpcache` (Varnish cache)
|
|
188
|
-
- Database service (plain PostgreSQL or CloudNativePG)
|
|
189
|
-
|
|
190
|
-
## Step 10: Check ingress
|
|
191
|
-
|
|
192
|
-
Verify ingress routes:
|
|
193
|
-
|
|
194
|
-
```shell
|
|
195
|
-
kubectl get ingress
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Check TLS certificates:
|
|
199
|
-
|
|
200
|
-
```shell
|
|
201
|
-
kubectl get certificate
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Step 11: Access your site
|
|
205
|
-
|
|
206
|
-
Once DNS is configured and TLS certificates are issued:
|
|
207
|
-
|
|
208
|
-
- **Public site (cached)**: https://plone.example.com
|
|
209
|
-
- **Testing (uncached)**: https://plone-test.example.com
|
|
210
|
-
- **Maintenance**: https://plone-admin.example.com
|
|
211
|
-
|
|
212
|
-
### Create Plone site
|
|
213
|
-
|
|
214
|
-
On first access to the maintenance domain:
|
|
215
|
-
|
|
216
|
-
1. Go to: https://plone-admin.example.com
|
|
217
|
-
2. Click "Create a new Plone site"
|
|
218
|
-
3. Fill in:
|
|
219
|
-
- **Site ID**: `Plone`
|
|
220
|
-
- **Title**: Your site title
|
|
221
|
-
- **Language**: Choose language
|
|
222
|
-
4. Click "Create Plone Site"
|
|
223
|
-
|
|
224
|
-
## Troubleshooting
|
|
225
|
-
|
|
226
|
-
### Pods not starting
|
|
227
|
-
|
|
228
|
-
Check pod logs:
|
|
229
|
-
|
|
230
|
-
```shell
|
|
231
|
-
# Backend logs
|
|
232
|
-
kubectl logs -l app.kubernetes.io/name=plone-backend -f
|
|
233
|
-
|
|
234
|
-
# Frontend logs
|
|
235
|
-
kubectl logs -l app.kubernetes.io/name=plone-frontend -f
|
|
236
|
-
|
|
237
|
-
# Database logs (CloudNativePG)
|
|
238
|
-
kubectl logs -l postgresql=plone-postgresql -f
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Database connection issues
|
|
242
|
-
|
|
243
|
-
**CloudNativePG:**
|
|
244
|
-
|
|
245
|
-
```shell
|
|
246
|
-
# Check cluster status
|
|
247
|
-
kubectl get cluster
|
|
248
|
-
|
|
249
|
-
# Check secret
|
|
250
|
-
kubectl get secret -l cnpg.io/cluster
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
**Plain PostgreSQL:**
|
|
254
|
-
|
|
255
|
-
```shell
|
|
256
|
-
# Check the StatefulSet and pod
|
|
257
|
-
kubectl get statefulset -l app.kubernetes.io/name=plone-postgresql
|
|
258
|
-
kubectl get pods -l app.kubernetes.io/name=plone-postgresql
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### TLS certificate issues
|
|
262
|
-
|
|
263
|
-
```shell
|
|
264
|
-
# Check certificate status
|
|
265
|
-
kubectl describe certificate
|
|
266
|
-
|
|
267
|
-
# Check cert-manager logs
|
|
268
|
-
kubectl logs -n cert-manager deployment/cert-manager
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Varnish cache not working
|
|
272
|
-
|
|
273
|
-
```shell
|
|
274
|
-
# Check httpcache logs
|
|
275
|
-
kubectl logs -l app.kubernetes.io/name=plone-httpcache
|
|
276
|
-
|
|
277
|
-
# Check if kube-httpcache operator is running
|
|
278
|
-
kubectl get pods -n kube-httpcache-system
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## Updating your deployment
|
|
282
|
-
|
|
283
|
-
After making changes to the example:
|
|
284
|
-
|
|
285
|
-
1. Edit configuration files
|
|
286
|
-
2. Regenerate manifests: `npm run synth`
|
|
287
|
-
3. Apply changes: `kubectl apply -f dist/plone-example.k8s.yaml`
|
|
288
|
-
|
|
289
|
-
## Scaling
|
|
290
|
-
|
|
291
|
-
Scale replicas by editing `main.ts`:
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
const plone = new Plone(this, 'plone', {
|
|
295
|
-
backend: {
|
|
296
|
-
replicas: 3, // Scale backend
|
|
297
|
-
},
|
|
298
|
-
frontend: {
|
|
299
|
-
replicas: 3, // Scale frontend
|
|
300
|
-
},
|
|
301
|
-
})
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Then regenerate and reapply.
|
|
305
|
-
|
|
306
|
-
## Cleanup
|
|
307
|
-
|
|
308
|
-
Remove all resources:
|
|
309
|
-
|
|
310
|
-
```shell
|
|
311
|
-
kubectl delete -f dist/plone-example.k8s.yaml
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Next steps
|
|
315
|
-
|
|
316
|
-
- Configure monitoring and metrics through {doc}`enable-prometheus-monitoring`.
|
|
317
|
-
- Customize [Varnish caching rules](https://github.com/bluedynamics/cdk8s-plone/blob/main/examples/volto/config/varnish.tpl.vcl).
|
|
318
|
-
- Harden pods with {doc}`configure-security-context`.
|
|
319
|
-
|
|
320
|
-
## See also
|
|
321
|
-
|
|
322
|
-
- {doc}`deploy-blicca` — For the server-side rendered Plone UI.
|
|
323
|
-
- {doc}`setup-prerequisites` — Detailed cluster setup.
|
|
324
|
-
- {doc}`/reference/configuration-options` — API reference.
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Deploy the PloneHttpcache Varnish cache via the mittwald kube-httpcache Helm chart and attach it to a Plone deployment."
|
|
5
|
-
"property=og:description": "Deploy the PloneHttpcache Varnish cache via the mittwald kube-httpcache Helm chart and attach it to a Plone deployment."
|
|
6
|
-
"property=og:title": "Deploy with PloneHttpcache"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, Varnish, kube-httpcache, mittwald, PloneHttpcache, caching, VCL"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Deploy with PloneHttpcache
|
|
11
|
-
|
|
12
|
-
This guide shows you how to deploy the `PloneHttpcache` Varnish cache and attach it to an existing Plone instance.
|
|
13
|
-
|
|
14
|
-
`PloneHttpcache` deploys Varnish through the [mittwald kube-httpcache](https://github.com/mittwald/kube-httpcache) Helm chart.
|
|
15
|
-
The construct renders that chart at synth time, so the cache is part of your own manifests.
|
|
16
|
-
For an operator-managed alternative, see {doc}`/how-to/deploy-with-vinyl-cache`.
|
|
17
|
-
|
|
18
|
-
## Prerequisites
|
|
19
|
-
|
|
20
|
-
- A running Plone deployment created with `cdk8s-plone` (see {doc}`/tutorials/01-quick-start`).
|
|
21
|
-
- The `helm` CLI available wherever you run `cdk8s synth`.
|
|
22
|
-
- A Kubernetes `Secret` holding the Varnish admin credentials, referenced through `existingSecret`.
|
|
23
|
-
- amd64 worker nodes.
|
|
24
|
-
|
|
25
|
-
The construct renders the kube-httpcache Helm chart locally, so you do not pre-install a controller in the cluster.
|
|
26
|
-
The pod `nodeSelector` is hard-coded to `kubernetes.io/arch=amd64` (a kube-httpcache workaround), so `PloneHttpcache` pods only schedule on amd64 nodes.
|
|
27
|
-
There is no `nodeSelector` option on this construct.
|
|
28
|
-
|
|
29
|
-
Create the admin credentials Secret before you deploy:
|
|
30
|
-
|
|
31
|
-
```shell
|
|
32
|
-
kubectl create secret generic varnish-admin \
|
|
33
|
-
--namespace <namespace> \
|
|
34
|
-
--from-literal=secret="$(head -c32 /dev/urandom | base64)"
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Attach a basic PloneHttpcache
|
|
38
|
-
|
|
39
|
-
Construct `PloneHttpcache` with a `plone` reference, the `existingSecret`, and a `replicas` count.
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { Plone, PloneHttpcache } from '@bluedynamics/cdk8s-plone';
|
|
43
|
-
|
|
44
|
-
const plone = new Plone(chart, 'plone', {
|
|
45
|
-
backend: { image: 'plone/plone-backend:6.1.3' },
|
|
46
|
-
frontend: { image: 'plone/plone-frontend:16.0.0' },
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
new PloneHttpcache(chart, 'cache', {
|
|
50
|
-
plone: plone,
|
|
51
|
-
existingSecret: 'varnish-admin',
|
|
52
|
-
replicas: 2,
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
RBAC for the rendered controller is always enabled; there is nothing to configure.
|
|
57
|
-
|
|
58
|
-
## Set resources
|
|
59
|
-
|
|
60
|
-
Tune the CPU and memory requests and limits to match your workload.
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
63
|
-
new PloneHttpcache(chart, 'cache', {
|
|
64
|
-
plone: plone,
|
|
65
|
-
existingSecret: 'varnish-admin',
|
|
66
|
-
requestCpu: '200m',
|
|
67
|
-
limitCpu: '1',
|
|
68
|
-
requestMemory: '256Mi',
|
|
69
|
-
limitMemory: '1Gi',
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The defaults are `requestCpu: '100m'`, `limitCpu: '500m'`, `requestMemory: '100Mi'`, and `limitMemory: '500Mi'`.
|
|
74
|
-
|
|
75
|
-
## Customize the VCL
|
|
76
|
-
|
|
77
|
-
Provide an inline VCL through `varnishVcl`, which takes precedence over `varnishVclFile`.
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
new PloneHttpcache(chart, 'cache', {
|
|
81
|
-
plone: plone,
|
|
82
|
-
existingSecret: 'varnish-admin',
|
|
83
|
-
varnishVcl: `
|
|
84
|
-
vcl 4.1;
|
|
85
|
-
backend default {
|
|
86
|
-
.host = "{{ .Env.BACKEND_SERVICE_NAME }}";
|
|
87
|
-
.port = "{{ .Env.BACKEND_SERVICE_PORT }}";
|
|
88
|
-
}
|
|
89
|
-
`,
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Alternatively, point `varnishVclFile` at a VCL template file on disk; the construct reads it at synth time.
|
|
94
|
-
When you set neither option, the construct uses the built-in `config/varnish.tpl.vcl`.
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
new PloneHttpcache(chart, 'cache', {
|
|
98
|
-
plone: plone,
|
|
99
|
-
existingSecret: 'varnish-admin',
|
|
100
|
-
varnishVclFile: './config/varnish.tpl.vcl',
|
|
101
|
-
});
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
VCL templates use Go template syntax.
|
|
105
|
-
The construct supplies these environment variables: `BACKEND_SERVICE_NAME`, `BACKEND_SERVICE_PORT`, `BACKEND_SITE_ID`, `FRONTEND_SERVICE_NAME`, and `FRONTEND_SERVICE_PORT`.
|
|
106
|
-
Reference them as `{{ .Env.NAME }}`.
|
|
107
|
-
|
|
108
|
-
Add your own variables through `extraEnvVars`, which are appended to the built-in set.
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
new PloneHttpcache(chart, 'cache', {
|
|
112
|
-
plone: plone,
|
|
113
|
-
existingSecret: 'varnish-admin',
|
|
114
|
-
extraEnvVars: [
|
|
115
|
-
{ name: 'THUMBOR_SERVICE_NAME', value: 'my-thumbor' },
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Reference an extra variable in your VCL template as `{{ .Env.THUMBOR_SERVICE_NAME }}`.
|
|
121
|
-
|
|
122
|
-
## Schedule the cache pods
|
|
123
|
-
|
|
124
|
-
Add `tolerations` so the cache pods can run on tainted nodes.
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
new PloneHttpcache(chart, 'cache', {
|
|
128
|
-
plone: plone,
|
|
129
|
-
existingSecret: 'varnish-admin',
|
|
130
|
-
tolerations: [
|
|
131
|
-
{ key: 'dedicated', operator: 'Equal', value: 'cache', effect: 'NoSchedule' },
|
|
132
|
-
],
|
|
133
|
-
});
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Omit `effect` to tolerate every taint for the given key.
|
|
137
|
-
`operator` defaults to `'Equal'`.
|
|
138
|
-
|
|
139
|
-
## Enable monitoring
|
|
140
|
-
|
|
141
|
-
Set `servicemonitor` to emit a Prometheus `ServiceMonitor`, and keep `exporterEnabled` so the Varnish exporter sidecar is present for it to scrape.
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
new PloneHttpcache(chart, 'cache', {
|
|
145
|
-
plone: plone,
|
|
146
|
-
existingSecret: 'varnish-admin',
|
|
147
|
-
servicemonitor: true,
|
|
148
|
-
exporterEnabled: true,
|
|
149
|
-
});
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
`exporterEnabled` defaults to `true`, and `servicemonitor` defaults to `false`.
|
|
153
|
-
Use `servicemonitor` here; there is no `monitoring` option on this construct.
|
|
154
|
-
For the full monitoring setup, see {doc}`/how-to/enable-prometheus-monitoring`.
|
|
155
|
-
|
|
156
|
-
## Pin the chart and image versions
|
|
157
|
-
|
|
158
|
-
Set `chartVersion` to pin the kube-httpcache Helm chart, and `appVersion` to pin the image tag.
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
new PloneHttpcache(chart, 'cache', {
|
|
162
|
-
plone: plone,
|
|
163
|
-
existingSecret: 'varnish-admin',
|
|
164
|
-
chartVersion: '0.13.1',
|
|
165
|
-
appVersion: '0.13.1',
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
`chartVersion` defaults to the latest chart, and `appVersion` defaults to `chartVersion`.
|
|
170
|
-
|
|
171
|
-
## Point your ingress at the cache
|
|
172
|
-
|
|
173
|
-
Route external traffic through the cache by using the read-only `httpcacheServiceName` output as your Ingress or IngressRoute upstream instead of the Plone frontend service.
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
const cache = new PloneHttpcache(chart, 'cache', {
|
|
177
|
-
plone: plone,
|
|
178
|
-
existingSecret: 'varnish-admin',
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
const upstream = cache.httpcacheServiceName;
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
For the routing and TLS details, see {doc}`/how-to/configure-ingress-tls`.
|
|
185
|
-
|
|
186
|
-
## Verify the cache
|
|
187
|
-
|
|
188
|
-
Generate the manifests and confirm the cache resources are present.
|
|
189
|
-
|
|
190
|
-
```shell
|
|
191
|
-
cdk8s synth
|
|
192
|
-
grep -l 'kube-httpcache' dist/*.yaml
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Apply the manifests and inspect the rollout on the cluster.
|
|
196
|
-
|
|
197
|
-
```shell
|
|
198
|
-
kubectl apply -f dist/
|
|
199
|
-
kubectl get pods -n <namespace>
|
|
200
|
-
kubectl get service -n <namespace>
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Send a request through the cache service and check the Varnish response headers.
|
|
204
|
-
|
|
205
|
-
```shell
|
|
206
|
-
kubectl run -it --rm curl --image=curlimages/curl --restart=Never -- \
|
|
207
|
-
curl -sI http://<httpcacheServiceName>.<namespace>:80/
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
A cached response carries an `X-Varnish` header, and an `Age` header greater than zero confirms a cache hit.
|
|
211
|
-
|
|
212
|
-
## PloneHttpcache compared with PloneVinylCache
|
|
213
|
-
|
|
214
|
-
`PloneHttpcache` runs Varnish from the mittwald kube-httpcache chart with a Secret and a VCL template that you supply.
|
|
215
|
-
`PloneVinylCache` runs Varnish through the cloud-vinyl operator, which generates VCL from structured configuration and manages credentials for you.
|
|
216
|
-
For the trade-offs between the two, see {doc}`/explanation/architecture` and {doc}`/how-to/deploy-with-vinyl-cache`.
|
|
217
|
-
|
|
218
|
-
## See also
|
|
219
|
-
|
|
220
|
-
- {doc}`/reference/api/index` — authoritative `PloneHttpcache` and `PloneHttpcacheOptions` reference.
|
|
221
|
-
- {doc}`/reference/configuration-options` — guide to `varnishVcl`, `existingSecret`, `extraEnvVars`, and `servicemonitor`.
|
|
222
|
-
- {doc}`/how-to/enable-prometheus-monitoring` — scrape the Varnish cache with Prometheus.
|
|
223
|
-
- {doc}`/how-to/deploy-with-vinyl-cache` — operator-managed Varnish caching alternative.
|
|
224
|
-
- [mittwald kube-httpcache](https://github.com/mittwald/kube-httpcache) — upstream controller and Helm chart.
|