@bluedynamics/cdk8s-plone 0.3.2 → 0.3.3

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.
Files changed (68) hide show
  1. package/.jsii +2 -2
  2. package/lib/config/plone-vinyl-backend-response.vcl +25 -0
  3. package/lib/config/plone-vinyl-recv.vcl +18 -0
  4. package/{examples/volto → lib}/config/varnish.tpl.vcl +1 -1
  5. package/lib/httpcache.js +1 -1
  6. package/lib/plone.js +1 -1
  7. package/lib/vinylcache.js +1 -1
  8. package/package.json +3 -2
  9. package/.claude/claude.md +0 -39
  10. package/.claude/settings.local.json +0 -31
  11. package/CLAUDE.md +0 -352
  12. package/docs/superpowers/plans/2026-06-12-configurable-service-spec.md +0 -608
  13. package/docs/superpowers/specs/2026-06-12-configurable-service-spec-design.md +0 -192
  14. package/documentation/Makefile +0 -357
  15. package/documentation/README.md +0 -284
  16. package/documentation/mx.ini +0 -3
  17. package/documentation/sources/_static/logo.svg +0 -79
  18. package/documentation/sources/conf.py +0 -145
  19. package/documentation/sources/explanation/architecture.md +0 -336
  20. package/documentation/sources/explanation/cdk8s-workflow.md +0 -66
  21. package/documentation/sources/explanation/features.md +0 -374
  22. package/documentation/sources/explanation/index.md +0 -34
  23. package/documentation/sources/how-to/backup-and-restore.md +0 -107
  24. package/documentation/sources/how-to/configure-env-and-secrets.md +0 -184
  25. package/documentation/sources/how-to/configure-ingress-tls.md +0 -108
  26. package/documentation/sources/how-to/configure-security-context.md +0 -143
  27. package/documentation/sources/how-to/deploy-blicca.md +0 -334
  28. package/documentation/sources/how-to/deploy-volto.md +0 -324
  29. package/documentation/sources/how-to/deploy-with-httpcache.md +0 -224
  30. package/documentation/sources/how-to/deploy-with-vinyl-cache.md +0 -273
  31. package/documentation/sources/how-to/enable-prometheus-monitoring.md +0 -122
  32. package/documentation/sources/how-to/index.md +0 -85
  33. package/documentation/sources/how-to/scale-and-high-availability.md +0 -122
  34. package/documentation/sources/how-to/schedule-pods.md +0 -145
  35. package/documentation/sources/how-to/setup-prerequisites.md +0 -363
  36. package/documentation/sources/how-to/troubleshooting.md +0 -113
  37. package/documentation/sources/how-to/upgrade-and-rollout.md +0 -140
  38. package/documentation/sources/index.md +0 -109
  39. package/documentation/sources/reference/api/index.md +0 -40
  40. package/documentation/sources/reference/configuration-options.md +0 -352
  41. package/documentation/sources/reference/index.md +0 -41
  42. package/documentation/sources/tutorials/01-quick-start.md +0 -165
  43. package/documentation/sources/tutorials/index.md +0 -53
  44. package/examples/blicca/.env.example +0 -20
  45. package/examples/blicca/README.md +0 -339
  46. package/examples/blicca/__snapshots__/main.test.ts.snap +0 -1035
  47. package/examples/blicca/cdk8s.yaml +0 -6
  48. package/examples/blicca/config/varnish.tpl.vcl +0 -217
  49. package/examples/blicca/ingress.ts +0 -217
  50. package/examples/blicca/jest.config.js +0 -11
  51. package/examples/blicca/main.test.ts +0 -18
  52. package/examples/blicca/main.ts +0 -101
  53. package/examples/blicca/package.json +0 -36
  54. package/examples/blicca/postgres.cloudnativepg.ts +0 -63
  55. package/examples/blicca/postgres.plain.ts +0 -115
  56. package/examples/blicca/tsconfig.json +0 -33
  57. package/examples/volto/.env.example +0 -21
  58. package/examples/volto/README.md +0 -292
  59. package/examples/volto/__snapshots__/main.test.ts.snap +0 -1206
  60. package/examples/volto/cdk8s.yaml +0 -6
  61. package/examples/volto/ingress.ts +0 -229
  62. package/examples/volto/jest.config.js +0 -11
  63. package/examples/volto/main.test.ts +0 -18
  64. package/examples/volto/main.ts +0 -105
  65. package/examples/volto/package.json +0 -36
  66. package/examples/volto/postgres.cloudnativepg.ts +0 -63
  67. package/examples/volto/postgres.plain.ts +0 -115
  68. package/examples/volto/tsconfig.json +0 -33
