Skip to content

Commit

Permalink
- tuning pg_restore
Browse files Browse the repository at this point in the history
- updated database version
  • Loading branch information
maZahaca committed May 24, 2023
1 parent ed17315 commit fd80a49
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sanitizer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG version=13.1

FROM plyo/postgres:database-7.3.0-$version
FROM plyo/postgres:database-8.0.0-$version

ENV S3_BACKUP_MNT_POINT "/backups"
ENV S3_SANITIZED_BACKUP_MNT_POINT "/sanitized"
Expand Down
26 changes: 25 additions & 1 deletion sanitizer/src/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@ backup_roles_file=${backup_file}_roles.out

echo "starting postgres..."
rm -rf "${PGDATA}"

cat > /var/lib/postgresql/data/postgresql.conf <<EOL
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'
#pg_restore tuning
work_mem = 32MB
shared_buffers = 512MB
maintenance_work_mem = 1GB
full_page_writes = off
autovacuum = off
wal_buffers = 16MB
EOL

/usr/local/bin/docker-entrypoint.sh postgres &

until pg_isready -U postgres -h 0.0.0.0 -p 5432 ; do echo "waiting for postgres to start" && sleep 5 ; done
Expand Down Expand Up @@ -61,7 +85,7 @@ if [[ ! -f "/files/${filename}" ]]; then
fi
log "Restoring '${backup_file}'..."
log "pg_restore /files/${filename}"
pg_restore "/files/${filename}" -U postgres -d ${DB_NAME} -v
pg_restore "/files/${filename}" -U postgres -d ${DB_NAME} --jobs=4 -v
status=$?
if [ "$status" != "0" ];
then
Expand Down

0 comments on commit fd80a49

Please sign in to comment.