mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Separating out restoring backups and storing backups.
This commit is contained in:
parent
5e2c3f7a10
commit
386861a479
2 changed files with 4 additions and 7 deletions
|
@ -3,16 +3,13 @@
|
|||
now=$(date '+%Y-%m-%d-%H-%M')
|
||||
|
||||
echo "---> PG dumping - ${now}"
|
||||
BACKUP_FILE="/srv/newsblur/backups/backup_postgresql_${now}.sql"
|
||||
BACKUP_FILE="/srv/newsblur/backup/backup_postgresql_${now}.sql"
|
||||
sudo docker exec -it postgres /usr/lib/postgresql/13/bin/pg_dump -U newsblur -h 127.0.0.1 -Fc newsblur > $BACKUP_FILE
|
||||
|
||||
echo " ---> Compressing $BACKUP_FILE"
|
||||
gzip $BACKUP_FILE
|
||||
|
||||
echo " ---> Uploading postgres backup to S3"
|
||||
sudo docker run --user 1000:1001 --rm \
|
||||
-v /srv/newsblur:/srv/newsblur \
|
||||
-v /srv/newsblur/backups/:/srv/newsblur/backups/ \
|
||||
-v /srv/newsblur/backup/:/srv/newsblur/backup/ \
|
||||
--network=host \
|
||||
newsblur/newsblur_python3 \
|
||||
python /srv/newsblur/utils/backups/backup_psql.py
|
||||
|
|
|
@ -35,8 +35,8 @@ from django.conf import settings
|
|||
s3 = boto3.client('s3', aws_access_key_id=settings.S3_ACCESS_KEY, aws_secret_access_key=settings.S3_SECRET)
|
||||
|
||||
hostname = socket.gethostname().replace('-','_')
|
||||
s3_object_name = f'backup_{hostname}/backup_{hostname}_{time.strftime("%Y-%m-%d-%H-%M")}.sql.gz'
|
||||
path = os.listdir('/srv/newsblur/backups/')[0]
|
||||
s3_object_name = f'backup_{hostname}/backup_{hostname}_{time.strftime("%Y-%m-%d-%H-%M")}.sql'
|
||||
path = os.listdir('/srv/newsblur/backup/')[0]
|
||||
print('Uploading %s to %s on S3 bucket %s' % (path, s3_object_name, settings.S3_BACKUP_BUCKET))
|
||||
s3.upload_file(path, settings.S3_BACKUP_BUCKET, s3_object_name, Callback=ProgressPercentage(path))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue