Skip to content

Commit

Permalink
Document how to pack the ZODB when using containers (#1886)
Browse files Browse the repository at this point in the history
* Fix broken glossary entry (#1884)

* add recipe to pack the ZODB

* Update docs/install/containers/recipes/index.md

Co-authored-by: Steve Piercy <[email protected]>

* Apply suggestions from code review

Co-authored-by: Steve Piercy <[email protected]>

---------

Co-authored-by: Steve Piercy <[email protected]>
  • Loading branch information
erral and stevepiercy authored Mar 6, 2025
1 parent 1f13a87 commit 9969fcd
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/install/containers/recipes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,43 @@ RUN <<EOT

After making these changes, build the project container as usual.
It will no longer output the access log, but will continue to output the event log.


## Pack the ZODB

A common maintenance task of a Plone instance is to [pack the ZODB](https://zodb.org/en/stable/reference/zodb.html#ZODB.DB.pack).
Packing removes old revisions of objects.
It is similar to [routine vacuuming in PostgreSQL](https://www.postgresql.org/docs/8.3/routine-vacuuming.html).

The official {doc}`/install/containers/images/backend` container and project containers based on them have a `pack` command to pack the ZODB.
The command will work in standalone mode, ZEO mode, and RelStorage mode but only with PostgreSQL.

Invoke the command in a running container by passing in the appropriate command for the mode.

In standalone mode, ZODB is in a mounted volume, so the command would be similar to the following.

```shell
docker run -v /path/to/your/volume:/data plone/plone-backend pack
```

In ZEO mode, run the command next to your ZEO instance.

```shell
docker run -e ZEO_ADDRESS=zeo:8100 --link zeo plone/plone-backend pack
```

In RelStorage mode, pass the connection DSN.

```shell
docker run -e RELSTORAGE_DSN="dbname='plone' user='plone' host='db' password='password' port='5432'" pack
```

In running containers that use Docker Compose, the command is less complicated.

```shell
docker compose run backend pack
```

The above command assumes that the service that runs the Plone instance is named `backend`.
Otherwise replace `backend` with your container's name.

0 comments on commit 9969fcd

Please sign in to comment.