stbarnabas / django-icybackup Goto Github PK
View Code? Open in Web Editor NEWThis project forked from chriscohoat/django-backup
Back your Django database and media directory up to Amazon Glacier or a local file
This project forked from chriscohoat/django-backup
Back your Django database and media directory up to Amazon Glacier or a local file
At current, icybackup writes data coming in over stdin to a file, and only starts processing it once it's fully received; it should start decompressing/extracting while the file's still coming in. (Note that tarfile.open
requires a special mode value to tell it not to do any random seeking.)
Recieved via email:
Hi,
I'm eager to use icybackup but I ran into a problem and there isn't any place to report issues.
My database is Postgres but I'm using django.contrib.gis.db.backends.postgis.
Do you know if there will be any issues treating this like a normal Postgres database?
Thanks,
Shige Abe
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 206, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/django/core/management/init.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/icybackup/management/commands/backup.py", line 13, in
class Command(BaseCommand):
File "/var/www/vhosts/env/local/lib/python2.7/site-packages/icybackup/management/commands/backup.py", line 14, in Command
option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
And django.core.management.base.BaseCommand is not containing option_list
Instead of using deflate/gzip, use xz where available (3.3+), and bzip2 otherwise.
The _do_delete
function has no way of breaking out of the while loop. The backup script will hang in the loop until the user break. I'd propose a fix, but I'm not really sure what the pruning functionality is supposed to keep and what to delete.
def prune(arn, settings):
vault = _get_vault_from_arn(arn, settings)
keep_all_before = datetime.now() - timedelta(days=31)
keep_daily_before = datetime.now() - timedelta(days=90)
keep_weekly_before = datetime.now() - timedelta(days=365)
oldest_date = models.GlacierBackup.objects.all().order_by('date')[0].date
_do_delete(vault, 1, keep_all_before, keep_daily_before)
_do_delete(vault, 30, keep_daily_before, keep_weekly_before)
_do_delete(vault, 30, keep_weekly_before, oldest_date)
def _do_delete(vault, day_count, from_date, to_date):
begin_date = from_date
while begin_date >= to_date:
end_date = begin_date - timedelta(days=day_count)
if end_date < to_date:
end_date = to_date
qs = models.GlacierBackup.objects.filter(date__lt=end_date, date__gte=begin_date)
# delete all but the most recent
for record in qs[1:]:
print "Deleting", record.glacier_id
vault.delete(record.glacier_id)
record.delete()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.