AI-News-Team / AI-News

AI written news articles... what could possibly go wrong!
0 stars 0 forks source link

In-container backups #93

Closed aardhyn closed 1 year ago

aardhyn commented 1 year ago

Backups now work in the containerized environment.

Change the backup location in the virtual.env file to /tmp/postgres/backups as described in template.virtual.env

Decompress and add base.bak.zip to /database/backups in the repository (create this directory if it does not exist, or just run make as it will create it for you as well).

Run the modules

make

Restore

Open the database container after it has started, navigate to the terminal tab (probably run/bin/bash so your not using the awful /bin/shell shell), and run ./restore.sh.

That's it, restored!

If your fast, and beat the scraper, the scraper will drop have some duplicate article errors (this is expected).

If your slow, and the scraper pushes articles into the database before you, you'll get some psql errors chucked in standard error (this is also expected).

Backup

Run ./backup.sh inside the container

From the Terminal

You can restore and backup from your host machine using docker exec.

docker exec -it /db/restore.sh
docker exec -it /db/backup.sh

Mounting directories in Docker

This works because I've mounted the /database/backup directory from the host machine to the Database container when in runs.

Note, this is done at the Compose level... in case you try and run a backup on the database in isolation--use the old method for that.

Read about it here

closes #92