#!/bin/bash mkdir data pg_dump -d grocery -Ft -f dump podman-compose -p grocery up -d podman exec -i grocery_db_1 psql -U postgres -b < <( cat <<EOF CREATE ROLE pi; ALTER ROLE pi LOGIN; CREATE ROLE das; CREATE ROLE grocery_ro; ALTER ROLE grocery_ro LOGIN; GRANT das TO pi; EOF ) podman exec -i grocery_db_1 pg_restore -U postgres -Ce --dbname postgres < dump sudo cp pg_hba.conf data/pg_hba.conf podman exec -i grocery_db_1 bash -c 'kill -HUP 1'