mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Updating to boto3 syntax.
This commit is contained in:
parent
d677373e3b
commit
be3237cdc3
2 changed files with 3 additions and 4 deletions
|
@ -88,4 +88,4 @@
|
|||
-v /srv/newsblur/docker/volumes/redis.var.lib/dump.rdb:/var/lib/redis/dump.rdb
|
||||
--network=newsblurnet
|
||||
--hostname={{ ansible_hostname }}
|
||||
newsblur/newsblur_python3 /srv/newsblur/utils/backups/backup_redis.py
|
||||
newsblur/newsblur_python3 python /srv/newsblur/utils/backups/backup_redis.py
|
||||
|
|
|
@ -11,11 +11,10 @@ import time
|
|||
import boto3
|
||||
from django.conf import settings
|
||||
|
||||
s3 = boto3.resource('s3')
|
||||
bucket = s3.Bucket(settings.S3_BACKUP_BUCKET)
|
||||
s3 = boto3.client('s3')
|
||||
|
||||
hostname = socket.gethostname().replace('-','_')
|
||||
filename = f'backup_{hostname}/backup_{hostname}_{time.strftime("%Y-%m-%d-%H-%M")}.rdb.gz'
|
||||
path = '/var/lib/redis/dump.rdb'
|
||||
print('Uploading %s (from %s) to S3...' % (filename, path))
|
||||
bucket.upload_file(path, name=filename)
|
||||
s3.upload_file(path, settings.S3_BACKUP_BUCKET, filename)
|
||||
|
|
Loading…
Add table
Reference in a new issue