Skip to content

Commit b6beaf5

Browse files
committed
zodbconvert example config and scripts
1 parent 82a46d6 commit b6beaf5

File tree

8 files changed

+51
-10
lines changed

8 files changed

+51
-10
lines changed

devops/zodbconvert/README.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
Convert postgresql to filestorage
22
=================================
33

4-
In test and production the plone.org website stores the content data in a
4+
In test and production the website stores the content data in a
55
Postgresql database using the relstorage driver. If you want to create
66
a local filestorage copy of the data to use for local development, you
77
can use the zodbconvert utility.
88

9-
First make sure you are running a local postgresql server with the Plone
10-
content database. The zodbconvert config file assume you use the (datbase)
11-
settings as configured in the docker-compose.yml in the project root. This
12-
compose file starts a local postgresql container on 127.0.0.1:5432 with
13-
ploneorg/ploneorg/ploneorg as the database/role/password .
9+
First make sure you are running a local postgresql server with the site
10+
content database. The zodbconvert config file assume you use the (database)
11+
settings as configured in the postgres-compose.yml in the project root. This
12+
compose file starts a local postgresql container on 127.0.0.1:5432
1413

1514
zodbconvert writes the data to the ./data directory in the project root,
1615
inside ./data/filestorage and ./data/blobs .
1716

1817
Now run zodbconvert from the project root:
1918

20-
> ./backend/bin/zodbconvert ./devops/zodbconvert/relstorage.cfg
19+
> ./backend/bin/zodbconvert ./devops/zodbconvert/from-relstorage.cfg
2120

22-
This can take 5-15 minutes, depending on your machine specs.
21+
This can take some minutes, depending on your machine specs.
2322

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3.8"
2+
3+
services:
4+
5+
db:
6+
image: postgres:16
7+
environment:
8+
POSTGRES_USER: zodbconvert
9+
POSTGRES_PASSWORD: zodbconvert
10+
POSTGRES_DB: zodbconvert
11+
command: postgres -c shared_buffers=2GB -c effective_cache_size=4GB -c maintenance_work_mem=1GB -c wal_buffers=16MB -c random_page_cost=1.1 -c effective_io_concurrency=200 -c work_mem=20971kB -c min_wal_size=2GB -c max_wal_size=8GB -c wal_keep_size=1GB -c max_locks_per_transaction=512
12+
ports:
13+
- "127.0.0.1:5432:5432"
14+
volumes:
15+
- ./data/postgresql:/var/lib/postgresql/data
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/zodbconvert -f ./from-relstorage.cfg
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# import pgdump file:
3+
# docker exec -i zodbconvert-db-1 pg_restore -U zodbconvert -d zodbconvert --clean --no-owner -v < $1
4+
5+
rm -rf ./data/filestorage ./data-blobstorage
6+
mkdir -p ./data/filestorage ./data/blobstorage
7+
./bin/zodbconvert ./from-relstorage.cfg
8+
cd data
9+
tar cfz ploneorg_devdata.tar.gz filestorage blobstorage
10+
mv ploneorg_devdatatar.gz ..
11+
cd ..
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
blob-dir /tmp/blobcache
33
shared-blob-dir false
44
<postgresql>
5-
dsn dbname='ploneorg' user='ploneorg' host='127.0.0.1' port='5432' password='ploneorg'
5+
dsn dbname='zodbconvert' user='zodbconvert' host='127.0.0.1' port='5432' password='zodbconvert'
66
</postgresql>
77
</relstorage>
88
<filestorage destination>
99
path ./data/filestorage/Data.fs
10-
blob-dir ./data/blobs
10+
blob-dir ./data/blobstorage
1111
</filestorage>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
relstorage==4.0.0
2+
psycopg2==2.9.9
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker exec -i zodbconvert-db-1 pg_restore -U zodbconvert -d zodbconvert --clean --no-owner -v < $1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<filestorage source>
2+
path ../../data/filestorage/Data.fs
3+
blob-dir ../../data/blobs
4+
</filestorage>
5+
<relstorage destination>
6+
blob-dir /tmp/blobcache
7+
shared-blob-dir false
8+
<postgresql>
9+
dsn dbname='zodbconvert' user='zodbconvert' host='127.0.0.1' port='5432' password='zodbconvert'
10+
</postgresql>
11+
</relstorage>

0 commit comments

Comments
 (0)