@@ -1,115 +0,0 @@
1
- import { Construct } from 'constructs';
2
- import * as k8s from './imports/k8s';
3
-
4
- /**
5
- * Operator-free PostgreSQL for the example.
6
- *
7
- * Deploys a single-instance PostgreSQL StatefulSet using the official
8
- * `postgres` Docker image. No operator and no third-party Helm chart are
9
- * required, which keeps the dependency surface minimal. It is intended for
10
- * development and small production setups; for high availability, point-in-time
11
- * recovery, and automated failover use the CloudNativePG variant instead.
12
- */
13
- export class PGPlainChart extends Construct {
14
- public readonly dbServiceName: string;
15
- public readonly secretName: string;
16
-
17
- constructor(scope: Construct, id: string) {
18
- super(scope, id);
19
-
20
- const dbname = 'plone';
21
- const dbuser = 'plone';
22
- const dbpass = 'admin@plone';
23
-
24
- const labels = {
25
- 'app.kubernetes.io/name': 'plone-postgresql',
26
- 'app.kubernetes.io/instance': 'postgresql',
27
- 'app.kubernetes.io/component': 'database',
28
- 'app.kubernetes.io/part-of': 'plone',
29
- };
30
-
31
- const secret = new k8s.KubeSecret(this, 'secret', {
32
- metadata: { labels },
33
- stringData: { username: dbuser, password: dbpass, database: dbname },
34
- });
35
- this.secretName = secret.name;
36
-
37
- const service = new k8s.KubeService(this, 'service', {
38
- metadata: { labels },
39
- spec: {
40
- selector: labels,
41
- ports: [
42
- { port: 5432, targetPort: k8s.IntOrString.fromNumber(5432), name: 'postgresql' },
43
- ],
44
- },
45
- });
46
- this.dbServiceName = service.name;
47
-
48
- new k8s.KubeStatefulSet(this, 'db', {
49
- metadata: { labels },
50
- spec: {
51
- serviceName: service.name,
52
- replicas: 1,
53
- selector: { matchLabels: labels },
54
- template: {
55
- metadata: { labels },
56
- spec: {
57
- // The official postgres image runs as uid/gid 999.
58
- // fsGroup makes the mounted volume group-writable for it.
59
- securityContext: { fsGroup: 999 },
60
- containers: [
61
- {
62
- name: 'postgresql',
63
- image: 'postgres:18',
64
- ports: [{ containerPort: 5432, name: 'postgresql' }],
65
- env: [
66
- { name: 'POSTGRES_USER', valueFrom: { secretKeyRef: { name: secret.name, key: 'username' } } },
67
- { name: 'POSTGRES_PASSWORD', valueFrom: { secretKeyRef: { name: secret.name, key: 'password' } } },
68
- { name: 'POSTGRES_DB', valueFrom: { secretKeyRef: { name: secret.name, key: 'database' } } },
69
- // Keep PGDATA in a subdirectory so the volume root can hold lost+found.
70
- { name: 'PGDATA', value: '/var/lib/postgresql/data/pgdata' },
71
- ],
72
- volumeMounts: [
73
- { name: 'data', mountPath: '/var/lib/postgresql/data' },
74
- ],
75
- readinessProbe: {
76
- exec: { command: ['pg_isready', '-U', dbuser, '-d', dbname] },
77
- initialDelaySeconds: 10,
78
- periodSeconds: 10,
79
- timeoutSeconds: 5,
80
- },
81
- livenessProbe: {
82
- exec: { command: ['pg_isready', '-U', dbuser, '-d', dbname] },
83
- initialDelaySeconds: 30,
84
- periodSeconds: 15,
85
- timeoutSeconds: 5,
86
- },
87
- resources: {
88
- requests: {
89
- cpu: k8s.Quantity.fromString('100m'),
90
- memory: k8s.Quantity.fromString('256Mi'),
91
- },
92
- limits: {
93
- cpu: k8s.Quantity.fromString('1'),
94
- memory: k8s.Quantity.fromString('1Gi'),
95
- },
96
- },
97
- },
98
- ],
99
- },
100
- },
101
- volumeClaimTemplates: [
102
- {
103
- metadata: { name: 'data', labels },
104
- spec: {
105
- accessModes: ['ReadWriteOnce'],
106
- resources: {
107
- requests: { storage: k8s.Quantity.fromString('10Gi') },
108
- },
109
- },
110
- },
111
- ],
112
- },
113
- });
114
- }
115
- }
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "alwaysStrict": true,
4
- "declaration": true,
5
- "experimentalDecorators": true,
6
- "inlineSourceMap": true,
7
- "inlineSources": true,
8
- "lib": [
9
- "ES2020"
10
- ],
11
- "module": "CommonJS",
12
- "noEmit": false,
13
- "noEmitOnError": true,
14
- "noFallthroughCasesInSwitch": true,
15
- "noImplicitAny": true,
16
- "noImplicitReturns": true,
17
- "noImplicitThis": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "resolveJsonModule": true,
21
- "strict": true,
22
- "strictNullChecks": true,
23
- "strictPropertyInitialization": true,
24
- "stripInternal": true,
25
- "target": "ES2020"
26
- },
27
- "include": [
28
- "**/*.ts"
29
- ],
30
- "exclude": [
31
- "node_modules"
32
- ]
33
- }
@@ -1,21 +0,0 @@
1
- # This file contains the environment variables for the project.
2
- # Copy this file to .env and adjust the values as needed.
3
- # The variables are loaded when "cdk8s synth" is called.
4
-
5
- # Configure domain names
6
- DOMAIN_CACHED=plone.example.com
7
- DOMAIN_UNCACHED=plone-test.example.com
8
- DOMAIN_MAINTENANCE=plone-admin.example.com
9
-
10
- # Cluster issuer to use (cert-manager ClusterIssuer for TLS certificates)
11
- CLUSTER_ISSUER=letsencrypt-prod
12
-
13
- # Configure the Plone images to use
14
- # Leave commented to use defaults (official Plone images)
15
- #PLONE_FRONTEND_IMAGE=plone/plone-frontend:latest
16
- #PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
17
-
18
- # Configure database backend
19
- # Options: 'plain' (default, operator-free single instance) or
20
- # 'cloudnativepg' (production HA, requires the CloudNativePG operator)
21
- DATABASE=plain
@@ -1,292 +0,0 @@
1
- # Volto Example
2
-
3
- This example demonstrates a **production-ready Plone deployment** using the [@bluedynamics/cdk8s-plone](https://www.npmjs.com/package/@bluedynamics/cdk8s-plone) TypeScript package.
4
-
5
- ## Features
6
-
7
- This example includes:
8
-
9
- - **Plone 6.1 with Volto** (React frontend + REST API backend)
10
- - **PostgreSQL with RelStorage** - Choose between:
11
- - Plain single-instance PostgreSQL using the official `postgres` image (default, operator-free, for dev and small setups)
12
- - [CloudNativePG](https://cloudnative-pg.io/) (CNCF project, production-ready with HA)
13
- - **HTTP Caching with Varnish** - Using [kube-httpcache](https://github.com/mittwald/kube-httpcache)
14
- - **Ingress** - Supports both Traefik and Kong with TLS/cert-manager
15
- - **Three access domains**:
16
- - Cached (public, via Varnish)
17
- - Uncached (testing, direct to frontend)
18
- - Maintenance (backend API access)
19
-
20
- ## Prerequisites
21
-
22
- ### Node.js Setup
23
-
24
- Configure Node.js:
25
- ```bash
26
- nvm use lts/*
27
- ```
28
-
29
- Install dependencies:
30
- ```bash
31
- npm install
32
- ```
33
-
34
- ### Kubernetes Cluster Requirements
35
-
36
- Your cluster needs:
37
-
38
- 1. **PostgreSQL** (choose one):
39
- - **Plain** (default, no operator needed): the example deploys a single-instance PostgreSQL StatefulSet using the official `postgres` image, so there is nothing to install.
40
- - **CloudNativePG** (recommended for production HA): install the operator
41
- ```bash
42
- kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.24/releases/cnpg-1.24.0.yaml
43
- ```
44
-
45
- 2. **Ingress Controller** (choose one):
46
- - Traefik v3 with CRDs installed
47
- - Kong Gateway
48
-
49
- 3. **cert-manager** (for TLS certificates):
50
- ```bash
51
- kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.0/cert-manager.yaml
52
- ```
53
-
54
- 4. **kube-httpcache Operator** (for Varnish caching):
55
- ```bash
56
- kubectl apply -f https://github.com/mittwald/kube-httpcache/releases/latest/download/kube-httpcache.yaml
57
- ```
58
-
59
- ## Usage
60
-
61
- ### 1. Import CRDs
62
-
63
- Import the required Custom Resource Definitions:
64
-
65
- ```bash
66
- npm run import
67
- ```
68
-
69
- This will generate TypeScript bindings in `./imports/` for:
70
- - Kubernetes core API
71
- - Traefik IngressRoute CRDs
72
- - CloudNativePG Cluster CRDs
73
-
74
- ### 2. Configure Environment
75
-
76
- Create a `.env` file (copy from `.env.example`):
77
-
78
- ```bash
79
- # Domain names
80
- DOMAIN_CACHED=plone.example.com
81
- DOMAIN_UNCACHED=plone-test.example.com
82
- DOMAIN_MAINTENANCE=plone-admin.example.com
83
-
84
- # TLS certificate issuer (cert-manager ClusterIssuer)
85
- CLUSTER_ISSUER=letsencrypt-prod
86
-
87
- # Plone images (defaults to official images if not set)
88
- PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
89
- PLONE_FRONTEND_IMAGE=plone/plone-frontend:latest
90
-
91
- # Database backend: 'plain' (default) or 'cloudnativepg'
92
- DATABASE=plain
93
- ```
94
-
95
- ### 3. Generate Kubernetes Manifests
96
-
97
- ```bash
98
- npm run synth
99
- ```
100
-
101
- This generates `dist/plone-example.k8s.yaml` with all Kubernetes resources.
102
-
103
- ### 4. Deploy to Kubernetes
104
-
105
- ```bash
106
- kubectl apply -f dist/plone-example.k8s.yaml
107
- ```
108
-
109
- Or deploy to a specific namespace:
110
- ```bash
111
- kubectl apply -f dist/plone-example.k8s.yaml -n plone
112
- ```
113
-
114
- ## Database Options
115
-
116
- ### CloudNativePG (Production)
117
-
118
- **Pros:**
119
- - CNCF Sandbox project (Cloud Native Computing Foundation)
120
- - Built-in high availability (2 instances)
121
- - Automated backups and point-in-time recovery
122
- - Monitoring and observability
123
- - Connection pooling support
124
- - Modern, actively maintained
125
-
126
- **Configuration:**
127
- ```bash
128
- DATABASE=cloudnativepg
129
- ```
130
-
131
- **Secrets:** CloudNativePG automatically creates a secret `plone-postgresql-app` with:
132
- - `username` - Database user
133
- - `password` - Database password
134
-
135
- ### Plain PostgreSQL (default, operator-free)
136
-
137
- **Pros:**
138
- - No operator and no third-party Helm chart required
139
- - Uses the official `postgres` image, which is actively maintained
140
- - Single-instance StatefulSet with a PersistentVolumeClaim
141
- - Good for development and small production setups
142
-
143
- **Cons:**
144
- - No built-in high availability, failover, or automated backups
145
-
146
- **Configuration:**
147
- ```bash
148
- DATABASE=plain
149
- ```
150
-
151
- **Secrets:** the example creates a Secret with `username`, `password`, and `database` keys.
152
-
153
- ## Architecture
154
-
155
- ```
156
- ┌─────────────────┐
157
- │ cert-manager │
158
- │ (TLS Certs) │
159
- └────────┬────────┘
160
- │
161
- ┌──────────────────┐ ┌────▼────────────┐
162
- │ External │───▶│ Ingress │
163
- │ Traffic │ │ (Traefik/Kong) │
164
- └──────────────────┘ └────┬─────┬──────┘
165
- │ │
166
- ┌──────────────┘ └──────────────┐
167
- │ │
168
- ┌─────────▼─────────┐ ┌─────────▼─────────┐
169
- │ HTTP Cache │ │ Plone Frontend │
170
- │ (Varnish) │ │ (Volto/React) │
171
- └─────────┬─────────┘ └─────────┬─────────┘
172
- │ │
173
- └──────────────┬─────────────────────┘
174
- │
175
- ┌─────────▼─────────┐
176
- │ Plone Backend │
177
- │ (Python/Zope) │
178
- └─────────┬─────────┘
179
- │
180
- ┌─────────▼─────────┐
181
- │ PostgreSQL │
182
- │ (RelStorage) │
183
- └───────────────────┘
184
- ```
185
-
186
- ## Development
187
-
188
- ### Build and Test
189
-
190
- ```bash
191
- # Compile TypeScript
192
- npm run compile
193
-
194
- # Run tests
195
- npm test
196
-
197
- # Update test snapshots
198
- npm run test-update
199
-
200
- # Full build (compile + test + synth)
201
- npm run build
202
- ```
203
-
204
- ### Watch Mode
205
-
206
- ```bash
207
- npm run watch
208
- ```
209
-
210
- ## Customization
211
-
212
- ### Changing Plone Configuration
213
-
214
- Edit [main.ts](main.ts) to customize:
215
- - RelStorage settings (cache sizes, blob mode)
216
- - Resource limits
217
- - Environment variables
218
- - Number of replicas
219
-
220
- ### Modifying Varnish Caching
221
-
222
- Edit [config/varnish.tpl.vcl](config/varnish.tpl.vcl) to customize:
223
- - Cache rules
224
- - Request routing logic
225
- - Authentication handling
226
- - PURGE/BAN configurations
227
-
228
- ### Ingress Configuration
229
-
230
- Edit [ingress.ts](ingress.ts) to:
231
- - Add/modify domain routes
232
- - Change TLS settings
233
- - Customize path rewrites
234
- - Add middleware
235
-
236
- ## Troubleshooting
237
-
238
- ### Check Pod Status
239
-
240
- ```bash
241
- kubectl get pods -l app.kubernetes.io/part-of=plone
242
- ```
243
-
244
- ### View Logs
245
-
246
- ```bash
247
- # Backend logs
248
- kubectl logs -l app.kubernetes.io/name=plone-backend -f
249
-
250
- # Frontend logs
251
- kubectl logs -l app.kubernetes.io/name=plone-frontend -f
252
-
253
- # Varnish cache logs
254
- kubectl logs -l app.kubernetes.io/name=plone-httpcache -f
255
- ```
256
-
257
- ### Database Connection Issues
258
-
259
- **CloudNativePG:**
260
- ```bash
261
- # Check cluster status
262
- kubectl get cluster plone-postgresql
263
-
264
- # Check secret
265
- kubectl get secret plone-postgresql-app -o yaml
266
- ```
267
-
268
- **Plain PostgreSQL:**
269
- ```bash
270
- # Check the StatefulSet and pod
271
- kubectl get statefulset -l app.kubernetes.io/name=plone-postgresql
272
- kubectl get pods -l app.kubernetes.io/name=plone-postgresql
273
- ```
274
-
275
- ### Access Logs
276
-
277
- ```bash
278
- # Get all Plone-related resources
279
- kubectl get all -l app.kubernetes.io/part-of=plone
280
- ```
281
-
282
- ## References
283
-
284
- - [cdk8s-plone Documentation](https://bluedynamics.github.io/cdk8s-plone/)
285
- - [Plone 6 Documentation](https://6.docs.plone.org/)
286
- - [CloudNativePG Documentation](https://cloudnative-pg.io/documentation/)
287
- - [CDK8S Documentation](https://cdk8s.io/)
288
- - [Varnish Documentation](https://varnish-cache.org/docs/)
289
-
290
- ## License
291
-
292
- Apache-2.0