@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.
- package/.claude/claude.md +39 -0
- package/.claude/settings.local.json +31 -0
- package/.jsii +4 -4
- package/README.md +15 -2
- package/documentation/sources/how-to/deploy-classic-ui.md +322 -0
- package/documentation/sources/how-to/deploy-production-volto.md +319 -0
- package/documentation/sources/how-to/index.md +13 -0
- package/documentation/sources/reference/api/index.md +29 -0
- package/examples/classic-ui/.env.example +19 -0
- package/examples/classic-ui/README.md +343 -0
- package/examples/classic-ui/__snapshots__/main.test.ts.snap +1242 -0
- package/examples/classic-ui/cdk8s.yaml +6 -0
- package/examples/classic-ui/config/varnish.tpl.vcl +217 -0
- package/examples/classic-ui/ingress.ts +217 -0
- package/examples/classic-ui/jest.config.js +11 -0
- package/examples/classic-ui/main.test.ts +11 -0
- package/examples/classic-ui/main.ts +100 -0
- package/examples/classic-ui/package-lock.json +5719 -0
- package/examples/classic-ui/package.json +36 -0
- package/examples/classic-ui/postgres.bitnami.ts +49 -0
- package/examples/classic-ui/postgres.cloudnativepg.ts +63 -0
- package/examples/production-volto/.env.example +20 -0
- package/examples/production-volto/README.md +295 -0
- package/examples/production-volto/__snapshots__/main.test.ts.snap +1412 -0
- package/examples/production-volto/cdk8s.yaml +6 -0
- package/examples/production-volto/config/varnish.tpl.vcl +297 -0
- package/examples/production-volto/ingress.ts +229 -0
- package/examples/production-volto/jest.config.js +11 -0
- package/examples/production-volto/main.test.ts +11 -0
- package/examples/production-volto/main.ts +104 -0
- package/examples/production-volto/package-lock.json +5714 -0
- package/examples/production-volto/package.json +36 -0
- package/examples/production-volto/postgres.bitnami.ts +49 -0
- package/examples/production-volto/postgres.cloudnativepg.ts +63 -0
- package/lib/httpcache.js +1 -1
- package/lib/plone.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Deploy Production Volto Example
|
|
2
|
+
|
|
3
|
+
This guide shows you how to deploy the production-ready Volto example to your Kubernetes cluster.
|
|
4
|
+
|
|
5
|
+
## What You'll Deploy
|
|
6
|
+
|
|
7
|
+
The [Production Volto example](https://github.com/bluedynamics/cdk8s-plone/tree/main/examples/production-volto) includes:
|
|
8
|
+
|
|
9
|
+
- **Plone 6.1 with Volto** (React frontend + REST API backend)
|
|
10
|
+
- **PostgreSQL** with RelStorage (CloudNativePG or Bitnami)
|
|
11
|
+
- **Varnish HTTP caching** with kube-httpcache
|
|
12
|
+
- **Ingress** with TLS (Traefik or Kong)
|
|
13
|
+
- **Three access domains** (cached, uncached, maintenance)
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
### Required
|
|
18
|
+
|
|
19
|
+
Ensure you have these installed on your cluster:
|
|
20
|
+
|
|
21
|
+
1. **Ingress Controller** - Either:
|
|
22
|
+
- [Traefik v3](https://doc.traefik.io/traefik/getting-started/install-traefik/) with CRDs
|
|
23
|
+
- [Kong Gateway](https://docs.konghq.com/gateway/latest/install/kubernetes/)
|
|
24
|
+
|
|
25
|
+
2. **cert-manager** - For TLS certificates:
|
|
26
|
+
```bash
|
|
27
|
+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.0/cert-manager.yaml
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. **kube-httpcache Operator** - For Varnish caching:
|
|
31
|
+
```bash
|
|
32
|
+
kubectl apply -f https://github.com/mittwald/kube-httpcache/releases/latest/download/kube-httpcache.yaml
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
4. **PostgreSQL Operator** - Choose one:
|
|
36
|
+
|
|
37
|
+
**Option A: CloudNativePG** (recommended for production):
|
|
38
|
+
```bash
|
|
39
|
+
kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.24/releases/cnpg-1.24.0.yaml
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Option B: Bitnami** (simpler for testing):
|
|
43
|
+
```bash
|
|
44
|
+
kubectl create namespace plone
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Local Tools
|
|
48
|
+
|
|
49
|
+
- **Node.js 18+** and npm
|
|
50
|
+
- **kubectl** configured for your cluster
|
|
51
|
+
- **git** to clone the repository
|
|
52
|
+
|
|
53
|
+
## Step 1: Get the Example
|
|
54
|
+
|
|
55
|
+
Clone the repository and navigate to the example:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/bluedynamics/cdk8s-plone.git
|
|
59
|
+
cd cdk8s-plone/examples/production-volto
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Step 2: Install Dependencies
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Step 3: Import CRDs
|
|
69
|
+
|
|
70
|
+
Generate TypeScript bindings for Kubernetes CRDs:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run import
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This imports:
|
|
77
|
+
- Kubernetes core API
|
|
78
|
+
- CloudNativePG Cluster CRDs
|
|
79
|
+
- Traefik Middleware CRDs
|
|
80
|
+
|
|
81
|
+
## Step 4: Configure Environment
|
|
82
|
+
|
|
83
|
+
Create a `.env` file from the example:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cp .env.example .env
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Edit `.env` with your settings:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Your domains
|
|
93
|
+
DOMAIN_CACHED=plone.example.com
|
|
94
|
+
DOMAIN_UNCACHED=plone-test.example.com
|
|
95
|
+
DOMAIN_MAINTENANCE=plone-admin.example.com
|
|
96
|
+
|
|
97
|
+
# Your cert-manager ClusterIssuer
|
|
98
|
+
CLUSTER_ISSUER=letsencrypt-prod
|
|
99
|
+
|
|
100
|
+
# Optional: Custom images
|
|
101
|
+
#PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
|
|
102
|
+
#PLONE_FRONTEND_IMAGE=plone/plone-frontend:latest
|
|
103
|
+
|
|
104
|
+
# Database: 'bitnami' or 'cloudnativepg'
|
|
105
|
+
DATABASE=cloudnativepg
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
:::{tip}
|
|
109
|
+
For production, use `cloudnativepg` for high availability. For testing, `bitnami` is simpler.
|
|
110
|
+
:::
|
|
111
|
+
|
|
112
|
+
## Step 5: Generate Manifests
|
|
113
|
+
|
|
114
|
+
Synthesize Kubernetes YAML:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm run synth
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This creates `dist/plone-example.k8s.yaml` with all resources.
|
|
121
|
+
|
|
122
|
+
## Step 6: Review Generated Manifests
|
|
123
|
+
|
|
124
|
+
Inspect what will be deployed:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Count resources
|
|
128
|
+
grep "^kind:" dist/plone-example.k8s.yaml | sort | uniq -c
|
|
129
|
+
|
|
130
|
+
# View specific resources
|
|
131
|
+
kubectl apply --dry-run=client -f dist/plone-example.k8s.yaml
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Step 7: Deploy to Kubernetes
|
|
135
|
+
|
|
136
|
+
Deploy to your cluster:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
kubectl apply -f dist/plone-example.k8s.yaml
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Or deploy to a specific namespace:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
kubectl apply -f dist/plone-example.k8s.yaml -n plone
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Step 8: Monitor Deployment
|
|
149
|
+
|
|
150
|
+
Watch pods starting:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Watch all pods
|
|
154
|
+
kubectl get pods -l app.kubernetes.io/part-of=plone -w
|
|
155
|
+
|
|
156
|
+
# Check specific components
|
|
157
|
+
kubectl get pods -l app.kubernetes.io/name=plone-backend
|
|
158
|
+
kubectl get pods -l app.kubernetes.io/name=plone-frontend
|
|
159
|
+
kubectl get pods -l app.kubernetes.io/name=plone-httpcache
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Wait for all pods to be `Running`:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
kubectl wait --for=condition=ready pod -l app.kubernetes.io/part-of=plone --timeout=300s
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Step 9: Verify Services
|
|
169
|
+
|
|
170
|
+
Check that services are created:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
kubectl get svc -l app.kubernetes.io/part-of=plone
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
You should see:
|
|
177
|
+
- `plone-backend` (backend service)
|
|
178
|
+
- `plone-frontend` (frontend service)
|
|
179
|
+
- `plone-httpcache` (Varnish cache)
|
|
180
|
+
- Database service (Bitnami or CloudNativePG)
|
|
181
|
+
|
|
182
|
+
## Step 10: Check Ingress
|
|
183
|
+
|
|
184
|
+
Verify ingress routes:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
kubectl get ingress
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Check TLS certificates:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
kubectl get certificate
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Step 11: Access Your Site
|
|
197
|
+
|
|
198
|
+
Once DNS is configured and TLS certificates are issued:
|
|
199
|
+
|
|
200
|
+
- **Public site (cached)**: https://plone.example.com
|
|
201
|
+
- **Testing (uncached)**: https://plone-test.example.com
|
|
202
|
+
- **Maintenance**: https://plone-admin.example.com
|
|
203
|
+
|
|
204
|
+
### Create Plone Site
|
|
205
|
+
|
|
206
|
+
On first access to the maintenance domain:
|
|
207
|
+
|
|
208
|
+
1. Go to: https://plone-admin.example.com
|
|
209
|
+
2. Click "Create a new Plone site"
|
|
210
|
+
3. Fill in:
|
|
211
|
+
- **Site ID**: `Plone`
|
|
212
|
+
- **Title**: Your site title
|
|
213
|
+
- **Language**: Choose language
|
|
214
|
+
4. Click "Create Plone Site"
|
|
215
|
+
|
|
216
|
+
## Troubleshooting
|
|
217
|
+
|
|
218
|
+
### Pods Not Starting
|
|
219
|
+
|
|
220
|
+
Check pod logs:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Backend logs
|
|
224
|
+
kubectl logs -l app.kubernetes.io/name=plone-backend -f
|
|
225
|
+
|
|
226
|
+
# Frontend logs
|
|
227
|
+
kubectl logs -l app.kubernetes.io/name=plone-frontend -f
|
|
228
|
+
|
|
229
|
+
# Database logs (CloudNativePG)
|
|
230
|
+
kubectl logs -l postgresql=plone-postgresql -f
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Database Connection Issues
|
|
234
|
+
|
|
235
|
+
**CloudNativePG:**
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Check cluster status
|
|
239
|
+
kubectl get cluster
|
|
240
|
+
|
|
241
|
+
# Check secret
|
|
242
|
+
kubectl get secret -l cnpg.io/cluster
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Bitnami:**
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Check service
|
|
249
|
+
kubectl get svc -l app.kubernetes.io/name=postgresql
|
|
250
|
+
|
|
251
|
+
# Check secret
|
|
252
|
+
kubectl describe secret <postgresql-secret-name>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### TLS Certificate Issues
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Check certificate status
|
|
259
|
+
kubectl describe certificate
|
|
260
|
+
|
|
261
|
+
# Check cert-manager logs
|
|
262
|
+
kubectl logs -n cert-manager deployment/cert-manager
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Varnish Cache Not Working
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Check httpcache logs
|
|
269
|
+
kubectl logs -l app.kubernetes.io/name=plone-httpcache
|
|
270
|
+
|
|
271
|
+
# Check if kube-httpcache operator is running
|
|
272
|
+
kubectl get pods -n kube-httpcache-system
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Updating Your Deployment
|
|
276
|
+
|
|
277
|
+
After making changes to the example:
|
|
278
|
+
|
|
279
|
+
1. Edit configuration files
|
|
280
|
+
2. Regenerate manifests: `npm run synth`
|
|
281
|
+
3. Apply changes: `kubectl apply -f dist/plone-example.k8s.yaml`
|
|
282
|
+
|
|
283
|
+
## Scaling
|
|
284
|
+
|
|
285
|
+
Scale replicas by editing `main.ts`:
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const plone = new Plone(this, 'plone', {
|
|
289
|
+
backend: {
|
|
290
|
+
replicas: 3, // Scale backend
|
|
291
|
+
},
|
|
292
|
+
frontend: {
|
|
293
|
+
replicas: 3, // Scale frontend
|
|
294
|
+
},
|
|
295
|
+
})
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Then regenerate and reapply.
|
|
299
|
+
|
|
300
|
+
## Cleanup
|
|
301
|
+
|
|
302
|
+
Remove all resources:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
kubectl delete -f dist/plone-example.k8s.yaml
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Next Steps
|
|
309
|
+
|
|
310
|
+
- Configure [monitoring and metrics](../reference/configuration-options.md#monitoring)
|
|
311
|
+
- Set up [backups](../explanation/features.md#database-integration) for CloudNativePG
|
|
312
|
+
- Customize [Varnish caching rules](https://github.com/bluedynamics/cdk8s-plone/blob/main/examples/production-volto/config/varnish.tpl.vcl)
|
|
313
|
+
- Review [security best practices](../explanation/architecture.md#security)
|
|
314
|
+
|
|
315
|
+
## See Also
|
|
316
|
+
|
|
317
|
+
- [Deploy Classic UI Example](deploy-classic-ui.md) - For traditional Plone interface
|
|
318
|
+
- [Setup Prerequisites](setup-prerequisites.md) - Detailed cluster setup
|
|
319
|
+
- [Configuration Options](../reference/configuration-options.md) - API reference
|
|
@@ -21,6 +21,19 @@ titlesonly: true
|
|
|
21
21
|
setup-prerequisites
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Deployment
|
|
25
|
+
|
|
26
|
+
**Deploy complete Plone examples to your Kubernetes cluster:**
|
|
27
|
+
|
|
28
|
+
```{toctree}
|
|
29
|
+
---
|
|
30
|
+
maxdepth: 1
|
|
31
|
+
titlesonly: true
|
|
32
|
+
---
|
|
33
|
+
deploy-production-volto
|
|
34
|
+
deploy-classic-ui
|
|
35
|
+
```
|
|
36
|
+
|
|
24
37
|
## Configuration
|
|
25
38
|
|
|
26
39
|
```{toctree}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Complete API reference for cdk8s-plone constructs, generated from TypeScript source code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The cdk8s-plone library provides the following main constructs:
|
|
8
|
+
|
|
9
|
+
- **Plone**: Main construct for deploying Plone CMS with support for both Volto (React frontend) and Classic UI variants
|
|
10
|
+
- **PloneHttpcache**: HTTP caching layer using Varnish for improved performance
|
|
11
|
+
|
|
12
|
+
## Language Support
|
|
13
|
+
|
|
14
|
+
This API documentation shows TypeScript usage examples. The library is also available for Python via JSII transpilation:
|
|
15
|
+
|
|
16
|
+
- **TypeScript/JavaScript**: [`@bluedynamics/cdk8s-plone`](https://www.npmjs.com/package/@bluedynamics/cdk8s-plone) on npm
|
|
17
|
+
- **Python**: [`cdk8s-plone`](https://pypi.org/project/cdk8s-plone/) on PyPI
|
|
18
|
+
|
|
19
|
+
For Python-specific usage, the API remains the same but follows Python naming conventions (snake_case instead of camelCase).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
```{include} ../../../../API.md
|
|
24
|
+
:relative-docs: ../../../../
|
|
25
|
+
:relative-images:
|
|
26
|
+
:start-line: 2
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
*This API reference is automatically generated from the TypeScript source code. For the latest version, run `npx projen docgen` in the project root.*
|
|
@@ -0,0 +1,19 @@
|
|
|
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 backend image
|
|
14
|
+
# Leave commented to use default (official Plone image)
|
|
15
|
+
#PLONE_BACKEND_IMAGE=plone/plone-backend:6.1.3
|
|
16
|
+
|
|
17
|
+
# Configure database backend
|
|
18
|
+
# Options: 'bitnami' (default, simple) or 'cloudnativepg' (production-ready)
|
|
19
|
+
DATABASE=cloudnativepg
|