@bluedynamics/cdk8s-plone 0.1.9 → 0.1.11

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 (37) hide show
  1. package/.claude/claude.md +39 -0
  2. package/.claude/settings.local.json +31 -0
  3. package/.jsii +4 -4
  4. package/README.md +15 -2
  5. package/documentation/sources/how-to/deploy-classic-ui.md +322 -0
  6. package/documentation/sources/how-to/deploy-production-volto.md +319 -0
  7. package/documentation/sources/how-to/index.md +13 -0
  8. package/documentation/sources/reference/api/index.md +29 -0
  9. package/examples/classic-ui/.env.example +19 -0
  10. package/examples/classic-ui/README.md +343 -0
  11. package/examples/classic-ui/__snapshots__/main.test.ts.snap +1242 -0
  12. package/examples/classic-ui/cdk8s.yaml +6 -0
  13. package/examples/classic-ui/config/varnish.tpl.vcl +217 -0
  14. package/examples/classic-ui/ingress.ts +217 -0
  15. package/examples/classic-ui/jest.config.js +11 -0
  16. package/examples/classic-ui/main.test.ts +11 -0
  17. package/examples/classic-ui/main.ts +100 -0
  18. package/examples/classic-ui/package-lock.json +5719 -0
  19. package/examples/classic-ui/package.json +36 -0
  20. package/examples/classic-ui/postgres.bitnami.ts +49 -0
  21. package/examples/classic-ui/postgres.cloudnativepg.ts +63 -0
  22. package/examples/production-volto/.env.example +20 -0
  23. package/examples/production-volto/README.md +295 -0
  24. package/examples/production-volto/__snapshots__/main.test.ts.snap +1412 -0
  25. package/examples/production-volto/cdk8s.yaml +6 -0
  26. package/examples/production-volto/config/varnish.tpl.vcl +297 -0
  27. package/examples/production-volto/ingress.ts +229 -0
  28. package/examples/production-volto/jest.config.js +11 -0
  29. package/examples/production-volto/main.test.ts +11 -0
  30. package/examples/production-volto/main.ts +104 -0
  31. package/examples/production-volto/package-lock.json +5714 -0
  32. package/examples/production-volto/package.json +36 -0
  33. package/examples/production-volto/postgres.bitnami.ts +49 -0
  34. package/examples/production-volto/postgres.cloudnativepg.ts +63 -0
  35. package/lib/httpcache.js +1 -1
  36. package/lib/plone.js +1 -1
  37. package/package.json +3 -3
