Skip to content

Commit

Permalink
Add command for packing the ZODB [6.1.x] (#179)
Browse files Browse the repository at this point in the history
Fixes #104 

I have locally tested with a plain container, using ZEO and also using
Relstorage with Postgres and it works.

But I would like someone else to test with Relstorage, as I don't have
any experience with it.
  • Loading branch information
davisagli authored Mar 6, 2025
2 parents 0271aac + 6fc4f00 commit babc92e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/104.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Provide command to pack ZODB. @erral
8 changes: 8 additions & 0 deletions skeleton/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ elif [[ "$1" == "run" ]]; then
exec $sudo $VENVBIN/zconsole run etc/${CONF} "${@:2}"
elif [[ "$1" == "addzopeuser" ]]; then
exec $sudo $VENVBIN/addzopeuser -c etc/${CONF} "${@:2}"
elif [[ "$1" == "pack" ]]; then
if [[ -v ZEO_ADDRESS ]]; then
exec $sudo $VENVBIN/zeopack "${@:2}" ${ZEO_ADDRESS}
elif [[ -v RELSTORAGE_DSN ]]; then
exec $sudo $VENVBIN/zodbpack "${@:2}" etc/relstorage_pack.conf
else
exec $sudo $VENVBIN/zconsole run etc/${CONF} /app/scripts/pack.py
fi
else
# Custom
exec "$@"
Expand Down
6 changes: 6 additions & 0 deletions skeleton/etc/relstorage_pack.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<relstorage>
pack-gc true
<postgresql>
dsn $(RELSTORAGE_DSN)
</postgresql>
</relstorage>
2 changes: 2 additions & 0 deletions skeleton/scripts/pack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from Zope2 import DB
DB.pack()

0 comments on commit babc92e

Please sign in to comment.