Fixed the restore script.

Got it runnign currently
main
Will King 1 year ago
parent fc478517ac
commit 1782372a45

@ -1,6 +1,6 @@
#!/bin/bash
RESTORE_DUMP_GZ=2023-09-06_aactdb_with_matches.sql.gz
RESTORE_DUMP_GZ="${1:-aact_db_backup_20250107_133822.sql.gz}"
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_DB=aact_db
@ -25,7 +25,7 @@ sleep 10
# Function to check if PostgreSQL is ready
function check_postgres {
podman exec -i "${CONTAINER_NAME}" psql -h "${CONTAINER_NAME}" -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c '\q' > /dev/null 2>&1
podman exec -i "${CONTAINER_NAME}" psql -h localhost -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c '\q' > /dev/null 2>&1
}
# Wait for PostgreSQL to be ready
@ -37,6 +37,6 @@ done
echo "PostgreSQL is ready. Restoring the database..."
# Decompress the dump file and restore it to the database
podman exec -i "${POSTGRES_DB}" sh -c "gunzip -c /backup/${RESTORE_DUMP_GZ} | psql -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}"
podman exec -i "${CONTAINER_NAME}" sh -c "gunzip -c /backup/${RESTORE_DUMP_GZ} | psql -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}"
echo "Database restoration complete."

Loading…
Cancel
Save