Skip to content

Commit 3e2422a

Browse files
authored
Refactor variables
1 parent 80879c7 commit 3e2422a

File tree

1 file changed

+74
-104
lines changed

1 file changed

+74
-104
lines changed

docs/install/containers/images/backend.md

Lines changed: 74 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ html_meta:
88

99
# `plone/plone-backend`
1010

11-
Plone backend [Docker](https://www.docker.com/) images using Python 3 and [pip](https://pip.pypa.io/en/stable/).
11+
Plone backend [Docker](https://www.docker.com/) images using Python 3 and [pip](https://pip.pypa.io/en/stable/) built on .
1212

1313

1414
## Using this image
@@ -46,7 +46,14 @@ We encourage users of the `Plone` images to familiarize themselves with the opti
4646
| `DEFAULT_ZPUBLISHER_ENCODING` | `default-zpublisher-encoding` | `utf-8` |
4747

4848

49-
### Site creation
49+
### Site creation variables
50+
51+
| Environment variable | Description |
52+
| --- | --- |
53+
| `SITE` | Id of the site to be created, for example, `Plone` |
54+
| `TYPE` | Type of the site, either `classic` or `volto`. Default: `volto` |
55+
| `PROFILES` | Initialize site with additional profiles, for example, `eea.api.layout:default` |
56+
| `DELETE_EXISTING` | Force site to be recreated if it already exists, for example, `true` |
5057

5158
It is possible to initialize your database with a Plone Site instance on its first run.
5259
To do so, pass the `SITE` environment variable with the name of the Plone Site instance, for example, `SITE=Plone`.
@@ -67,21 +74,30 @@ Plone 6 Classic example:
6774
docker run -p 8080:8080 -e ADDONS="eea.facetednavigation" -e SITE="Plone" -e TYPE="classic" -e PROFILES="eea.facetednavigation:default" plone/plone-backend:6.0.0a4
6875
```
6976

70-
| Environment variable | Description |
71-
| --- | --- |
72-
| `SITE` | Id of the site to be created, for example, `Plone` |
73-
| `TYPE` | Type of the site, either `classic` or `volto`. Default: `volto` |
74-
| `PROFILES` | Initialize site with additional profiles, for example, `eea.api.layout:default` |
75-
| `DELETE_EXISTING` | Force site to be recreated if it already exists, for example, `true` |
76-
7777
```{warning}
7878
We advise against using this feature on production environments.
7979
```
8080

81+
### ZOPE variables
82+
83+
| Environment variable | Description | Default value |
84+
| --- | --- | --- | --- |
85+
| `ZODB_CACHE_SIZE` | database cache size | `50000` |
86+
87+
88+
### ZEO variables
8189

82-
### ZEO
90+
| Environment variable | Description | ZEO option | Default value |
91+
| --- | --- | --- | --- |
92+
| `ZEO_ADDRESS` | URL of the zeo interface, `host:port` | | |
93+
| `ZEO_SHARED_BLOB_DIR` | ZEO option |`name` | `off` |
94+
| `ZEO_READ_ONLY` | ZEO option |`read-only` | `false` |
95+
| `ZEO_CLIENT_READ_ONLY_FALLBACK` | ZEO option |`read-only-fallback` | `false` |
96+
| `ZEO_STORAGE` | ZEO option |`storage` | `1` |
97+
| `ZEO_CLIENT_CACHE_SIZE` | ZEO option | `cache-size` | `128MB` |
98+
| `ZEO_DROP_CACHE_RATHER_VERIFY` | ZEO option | `drop-cache-rather-verify` | `false` |
8399

84-
To use a ZEO database, you need to pass the `ZEO_ADDRESS` to the image:
100+
#### Example
85101

86102
```yaml
87103
version: "3"
@@ -109,26 +125,44 @@ volumes:
109125
data: {}
110126
```
111127
112-
The following is a list of supported environment variables for ZEO:
113128
114-
| Environment variable | ZEO option | Default value |
115-
| --- | --- | --- |
116-
| `ZEO_SHARED_BLOB_DIR` | `name` | `off` |
117-
| `ZEO_READ_ONLY` | `read-only` | `false` |
118-
| `ZEO_CLIENT_READ_ONLY_FALLBACK` | `read-only-fallback` | `false` |
119-
| `ZEO_STORAGE` | `storage` | `1` |
120-
| `ZEO_CLIENT_CACHE_SIZE` | `cache-size` | `128MB` |
121-
| `ZEO_DROP_CACHE_RATHER_VERIFY` | `drop-cache-rather-verify` | `false` |
129+
### Relational Database variables
130+
122131
132+
| Environment variable | Description | RelStorage option | Default value |
133+
| --- | --- | --- | --- |
134+
| `RELSTORAGE_DSN` | [PostgreSQL DSN](#postgresql-dsn) for the database interface | | |
135+
| `RELSTORAGE_NAME` | RelStorage option | `name` | `storage` |
136+
| `RELSTORAGE_READ_ONLY` | RelStorage option | `read-only` | `off` |
137+
| `RELSTORAGE_KEEP_HISTORY` | RelStorage option | `keep-history` | `true` |
138+
| `RELSTORAGE_COMMIT_LOCK_TIMEOUT` | RelStorage option | `commit-lock-timeout` | `30` |
139+
| `RELSTORAGE_CREATE_SCHEMA` | RelStorage option | `create-schema` | `true` |
140+
| `RELSTORAGE_SHARED_BLOB_DIR` | RelStorage option | `shared-blob-dir` | `false` |
141+
| `RELSTORAGE_BLOB_CACHE_SIZE` | RelStorage option | `blob-cache-size` | `100mb` |
142+
| `RELSTORAGE_BLOB_CACHE_SIZE_CHECK` | RelStorage option | `blob-cache-size-check` | `10` |
143+
| `RELSTORAGE_BLOB_CACHE_SIZE_CHECK_EXTERNAL` | RelStorage option | `blob-cache-size-check-external` | `false` |
144+
| `RELSTORAGE_BLOB_CHUNK_SIZE` | RelStorage option | `blob-chunk-size` | `1048576` |
145+
| `RELSTORAGE_CACHE_LOCAL_MB` | RelStorage option | `cache-local-mb` | `10` |
146+
| `RELSTORAGE_CACHE_LOCAL_OBJECT_MAX` | RelStorage option | `cache-local-object-max` | `16384` |
147+
| `RELSTORAGE_CACHE_LOCAL_COMPRESSION` | RelStorage option | `cache-local-compression` | `none` |
148+
| `RELSTORAGE_CACHE_DELTA_SIZE_LIMIT` | RelStorage option | `cache-delta-size-limit` | `100000` |
123149

124-
### Relational Database
125150

126151
```{note}
127152
Currently this image supports only the configuration of a PostgreSQL backend via configuration variables.
128153
If you need to use MySQL or Oracle, we recommend that you extend this image and overwrite the `/app/etc/relstorage.conf` file.
129154
```
130155

131-
To use a PostgreSQL database, you need to pass the `RELSTORAGE_DSN` to the image:
156+
#### PostgreSQL DSN
157+
158+
A valid PostgreSQL DSN is a list of parameters separated with whitespace.
159+
A typical DSN looks like the following:
160+
161+
```console
162+
dbname='zodb' user='username' host='localhost' password='pass'
163+
```
164+
165+
#### Example
132166

133167
```yaml
134168
version: "3"
@@ -154,34 +188,7 @@ services:
154188

155189
```
156190

157-
A valid PostgreSQL DSN is a list of parameters separated with whitespace.
158-
A typical DSN looks like the following.
159-
160-
```console
161-
dbname='zodb' user='username' host='localhost' password='pass'
162-
```
163-
164-
The following is a list of supported environment variables for Relstorage:
165-
166-
| Environment variable | RelStorage option | Default value |
167-
| --- | --- | --- |
168-
| `RELSTORAGE_NAME` | `name` | `storage` |
169-
| `RELSTORAGE_READ_ONLY` | `read-only` | `off` |
170-
| `RELSTORAGE_KEEP_HISTORY` | `keep-history` | `true` |
171-
| `RELSTORAGE_COMMIT_LOCK_TIMEOUT` | `commit-lock-timeout` | `30` |
172-
| `RELSTORAGE_CREATE_SCHEMA` | `create-schema` | `true` |
173-
| `RELSTORAGE_SHARED_BLOB_DIR` | `shared-blob-dir` | `false` |
174-
| `RELSTORAGE_BLOB_CACHE_SIZE` | `blob-cache-size` | `100mb` |
175-
| `RELSTORAGE_BLOB_CACHE_SIZE_CHECK` | `blob-cache-size-check` | `10` |
176-
| `RELSTORAGE_BLOB_CACHE_SIZE_CHECK_EXTERNAL` | `blob-cache-size-check-external` | `false` |
177-
| `RELSTORAGE_BLOB_CHUNK_SIZE` | `blob-chunk-size` | `1048576` |
178-
| `RELSTORAGE_CACHE_LOCAL_MB` | `cache-local-mb` | `10` |
179-
| `RELSTORAGE_CACHE_LOCAL_OBJECT_MAX` | `cache-local-object-max` | `16384` |
180-
| `RELSTORAGE_CACHE_LOCAL_COMPRESSION` | `cache-local-compression` | `none` |
181-
| `RELSTORAGE_CACHE_DELTA_SIZE_LIMIT` | `cache-delta-size-limit` | `100000` |
182-
183-
184-
### CORS
191+
### CORS variables
185192

186193
| Environment variable | Description | Default value |
187194
| --- | --- | --- |
@@ -192,8 +199,18 @@ The following is a list of supported environment variables for Relstorage:
192199
| `CORS_ALLOW_HEADERS` | A comma separated list of request headers allowed to be sent by the client, for example `X-My-Header` | `Accept,Authorization,Content-Type,X-Custom-Header` |
193200
| `CORS_MAX_AGE` | Indicates how long the results of a preflight request can be cached | `3600` |
194201

202+
Used to configure [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
203+
204+
### Add-on variables
195205

196-
### Add-on installation
206+
| Environment variable | Description | Details |
207+
| --- | --- | --- |
208+
| `ADDONS` | A space separated list of python libraries to install | [Add-ons](#add-ons) |
209+
| `DEVELOP` | A space separated list of python libraries to install in editable mode | [Developing packages](#developing-packages) |
210+
| `PIP_PARAMS` | Parameters used in `pip` installation commands | |
211+
212+
213+
#### Add-ons
197214

198215
It is possible to install add-ons during startup time in a container created using this image.
199216
To do so, pass the `ADDONS` environment variable with a space separated list of requirements to be added to the image:
@@ -214,7 +231,7 @@ In this case, extend the image as explained before.
214231
```
215232

216233

217-
### Developing packages
234+
#### Developing packages
218235

219236
It is possible to install local packages instead of packages from pip.
220237
To do so, pass the `DEVELOP` environment variable with a space separated list of paths to Python packages to be installed.
@@ -235,14 +252,17 @@ We advise against using this feature on production environments.
235252
```
236253

237254

255+
238256
## Extending from this image
239257

240258
In a directory create a `Dockerfile` file:
241259

242260
```Dockerfile
243261
FROM plone/plone-backend:6.0.0a4
244262

245-
RUN ./bin/pip install "pas.plugin.authomatic"
263+
RUN apt-get update \
264+
&& apt-get install -y --no-install-recommends gcc \
265+
&& rm -rf /var/lib/apt/lists/*
246266
```
247267

248268
Build your new image.
@@ -280,57 +300,7 @@ error: [Errno 13] Permission denied: '/app/lib/python3.9/site-packages/eea'
280300

281301
### Multiple containers with ZEO
282302

283-
This image supports ZEO clusters as a simple way to allow horizontal scaling of the backend.
284-
To use it, create a directory for your project, and inside it create a `docker-compose.yml` file that starts your Plone instance and the ZEO instance with volume mounts for data persistence.
285-
HAProxy is used for load balancing in this example.
286-
287-
```yaml
288-
version: "3"
289-
services:
290-
291-
lb:
292-
image: plone/plone-haproxy
293-
depends_on:
294-
- backend
295-
ports:
296-
- "8080:8080"
297-
- "1936:1936"
298-
environment:
299-
FRONTEND_PORT: "8080"
300-
BACKENDS: "backend"
301-
BACKENDS_PORT: "8080"
302-
DNS_ENABLED: "True"
303-
HTTPCHK: "GET /"
304-
INTER: "5s"
305-
LOG_LEVEL: "info"
306-
307-
backend:
308-
image: plone/plone-backend:6.0.0a4
309-
restart: always
310-
environment:
311-
ZEO_ADDRESS: zeo:8100
312-
ports:
313-
- "8080"
314-
depends_on:
315-
- zeo
316-
317-
zeo:
318-
image: plone/plone-zeo:latest
319-
restart: always
320-
volumes:
321-
- data:/data
322-
ports:
323-
- "8100"
324-
325-
volumes:
326-
data: {}
327-
```
328-
329-
Now run `docker-compose up -d --scale backend=4` from your project directory.
330-
331-
Point your browser at `http://localhost:8080`, using the username and password combination of `admin` and `admin`, and you should see the default Plone site creation page.
332-
333-
Point your browser at `http://localhost:1936`, using the username and password combination of `admin` and `admin`, and you should see HAProxy statistics for your Plone cluster.
303+
This image supports ZEO clusters as a simple way to allow horizontal scaling of the backend. Check the example page: {doc}`/volto/configuration/environmentvariables`.
334304

335305

336306
## Versions

0 commit comments

Comments
 (0)