Skip to content

Commit

Permalink
feat: Cleanup and classicui (#21)
Browse files Browse the repository at this point in the history
 docs: added more usage information in README.md.
 feat: configurable Plone site ID
 feat: install ClassicUI only
  • Loading branch information
jensens authored Aug 13, 2024
1 parent 791e157 commit d1e7786
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 93 deletions.
57 changes: 56 additions & 1 deletion API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 76 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,70 @@
This chart provides a library to bootstrap a Plone deployment on a Kubernetes cluster using the [CDK8S](https://cdk8s.io) framework.

It provides
- backend (with `plone.volto` or Classic-UI)
- frontend (Plone-Volto, a ReactJS based user interface)
- varnish (optional)
- Backend (for API with `plone.volto` or as Classic-UI)
- Frontend (Plone-Volto, a ReactJS based user interface)
- Varnish using kube-httpcache. It includes a way to invalidate varnish cluster (optional)

## Installation

### Typescript

To use this library, create a new CDK8S project (or use an existing one)

```bash
cdk8s init typescript-app
```

Then add the following dependency to `package.json`:

```json
{
"dependencies": {
"@bluedynamics/cdk8s-plone": "*"
}
}
```

Run `npm install` to install the new dependency.

### Python

Todo: Document in details how to install.

```bash
cdk8s init python-app
```

Python package name is [cdk8s-plone](https://pypi.org/project/cdk8s-plone/).




## Usage

For now have a look at the [example project](https://github.com/bluedynamics/cdk8s-plone-example)..
With `cdk8s-cli` installed, create a new project:

```bash
cdk8s sythn
```

Add the following code to your `main.ts`:

```typescript
...
import { Plone } from '@bluedynamics/cdk8s-plone';
...
super(scope, id, props);

// define resources here
new Plone(this, 'Plone', {});
...
```

Run `npm run build ` to generate the Kubernetes manifests.
The manifests are stored in the `dist` directory.

For more have a look at the [example project](https://github.com/bluedynamics/cdk8s-plone-example).


## Development
Expand All @@ -26,28 +83,34 @@ Then run the following command to run the test:
npx projen test
```

### WIP Checklist:
### Feature Wishlist:

Each step need to be implemented with tests!

- [x] Support Variants for ClassicUI or Volto
- [ ] Start Backend
- [x] deployment
- [x] service
- [x] pdb
- [ ] init container running plone-site-create
- [ ] init container running `plone-site-create`
- [x] lifecycle checks (readiness, liveness)
- [x] generic way to inject sidecars
- [ ] metrics sidecar
- [ ] Start Frontend
- [x] deployment
- [x] service
- [x] pdb
- [x] lifecycle checks (readiness, liveness)
- [ ] depend on ready/live backend (needed?)
- [x] generic way to inject sidecars
- [ ] metrics sidecar
- [x] Start Varnish (using `kube-httpcache`) optional in separate chart
- [x] provide a default VCL for Volto with routing to backend and frontend
- [ ] provide a default VCL for ClassicUI
- [ ] Configure Ingress, optional in separate chart
- [ ] Traefik
- [ ] Konq

- [x] Start Varnish (using kube-httcache)

- [ ] Other Languages
- [x] Check Python distribution
- [ ] Check Java distribution
- [ ] Check Go distribution
- [ ] Release packages for other Languages
- [x] Python
- [ ] Golang
- [ ] Java
2 changes: 1 addition & 1 deletion src/config/varnish.tpl.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sub vcl_recv {
if (req.http.X-Forwarded-Proto) {
set req.http.x-vcl-proto = req.http.X-Forwarded-Proto;
}
set req.url = "/VirtualHostBase/" + req.http.x-vcl-proto + "/" + req.http.host + "/Plone/VirtualHostRoot" + req.url;
set req.url = "/VirtualHostBase/" + req.http.x-vcl-proto + "/" + req.http.host + "/{{ .Env.BACKEND_SITE_ID }}/VirtualHostRoot" + req.url;
} else {
set req.http.x-vcl-plone = "Frontend";
set req.backend_hint = lbPloneFrontend.backend();
Expand Down
1 change: 1 addition & 0 deletions src/httpcache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class PloneHttpcache extends Construct {
extraEnvVars: [
{ name: 'BACKEND_SERVICE_NAME', value: options.plone.backendServiceName },
{ name: 'BACKEND_SERVICE_PORT', value: '8080' },
{ name: 'BACKEND_SITE_ID', value: options.plone.siteId },
{ name: 'FRONTEND_SERVICE_NAME', value: options.plone.frontendServiceName },
{ name: 'FRONTEND_SERVICE_PORT', value: '3000' },
],
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { Plone, PloneOptions, PloneBaseOptions } from './plone';
export { Plone, PloneOptions, PloneBaseOptions, PloneVariant } from './plone';
export { PloneHttpcache, PloneHttpcacheOptions } from './httpcache';
Loading

0 comments on commit d1e7786

Please sign in to comment.