internetarchive / openlibrary

One webpage for every book ever published!
https://openlibrary.org
GNU Affero General Public License v3.0
4.99k stars 1.25k forks source link

Import full psql dump from ol-db1 into ol-db0 #9155

Open mekarpeles opened 2 months ago

mekarpeles commented 2 months ago

As part of #5675, perform a full db dump of ol-db1 and import into ol-db0 after it's provisioned (#9153), potentially using: https://github.com/internetarchive/olsystem/blob/master/bin/postgres/pg-backup.sh

jimchamp commented 1 month ago

https://github.com/internetarchive/openlibrary/labels/State%3A%20Blocked until #9153 is completed.

jimchamp commented 1 month ago

In preparation for ol-db0 to be provisioned, we have dumped ol-db1 to ol-backup1.

ol-backup1 was recently provisioned, and did not have the Postgres server installed. To install this, I have ran the following (from this page):

# Import the repository signing key:
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc

# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Update the package lists:
sudo apt update

# Install the latest version of PostgreSQL:
# If you want a specific version, use 'postgresql-16' or similar instead of 'postgresql'
sudo apt -y install postgresql-16

To check if the service is up, pg_isready can be ran.