@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,273 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Add the cloud-vinyl VinylCache operator to your Plone deployment for operator-managed Varnish caching."
|
|
5
|
-
"property=og:description": "Add the cloud-vinyl VinylCache operator to your Plone deployment for operator-managed Varnish caching."
|
|
6
|
-
"property=og:title": "Deploy with cloud-vinyl cache"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, Varnish, cloud-vinyl, VinylCache, operator, caching"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Deploy with cloud-vinyl cache
|
|
11
|
-
|
|
12
|
-
<div class="page-metadata">
|
|
13
|
-
<div class="metadata-content">
|
|
14
|
-
<p><strong>Type</strong>: How-To (Task-oriented)</p>
|
|
15
|
-
<p><strong>Difficulty</strong>: Intermediate</p>
|
|
16
|
-
<p><strong>Time</strong>: 15 minutes</p>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
## Prerequisites
|
|
21
|
-
|
|
22
|
-
- The **cloud-vinyl operator 1.0.0-rc.2 or later** must be installed in your cluster.
|
|
23
|
-
`PloneVinylCache` renders `vinyl.bluedynamics.eu/v1`, which earlier releases do not serve.
|
|
24
|
-
Apply the CRD server-side, as described in the cloud-vinyl release notes.
|
|
25
|
-
- A working Plone deployment using `cdk8s-plone`
|
|
26
|
-
- `@bluedynamics/cdk8s-plone` version with VinylCache support
|
|
27
|
-
|
|
28
|
-
## Steps
|
|
29
|
-
|
|
30
|
-
### 1. Add PloneVinylCache to your deployment
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
import { Plone, PloneVinylCache } from '@bluedynamics/cdk8s-plone';
|
|
34
|
-
|
|
35
|
-
const plone = new Plone(chart, 'plone', {
|
|
36
|
-
backend: { image: 'plone/plone-backend:6.1.3' },
|
|
37
|
-
frontend: { image: 'plone/plone-frontend:16.0.0' },
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const cache = new PloneVinylCache(chart, 'cache', {
|
|
41
|
-
plone: plone,
|
|
42
|
-
replicas: 2,
|
|
43
|
-
});
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 2. Use the cache service in your IngressRoute
|
|
47
|
-
|
|
48
|
-
The cache exposes a service that should be used as the upstream in your IngressRoute:
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
// Use cache.vinylCacheServiceName as the service target
|
|
52
|
-
// instead of plone.frontendServiceName
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### 3. Build and deploy
|
|
56
|
-
|
|
57
|
-
```shell
|
|
58
|
-
npm run build
|
|
59
|
-
# Review generated manifests
|
|
60
|
-
# Deploy via ArgoCD or kubectl apply
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 4. Verify
|
|
64
|
-
|
|
65
|
-
```shell
|
|
66
|
-
# Check VinylCache status
|
|
67
|
-
kubectl get vinylcache -n <namespace>
|
|
68
|
-
|
|
69
|
-
# Check Varnish pods
|
|
70
|
-
kubectl get pods -n <namespace> -l app.kubernetes.io/managed-by=cloud-vinyl
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Customization
|
|
74
|
-
|
|
75
|
-
### Sizing the cache storage
|
|
76
|
-
|
|
77
|
-
Without an explicit `storage` entry, the operator ships varnishd with its stock default (~100 MB malloc), which is almost always too small.
|
|
78
|
-
Set a malloc size well below the pod's memory limit.
|
|
79
|
-
Name the storage anything but `s0`, and pin it in `vcl_backend_response`:
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
new PloneVinylCache(chart, 'cache', {
|
|
83
|
-
plone: plone,
|
|
84
|
-
requestMemory: '2Gi',
|
|
85
|
-
limitMemory: '3Gi',
|
|
86
|
-
storage: [
|
|
87
|
-
{ name: 'cache', type: 'malloc', size: '1G' },
|
|
88
|
-
],
|
|
89
|
-
vclBackendResponseSnippet: `
|
|
90
|
-
set beresp.storage = storage.cache;
|
|
91
|
-
`,
|
|
92
|
-
});
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
The stock varnish image's entrypoint always adds its own unnamed `-s malloc,...`, which varnishd names `s0`.
|
|
96
|
-
An entry named `s0` collides with it, and varnishd fails to start.
|
|
97
|
-
With any other name, varnishd spreads cacheable objects round-robin over your storage and `s0`, unless the VCL sets `beresp.storage`.
|
|
98
|
-
|
|
99
|
-
varnishd needs memory beyond the storage: its malloc heap fragments under eviction churn and can grow to more than twice the storage size.
|
|
100
|
-
Keep large bodies out of a small cache, and set the memory request close to what the pod actually uses, so the scheduler sees it:
|
|
101
|
-
|
|
102
|
-
```vcl
|
|
103
|
-
if (std.integer(beresp.http.Content-Length, 0) > 8388608) {
|
|
104
|
-
set beresp.uncacheable = true;
|
|
105
|
-
set beresp.ttl = 120s;
|
|
106
|
-
return (deliver);
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Clustering and varnishd parameters
|
|
111
|
-
|
|
112
|
-
With two or more replicas behind a load balancer, every pod caches every object unless the pods are clustered.
|
|
113
|
-
Set `cluster: true`, so that a pod passes requests for URLs it does not own to the pod that does:
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
new PloneVinylCache(chart, 'cache', {
|
|
117
|
-
plone: plone,
|
|
118
|
-
replicas: 2,
|
|
119
|
-
cluster: true,
|
|
120
|
-
varnishParameters: { nuke_limit: '1000' },
|
|
121
|
-
});
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
`varnishParameters` become `-p` flags for varnishd.
|
|
125
|
-
varnishd's default `nuke_limit` of 50 makes a large fetch fail with `Could not get storage` when 50 evictions do not free enough space, and the client gets a 503.
|
|
126
|
-
|
|
127
|
-
### Backend health probes
|
|
128
|
-
|
|
129
|
-
Varnish probes each Plone backend and stops sending requests to a backend that fails too many probes.
|
|
130
|
-
The defaults are `{ url: '/ok', interval: '5s', timeout: '2s', window: 10, threshold: 8 }` for the backend and the same with `url: '/'` for the frontend.
|
|
131
|
-
If slow requests, for example while the database warms up, make probes time out, raise the timeout:
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
new PloneVinylCache(chart, 'cache', {
|
|
135
|
-
plone: plone,
|
|
136
|
-
ploneBackendProbe: { timeout: '5s' }, // other fields keep their defaults
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
`ploneFrontendProbe` does the same for the Volto frontend, and `extraBackends[].probe` for additional backends.
|
|
141
|
-
`threshold` must not exceed `window`, and `window` must be 64 or less, otherwise varnishd rejects the VCL.
|
|
142
|
-
The construct checks this when you synthesize.
|
|
143
|
-
|
|
144
|
-
### Custom VCL
|
|
145
|
-
|
|
146
|
-
Override the default Plone VCL snippets for custom caching logic:
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
new PloneVinylCache(chart, 'cache', {
|
|
150
|
-
plone: plone,
|
|
151
|
-
vclRecvSnippet: fs.readFileSync('./config/custom-recv.vcl', 'utf8'),
|
|
152
|
-
vclBackendResponseSnippet: fs.readFileSync('./config/custom-beresp.vcl', 'utf8'),
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
(vinyl-cache-invalidation)=
|
|
157
|
-
|
|
158
|
-
### Cache invalidation
|
|
159
|
-
|
|
160
|
-
Invalidation is enabled by default (PURGE, BAN, xkey). Configure `plone.cachepurging` to point to the VinylCache invalidation proxy endpoint.
|
|
161
|
-
|
|
162
|
-
The proxy serves the caches of all namespaces and routes by `Host`, so the address must include the namespace.
|
|
163
|
-
Give the chart a namespace, list the public hostnames of the site in `purgeHosts`, and read the address from `invalidationUrl`:
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
const chart = new Chart(app, 'site', { namespace: 'plone' });
|
|
167
|
-
const cache = new PloneVinylCache(chart, 'cache', {
|
|
168
|
-
plone,
|
|
169
|
-
purgeHosts: ['example.org', 'www.example.org'],
|
|
170
|
-
});
|
|
171
|
-
// http://<cache>-invalidation.plone:8090
|
|
172
|
-
console.log(cache.invalidationUrl);
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Varnish keys a cached page by its URL and its site host.
|
|
176
|
-
`plone.cachepurging` cannot tell the proxy the site host, so the proxy sends one purge per entry in `purgeHosts`.
|
|
177
|
-
Without `purgeHosts`, its purges succeed but remove nothing, and pages only change after their TTL.
|
|
178
|
-
To check that purges work, watch `vinyl_objects_purged_total`.
|
|
179
|
-
|
|
180
|
-
Enter this value as a caching proxy in the `plone.cachepurging` settings.
|
|
181
|
-
Do not build the address from `vinylCacheServiceName` yourself: the proxy rejects the bare `<cache>-invalidation` name with `404 unknown cache`, and `plone.cachepurging` does not log failed purges.
|
|
182
|
-
`invalidationUrl` throws if the chart has no namespace or if `invalidation` is disabled.
|
|
183
|
-
|
|
184
|
-
cloud-vinyl handles PURGE, BAN, and xkey requests in its own VCL with its own access lists.
|
|
185
|
-
A custom `vclRecvSnippet` only runs for `GET` and `HEAD` requests and must not handle them.
|
|
186
|
-
|
|
187
|
-
To disable invalidation:
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
new PloneVinylCache(chart, 'cache', {
|
|
191
|
-
plone: plone,
|
|
192
|
-
invalidation: false,
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Tracing
|
|
197
|
-
|
|
198
|
-
To export OpenTelemetry trace spans built from the Varnish log, point the vinyl-tracer sidecar at your collector:
|
|
199
|
-
|
|
200
|
-
```typescript
|
|
201
|
-
new PloneVinylCache(chart, 'cache', {
|
|
202
|
-
plone: plone,
|
|
203
|
-
tracing: {
|
|
204
|
-
otlpEndpoint: 'otel-collector.monitoring:4317', // host:port, no scheme
|
|
205
|
-
insecure: true, // plain gRPC inside the cluster
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
`protocol` selects `'grpc'` (default) or `'http/protobuf'`, and `serviceName` sets the OpenTelemetry `service.name`, which defaults to the VinylCache name.
|
|
211
|
-
The tracer needs a varnish 9 image, such as the default.
|
|
212
|
-
|
|
213
|
-
### Edge Side Includes
|
|
214
|
-
|
|
215
|
-
Set `esi: true` to process Edge Side Includes in backend responses that carry `Surrogate-Control: content="ESI/1.0"`.
|
|
216
|
-
Do not enable ESI with `varnishParameters: { feature: '+esi' }`: that is not a varnishd feature bit, and varnishd fails to start.
|
|
217
|
-
If response bodies do not start with `<`, also set `varnishParameters: { feature: '+esi_disable_xml_check' }`.
|
|
218
|
-
|
|
219
|
-
### Shard director tuning
|
|
220
|
-
|
|
221
|
-
For shard-based load distribution (the default), you can fine-tune the consistent-hash behavior.
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
new PloneVinylCache(chart, 'cache', {
|
|
225
|
-
plone: plone,
|
|
226
|
-
director: 'shard',
|
|
227
|
-
shardBy: 'URL', // the only supported value; cloud-vinyl 1.0 removed 'HASH'
|
|
228
|
-
shardHealthy: 'ALL', // require all backends healthy (vs. only "CHOSEN")
|
|
229
|
-
shardRampup: '45s', // warm-up window for newly added backends
|
|
230
|
-
shardReplicas: 128, // Ketama replicas per backend
|
|
231
|
-
});
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
Shard options are ignored for non-shard directors (`round_robin`, `random`, `hash`).
|
|
235
|
-
|
|
236
|
-
## Upgrading from cloud-vinyl 0.x
|
|
237
|
-
|
|
238
|
-
This `cdk8s-plone` release targets cloud-vinyl 1.0.
|
|
239
|
-
|
|
240
|
-
1. Upgrade the operator and its CRD to 1.0.0-rc.2 or later first, following the cloud-vinyl release notes.
|
|
241
|
-
The new manifests use `vinyl.bluedynamics.eu/v1`, which older operators reject.
|
|
242
|
-
2. Set `purgeHosts` if you use `plone.cachepurging`, see {ref}`vinyl-cache-invalidation`.
|
|
243
|
-
3. Review the manifest diff:
|
|
244
|
-
- `apiVersion` changes from `v1alpha1` to `v1`.
|
|
245
|
-
- The default image changes from `varnish:7.6` to `varnish:9.1.0`, the image cloud-vinyl 1.0 is tested with.
|
|
246
|
-
Set `image` to keep another one.
|
|
247
|
-
- The default `vclRecv` snippet no longer contains PURGE and BAN handling.
|
|
248
|
-
Since cloud-vinyl 0.7.0 it did not compile, so caches with the default snippet never became ready.
|
|
249
|
-
4. Replace `shardBy: 'HASH'` with `'URL'` or drop it.
|
|
250
|
-
cloud-vinyl 1.0 removed `HASH`, and `PloneVinylCache` rejects it.
|
|
251
|
-
|
|
252
|
-
## Migrating from PloneHttpcache
|
|
253
|
-
|
|
254
|
-
Replace `PloneHttpcache` with `PloneVinylCache`:
|
|
255
|
-
|
|
256
|
-
```typescript
|
|
257
|
-
// Before (mittwald)
|
|
258
|
-
// import { PloneHttpcache } from '@bluedynamics/cdk8s-plone';
|
|
259
|
-
// const cache = new PloneHttpcache(chart, 'cache', {
|
|
260
|
-
// plone, varnishVcl: '...', existingSecret: 'secret',
|
|
261
|
-
// });
|
|
262
|
-
// const serviceName = cache.httpcacheServiceName;
|
|
263
|
-
|
|
264
|
-
// After (cloud-vinyl)
|
|
265
|
-
import { PloneVinylCache } from '@bluedynamics/cdk8s-plone';
|
|
266
|
-
const cache = new PloneVinylCache(chart, 'cache', { plone });
|
|
267
|
-
const serviceName = cache.vinylCacheServiceName;
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Key differences:
|
|
271
|
-
- No VCL template needed (operator generates VCL from structured config)
|
|
272
|
-
- No `existingSecret` needed (operator manages agent authentication)
|
|
273
|
-
- Service name property is `vinylCacheServiceName` (not `httpcacheServiceName`)
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Create a Prometheus ServiceMonitor for the Plone backend, frontend, or Varnish cache to expose metrics."
|
|
5
|
-
"property=og:description": "Create a Prometheus ServiceMonitor for the Plone backend, frontend, or Varnish cache to expose metrics."
|
|
6
|
-
"property=og:title": "Enable Prometheus monitoring"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, Prometheus, ServiceMonitor, monitoring, metrics"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Enable Prometheus monitoring
|
|
11
|
-
|
|
12
|
-
<div class="page-metadata">
|
|
13
|
-
<div class="metadata-content">
|
|
14
|
-
<p><strong>Type</strong>: How-To (Task-oriented)</p>
|
|
15
|
-
<p><strong>Difficulty</strong>: Intermediate</p>
|
|
16
|
-
<p><strong>Time</strong>: 15 minutes</p>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
This guide shows you how to expose Plone metrics to Prometheus by creating a `ServiceMonitor` for the backend, the frontend, or the Varnish cache.
|
|
21
|
-
|
|
22
|
-
## Prerequisites
|
|
23
|
-
|
|
24
|
-
- The [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator) installed in the cluster (it provides the `ServiceMonitor` CRD).
|
|
25
|
-
- A `Prometheus` resource that selects the `ServiceMonitor` resources you create (check `serviceMonitorSelector` and `serviceMonitorNamespaceSelector`).
|
|
26
|
-
- A Plone container instrumented to expose metrics over HTTP. Plone itself does not ship a Prometheus endpoint; you need an add-on (such as a WSGI middleware) or a sidecar exporter.
|
|
27
|
-
|
|
28
|
-
## Enable the ServiceMonitor on the backend
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
|
|
32
|
-
|
|
33
|
-
new Plone(chart, 'plone', {
|
|
34
|
-
variant: PloneVariant.VOLTO,
|
|
35
|
-
backend: {
|
|
36
|
-
image: 'plone/plone-backend:6.1.3',
|
|
37
|
-
servicemonitor: true,
|
|
38
|
-
metricsPath: '/metrics',
|
|
39
|
-
},
|
|
40
|
-
frontend: {
|
|
41
|
-
image: 'plone/plone-frontend:16.0.0',
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
`servicemonitor: true` instructs `cdk8s-plone` to emit a `ServiceMonitor` that scrapes the backend Service on its main port at `/metrics`.
|
|
47
|
-
|
|
48
|
-
## Scrape the frontend on a dedicated port
|
|
49
|
-
|
|
50
|
-
Volto can expose metrics on a separate port through middleware such as [`express-prometheus-middleware`](https://www.npmjs.com/package/express-prometheus-middleware).
|
|
51
|
-
Point `cdk8s-plone` at that port:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
frontend: {
|
|
55
|
-
image: 'plone/plone-frontend:16.0.0',
|
|
56
|
-
servicemonitor: true,
|
|
57
|
-
metricsPort: 9090,
|
|
58
|
-
metricsPath: '/metrics',
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
`metricsPort` accepts a port number or a Service port name.
|
|
63
|
-
|
|
64
|
-
## Scrape the Varnish cache
|
|
65
|
-
|
|
66
|
-
`PloneHttpcache` and `PloneVinylCache` each accept their own monitoring switch.
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
import { PloneHttpcache } from '@bluedynamics/cdk8s-plone';
|
|
70
|
-
|
|
71
|
-
new PloneHttpcache(chart, 'cache', {
|
|
72
|
-
plone: ploneInstance,
|
|
73
|
-
servicemonitor: true,
|
|
74
|
-
exporterEnabled: true,
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
`exporterEnabled` (default `true`) deploys the Varnish exporter sidecar that the `ServiceMonitor` scrapes.
|
|
79
|
-
|
|
80
|
-
For the cloud-vinyl operator:
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
import { PloneVinylCache } from '@bluedynamics/cdk8s-plone';
|
|
84
|
-
|
|
85
|
-
new PloneVinylCache(chart, 'cache', {
|
|
86
|
-
plone: ploneInstance,
|
|
87
|
-
monitoring: true,
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```{note}
|
|
92
|
-
The option name differs by construct: backend, frontend, and `PloneHttpcache` use `servicemonitor`, while `PloneVinylCache` uses `monitoring`. Both create a Prometheus `ServiceMonitor`.
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Verify the rollout
|
|
96
|
-
|
|
97
|
-
```shell
|
|
98
|
-
# Generate manifests and confirm the ServiceMonitor exists
|
|
99
|
-
cdk8s synth
|
|
100
|
-
grep -l 'kind: ServiceMonitor' dist/*.yaml
|
|
101
|
-
|
|
102
|
-
# Apply and inspect on the cluster
|
|
103
|
-
kubectl apply -f dist/
|
|
104
|
-
kubectl get servicemonitor -n <namespace>
|
|
105
|
-
kubectl describe servicemonitor <name> -n <namespace>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
If Prometheus is not picking up the new target, confirm:
|
|
109
|
-
|
|
110
|
-
- The `ServiceMonitor` namespace matches the `Prometheus` resource's `serviceMonitorNamespaceSelector`.
|
|
111
|
-
- The `ServiceMonitor` labels match the `Prometheus` resource's `serviceMonitorSelector`.
|
|
112
|
-
- The metrics endpoint returns HTTP 200 from a pod in the cluster:
|
|
113
|
-
|
|
114
|
-
```shell
|
|
115
|
-
kubectl run -it --rm curl --image=curlimages/curl --restart=Never -- \
|
|
116
|
-
curl -sf http://<service>.<namespace>:<port>/metrics | head
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## See also
|
|
120
|
-
|
|
121
|
-
- {doc}`/reference/configuration-options` — Reference for `servicemonitor`, `metricsPort`, `metricsPath`.
|
|
122
|
-
- [Prometheus Operator documentation](https://prometheus-operator.dev/) — `ServiceMonitor` selectors and lifecycle.
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Goal-oriented how-to guides for solving specific cdk8s-plone deployment and configuration problems."
|
|
5
|
-
"property=og:description": "Goal-oriented how-to guides for solving specific cdk8s-plone deployment and configuration problems."
|
|
6
|
-
"property=og:title": "How-to guides"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, how-to, deployment, configuration"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# How-to guides
|
|
11
|
-
|
|
12
|
-
**Goal-oriented guides showing you how to solve specific problems with cdk8s-plone.**
|
|
13
|
-
|
|
14
|
-
How-to guides are recipes that take you through the steps involved in addressing specific tasks and problems. They are more advanced than tutorials and assume you have some knowledge of how cdk8s-plone works.
|
|
15
|
-
|
|
16
|
-
## Prerequisites
|
|
17
|
-
|
|
18
|
-
**Set up required infrastructure before deploying Plone:**
|
|
19
|
-
|
|
20
|
-
```{toctree}
|
|
21
|
-
---
|
|
22
|
-
maxdepth: 1
|
|
23
|
-
titlesonly: true
|
|
24
|
-
---
|
|
25
|
-
setup-prerequisites
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Deployment
|
|
29
|
-
|
|
30
|
-
**Deploy complete Plone examples to your Kubernetes cluster:**
|
|
31
|
-
|
|
32
|
-
```{toctree}
|
|
33
|
-
---
|
|
34
|
-
maxdepth: 1
|
|
35
|
-
titlesonly: true
|
|
36
|
-
---
|
|
37
|
-
deploy-volto
|
|
38
|
-
deploy-blicca
|
|
39
|
-
deploy-with-httpcache
|
|
40
|
-
deploy-with-vinyl-cache
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
```{toctree}
|
|
46
|
-
---
|
|
47
|
-
maxdepth: 1
|
|
48
|
-
titlesonly: true
|
|
49
|
-
---
|
|
50
|
-
configure-env-and-secrets
|
|
51
|
-
configure-security-context
|
|
52
|
-
schedule-pods
|
|
53
|
-
configure-ingress-tls
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Operations and maintenance
|
|
57
|
-
|
|
58
|
-
```{toctree}
|
|
59
|
-
---
|
|
60
|
-
maxdepth: 1
|
|
61
|
-
titlesonly: true
|
|
62
|
-
---
|
|
63
|
-
enable-prometheus-monitoring
|
|
64
|
-
scale-and-high-availability
|
|
65
|
-
upgrade-and-rollout
|
|
66
|
-
backup-and-restore
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Troubleshooting
|
|
70
|
-
|
|
71
|
-
```{toctree}
|
|
72
|
-
---
|
|
73
|
-
maxdepth: 1
|
|
74
|
-
titlesonly: true
|
|
75
|
-
---
|
|
76
|
-
troubleshooting
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
**New to cdk8s-plone?** Start with the [Tutorials](../tutorials/index.md) for step-by-step lessons.
|
|
82
|
-
|
|
83
|
-
**Need technical specifications?** See the [Reference](../reference/index.md) section for API documentation.
|
|
84
|
-
|
|
85
|
-
**Want to understand concepts?** Read the [Explanation](../explanation/index.md) section for architecture and design decisions.
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
myst:
|
|
3
|
-
html_meta:
|
|
4
|
-
"description": "Scale the Plone backend and frontend with cdk8s-plone, configure a PodDisruptionBudget, and add a HorizontalPodAutoscaler."
|
|
5
|
-
"property=og:description": "Scale the Plone backend and frontend with cdk8s-plone, configure a PodDisruptionBudget, and add a HorizontalPodAutoscaler."
|
|
6
|
-
"property=og:title": "Scale and run highly available"
|
|
7
|
-
"keywords": "Plone, cdk8s, Kubernetes, scaling, replicas, PodDisruptionBudget, HPA, high availability"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Scale and run highly available
|
|
11
|
-
|
|
12
|
-
This guide shows you how to run more than one replica of the Plone backend and frontend, protect them with a PodDisruptionBudget, and add a HorizontalPodAutoscaler.
|
|
13
|
-
|
|
14
|
-
## Prerequisites
|
|
15
|
-
|
|
16
|
-
- A working Plone deployment created with `cdk8s-plone`.
|
|
17
|
-
- A PostgreSQL backend reachable by every backend replica.
|
|
18
|
-
|
|
19
|
-
The backend uses RelStorage on PostgreSQL, so several backend replicas share one database and scale horizontally.
|
|
20
|
-
The Volto frontend is stateless and scales horizontally as well.
|
|
21
|
-
|
|
22
|
-
## Set the replica count
|
|
23
|
-
|
|
24
|
-
Set `replicas` on `backend` and `frontend` independently.
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
|
|
28
|
-
|
|
29
|
-
new Plone(chart, 'plone', {
|
|
30
|
-
variant: PloneVariant.VOLTO,
|
|
31
|
-
backend: {
|
|
32
|
-
image: 'plone/plone-backend:6.1.3',
|
|
33
|
-
replicas: 3,
|
|
34
|
-
},
|
|
35
|
-
frontend: {
|
|
36
|
-
image: 'plone/plone-frontend:16.0.0',
|
|
37
|
-
replicas: 2,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Both default to `2` replicas when you omit the option.
|
|
43
|
-
|
|
44
|
-
## Protect availability with a PodDisruptionBudget
|
|
45
|
-
|
|
46
|
-
A PodDisruptionBudget keeps a minimum number of pods running during voluntary disruptions such as node drains.
|
|
47
|
-
|
|
48
|
-
Set `minAvailable` or `maxUnavailable` on the component.
|
|
49
|
-
Each accepts an absolute number or a percentage string such as `"50%"`.
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
backend: {
|
|
53
|
-
image: 'plone/plone-backend:6.1.3',
|
|
54
|
-
replicas: 5,
|
|
55
|
-
minAvailable: 3,
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
`cdk8s-plone` creates the PodDisruptionBudget automatically when `replicas` is `2` or more, or when you set `minAvailable` or `maxUnavailable` explicitly.
|
|
60
|
-
A single replica with no explicit setting gets no PodDisruptionBudget.
|
|
61
|
-
The generated PodDisruptionBudget always sets `unhealthyPodEvictionPolicy: AlwaysAllow`, so unhealthy pods never block a node drain.
|
|
62
|
-
|
|
63
|
-
## Add a HorizontalPodAutoscaler
|
|
64
|
-
|
|
65
|
-
`cdk8s-plone` emits plain Deployments and does not configure autoscaling.
|
|
66
|
-
To scale on load, add your own HorizontalPodAutoscaler that targets the generated backend Deployment.
|
|
67
|
-
|
|
68
|
-
Find the Deployment name from the synthesized manifests:
|
|
69
|
-
|
|
70
|
-
```shell
|
|
71
|
-
cdk8s synth
|
|
72
|
-
grep -A2 'kind: Deployment' dist/*.yaml | grep 'name:'
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Add the autoscaler as a Kubernetes manifest and apply it alongside your deployment:
|
|
76
|
-
|
|
77
|
-
```yaml
|
|
78
|
-
apiVersion: autoscaling/v2
|
|
79
|
-
kind: HorizontalPodAutoscaler
|
|
80
|
-
metadata:
|
|
81
|
-
name: plone-backend
|
|
82
|
-
spec:
|
|
83
|
-
scaleTargetRef:
|
|
84
|
-
apiVersion: apps/v1
|
|
85
|
-
kind: Deployment
|
|
86
|
-
name: <backend-deployment-name>
|
|
87
|
-
minReplicas: 2
|
|
88
|
-
maxReplicas: 8
|
|
89
|
-
metrics:
|
|
90
|
-
- type: Resource
|
|
91
|
-
resource:
|
|
92
|
-
name: cpu
|
|
93
|
-
target:
|
|
94
|
-
type: Utilization
|
|
95
|
-
averageUtilization: 70
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
The HorizontalPodAutoscaler needs [metrics-server](https://github.com/kubernetes-sigs/metrics-server) in the cluster.
|
|
99
|
-
Keep `minReplicas` at `2` or more so the PodDisruptionBudget stays effective.
|
|
100
|
-
|
|
101
|
-
## Verify
|
|
102
|
-
|
|
103
|
-
Confirm the PodDisruptionBudget is present in the synthesized manifests:
|
|
104
|
-
|
|
105
|
-
```shell
|
|
106
|
-
cdk8s synth
|
|
107
|
-
grep -l 'kind: PodDisruptionBudget' dist/*.yaml
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Inspect the running objects on the cluster:
|
|
111
|
-
|
|
112
|
-
```shell
|
|
113
|
-
kubectl get deploy -n <namespace>
|
|
114
|
-
kubectl get pdb -n <namespace>
|
|
115
|
-
kubectl get hpa -n <namespace>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## See also
|
|
119
|
-
|
|
120
|
-
- {doc}`/reference/api/index` — authoritative `replicas`, `minAvailable`, and `maxUnavailable` reference.
|
|
121
|
-
- {doc}`/how-to/schedule-pods` — place the extra replicas on specific nodes.
|
|
122
|
-
- {doc}`/explanation/architecture` — how the backend, frontend, and database fit together.
|