@@ -0,0 +1,343 @@
1
+ # Classic UI Example
2
+
3
+ This example demonstrates a **production-ready Plone Classic UI deployment** using the [@bluedynamics/cdk8s-plone](https://www.npmjs.com/package/@bluedynamics/cdk8s-plone) TypeScript package.
4
+
5
+ ## What is Plone Classic UI?
6
+
7
+ Plone Classic UI is the traditional server-side rendered interface for Plone CMS. Unlike Volto (which uses a separate React frontend), Classic UI is served directly from the Plone backend, providing:
8
+
9
+ - **Traditional server-side rendering** - All pages rendered by Plone/Zope
10
+ - **Simpler architecture** - Single backend service (no separate frontend)
11
+ - **Familiar interface** - Classic Plone user interface many users know
12
+ - **Full Plone features** - Complete access to all Plone functionality
13
+
14
+ **When to use Classic UI:**
15
+ - Migration from older Plone versions (maintaining familiar UX)
16
+ - Internal tools and intranets where modern UI isn't required
17
+ - Projects requiring specific Classic UI add-ons
18
+ - Environments where simpler deployment is preferred
19
+
20
+ **When to use Volto instead:** See the [production-volto](../production-volto/) example for modern React-based UI with better performance and UX.
21
+
22
+ ## Features
23
+
24
+ This example includes:
25
+
26
+ - **Plone 6.1 with Classic UI** (traditional server-side rendering)
27
+ - **PostgreSQL with RelStorage** - Choose between:
28
+ - [CloudNativePG](https://cloudnative-pg.io/) (CNCF project, production-ready with HA)
29
+ - [Bitnami PostgreSQL](https://github.com/bitnami/charts/tree/main/bitnami/postgresql) Helm chart (simple, for dev/testing)
30
+ - **HTTP Caching with Varnish** - Using [kube-httpcache](https://github.com/mittwald/kube-httpcache)
31
+ - **Ingress** - Supports both Traefik and Kong with TLS/cert-manager
32
+ - **Three access domains**:
33
+ - Cached (public, via Varnish)
34
+ - Uncached (testing, direct to backend)
35
+ - Maintenance (backend access with virtual hosting)
36
+
37
+ ## Prerequisites
38
+
39
+ ### Node.js Setup
40
+
41
+ Configure Node.js:
42
+ ```bash
43
+ nvm use lts/*
44
+ ```
45
+
46
+ Install dependencies:
47
+ ```bash
48
+ npm install
49
+ ```
50
+
51
+ ### Kubernetes Cluster Requirements
52
+
53
+ Your cluster needs:
54
+
55
+ 1. **PostgreSQL Operator** (choose one):
56
+ - **CloudNativePG** (recommended for production):
57
+ ```bash
58
+ kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.24/releases/cnpg-1.24.0.yaml
59
+ ```
60
+ - **Bitnami** (no operator needed, uses Helm):
61
+ - Requires namespace `plone` to exist: `kubectl create namespace plone`
62
+
63
+ 2. **Ingress Controller** (choose one):
64
+ - Traefik v3 with CRDs installed
65
+ - Kong Gateway
66
+
67
+ 3. **cert-manager** (for TLS certificates):
68
+ ```bash
69
+ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.0/cert-manager.yaml
70
+ ```
71
+
72
+ 4. **kube-httpcache Operator** (for Varnish caching):
73
+ ```bash
74
+ kubectl apply -f https://github.com/mittwald/kube-httpcache/releases/latest/download/kube-httpcache.yaml
75
+ ```
76
+
77
+ ## Usage
78
+
79
+ ### 1. Import CRDs
80
+
81
+ Import the required Custom Resource Definitions:
82
+
83
+ ```bash
84
+ npm run import
85
+ ```
86
+
87
+ This will generate TypeScript bindings in `./imports/` for:
88
+ - Kubernetes core API
89
+ - Traefik IngressRoute CRDs
90
+ - CloudNativePG Cluster CRDs
91
+
92
+ ### 2. Configure Environment
93
+
94
+ Create a `.env` file (copy from `.env.example`):
95
+
96
+ ```bash
97
+ # Domain names
98
+ DOMAIN_CACHED=plone.example.com
99
+ DOMAIN_UNCACHED=plone-test.example.com
100
+ DOMAIN_MAINTENANCE=plone-admin.example.com
101
+
102
+ # TLS certificate issuer (cert-manager ClusterIssuer)
103
+ CLUSTER_ISSUER=letsencrypt-prod
104
+
105
+ # Plone backend image (defaults to official image if not set)
106
+ PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
107
+
108
+ # Database backend: 'bitnami' (default) or 'cloudnativepg'
109
+ DATABASE=cloudnativepg
110
+ ```
111
+
112
+ ### 3. Generate Kubernetes Manifests
113
+
114
+ ```bash
115
+ npm run synth
116
+ ```
117
+
118
+ This generates `dist/plone-classic.k8s.yaml` with all Kubernetes resources.
119
+
120
+ ### 4. Deploy to Kubernetes
121
+
122
+ ```bash
123
+ kubectl apply -f dist/plone-classic.k8s.yaml
124
+ ```
125
+
126
+ Or deploy to a specific namespace:
127
+ ```bash
128
+ kubectl apply -f dist/plone-classic.k8s.yaml -n plone
129
+ ```
130
+
131
+ ## Classic UI vs Volto
132
+
133
+ | Feature | Classic UI | Volto |
134
+ |---------|-----------|-------|
135
+ | **Architecture** | Single backend service | Separate frontend + backend |
136
+ | **Rendering** | Server-side (Zope) | Client-side (React) |
137
+ | **Performance** | Good with caching | Excellent (SPA) |
138
+ | **UX** | Traditional | Modern |
139
+ | **Deployment** | Simpler | More complex |
140
+ | **Add-ons** | Full classic support | Volto-specific needed |
141
+ | **Best for** | Migrations, intranets | New projects, public sites |
142
+
143
+ ## Architecture
144
+
145
+ ```
146
+ ┌─────────────────┐
147
+ │ cert-manager │
148
+ │ (TLS Certs) │
149
+ └────────┬────────┘
150
+
151
+ ┌──────────────────┐ ┌────▼────────────┐
152
+ │ External │───▶│ Ingress │
153
+ │ Traffic │ │ (Traefik/Kong) │
154
+ └──────────────────┘ └────┬─────┬──────┘
155
+ │ │
156
+ ┌──────────────┘ └──────────────┐
157
+ │ │
158
+ ┌─────────▼─────────┐ ┌─────────▼─────────┐
159
+ │ HTTP Cache │ │ Plone Backend │
160
+ │ (Varnish) │ │ (Classic UI) │
161
+ └─────────┬─────────┘ │ │
162
+ │ └─────────┬─────────┘
163
+ │ │
164
+ └──────────────┬───────────────────┘
165
+
166
+ ┌─────────▼─────────┐
167
+ │ PostgreSQL │
168
+ │ (RelStorage) │
169
+ └───────────────────┘
170
+ ```
171
+
172
+ ## Database Options
173
+
174
+ ### CloudNativePG (Production)
175
+
176
+ **Pros:**
177
+ - CNCF Sandbox project (Cloud Native Computing Foundation)
178
+ - Built-in high availability (2 instances)
179
+ - Automated backups and point-in-time recovery
180
+ - Monitoring and observability
181
+ - Connection pooling support
182
+ - Modern, actively maintained
183
+
184
+ **Configuration:**
185
+ ```bash
186
+ DATABASE=cloudnativepg
187
+ ```
188
+
189
+ ### Bitnami PostgreSQL (Development/Testing)
190
+
191
+ **Pros:**
192
+ - No operator required
193
+ - Simple setup
194
+ - Good for development and testing
195
+ - Helm-based deployment
196
+
197
+ **Cons:**
198
+ - Requires namespace `plone` to be pre-created
199
+ - No built-in HA features
200
+ - Less suitable for production
201
+
202
+ **Configuration:**
203
+ ```bash
204
+ DATABASE=bitnami
205
+ ```
206
+
207
+ ## Development
208
+
209
+ ### Build and Test
210
+
211
+ ```bash
212
+ # Compile TypeScript
213
+ npm run compile
214
+
215
+ # Run tests
216
+ npm test
217
+
218
+ # Update test snapshots
219
+ npm run test-update
220
+
221
+ # Full build (compile + test + synth)
222
+ npm run build
223
+ ```
224
+
225
+ ### Watch Mode
226
+
227
+ ```bash
228
+ npm run watch
229
+ ```
230
+
231
+ ## Customization
232
+
233
+ ### Changing Plone Configuration
234
+
235
+ Edit [main.ts](main.ts) to customize:
236
+ - RelStorage settings (cache sizes, blob mode)
237
+ - Resource limits
238
+ - Environment variables
239
+ - Number of replicas
240
+
241
+ ### Modifying Varnish Caching
242
+
243
+ Edit [config/varnish.tpl.vcl](config/varnish.tpl.vcl) to customize:
244
+ - Cache rules
245
+ - Authentication handling
246
+ - PURGE/BAN configurations
247
+
248
+ ### Ingress Configuration
249
+
250
+ Edit [ingress.ts](ingress.ts) to:
251
+ - Add/modify domain routes
252
+ - Change TLS settings
253
+ - Customize path rewrites
254
+ - Add middleware
255
+
256
+ ## Accessing Your Plone Site
257
+
258
+ After deployment, you can access your Plone Classic UI site at:
259
+
260
+ - **Cached (public)**: https://plone.example.com (via Varnish)
261
+ - **Uncached (testing)**: https://plone-test.example.com (direct to backend)
262
+ - **Maintenance**: https://plone-admin.example.com (backend access)
263
+
264
+ ### Creating a Plone Site
265
+
266
+ On first access, you'll need to create a Plone site:
267
+
268
+ 1. Access the maintenance domain: https://plone-admin.example.com
269
+ 2. Click "Create a new Plone site"
270
+ 3. Fill in the form:
271
+ - **Site ID**: Plone (default)
272
+ - **Title**: Your Site Title
273
+ - **Language**: Choose your language
274
+ - **Add-ons**: Select any add-ons you need
275
+ 4. Click "Create Plone Site"
276
+
277
+ ## Troubleshooting
278
+
279
+ ### Check Pod Status
280
+
281
+ ```bash
282
+ kubectl get pods -l app.kubernetes.io/part-of=plone
283
+ ```
284
+
285
+ ### View Logs
286
+
287
+ ```bash
288
+ # Backend logs
289
+ kubectl logs -l app.kubernetes.io/name=plone-backend -f
290
+
291
+ # Varnish cache logs
292
+ kubectl logs -l app.kubernetes.io/name=plone-httpcache -f
293
+ ```
294
+
295
+ ### Database Connection Issues
296
+
297
+ **CloudNativePG:**
298
+ ```bash
299
+ # Check cluster status
300
+ kubectl get cluster
301
+
302
+ # Check secret
303
+ kubectl get secret -l cnpg.io/cluster
304
+ ```
305
+
306
+ **Bitnami:**
307
+ ```bash
308
+ # Check service
309
+ kubectl get svc -l app.kubernetes.io/part-of=plone
310
+
311
+ # Check secret
312
+ kubectl get secret -l app.kubernetes.io/part-of=plone
313
+ ```
314
+
315
+ ### Access Logs
316
+
317
+ ```bash
318
+ # Get all Plone-related resources
319
+ kubectl get all -l app.kubernetes.io/part-of=plone
320
+ ```
321
+
322
+ ## Migrating from Classic UI to Volto
323
+
324
+ If you later want to migrate to Volto:
325
+
326
+ 1. See the [production-volto](../production-volto/) example
327
+ 2. Keep the same backend configuration (database, caching)
328
+ 3. Add Volto frontend deployment
329
+ 4. Update ingress to route to frontend
330
+ 5. Both UIs can run simultaneously during migration
331
+
332
+ ## References
333
+
334
+ - [cdk8s-plone Documentation](https://bluedynamics.github.io/cdk8s-plone/)
335
+ - [Plone 6 Documentation](https://6.docs.plone.org/)
336
+ - [Plone Classic UI Guide](https://6.docs.plone.org/classic-ui/)
337
+ - [CloudNativePG Documentation](https://cloudnative-pg.io/documentation/)
338
+ - [CDK8S Documentation](https://cdk8s.io/)
339
+ - [Varnish Documentation](https://varnish-cache.org/docs/)
340
+
341
+ ## License
342
+
343
+ Apache-2.0