mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00

* django1.11: (152 commits) request.raw_post_data -> request.body (django 1.6) Upgrading pgbouncer to 1.15.0. Finishing off Postgresql 13 upgrade. Upgrading to Postgresql 13. Ubuntu 20.04 Fixing supervisor path issues Upgrading setuptools Fixing flask Handling over capacity for twitter. Max length for image_urls. Properly filtering newsletter feeds. Fixing issue with text importer on feed-less urls. Removing dependency, fixing encoding issue for pages. Fixing DB Monitor. Updating User Agent for all fetchers. Ignoring VSCode. Fixing DB Monitor. Updating User Agent for all fetchers. Ignoring VSCode. Fixing Statistics by fixing how timezones are handled. ...
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
import shutil
|
|
|
|
CURRENT_DIR = os.path.dirname(__file__)
|
|
NEWSBLUR_DIR = ''.join([CURRENT_DIR, '/../../'])
|
|
sys.path.insert(0, NEWSBLUR_DIR)
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'newsblur.settings'
|
|
|
|
import time
|
|
import s3
|
|
|
|
COLLECTIONS = "classifier_tag classifier_author classifier_feed classifier_title userstories shared_stories category category_site sent_emails social_profile social_subscription social_services statistics user_search feedback"
|
|
if False:
|
|
COLLECTIONS += " starred_stories"
|
|
|
|
date = time.strftime('%Y-%m-%d-%H-%M')
|
|
collections = COLLECTIONS.split(' ')
|
|
db_name = 'newsblur'
|
|
dir_name = 'backup_mongo_%s' % date
|
|
filename = '%s.tgz' % dir_name
|
|
|
|
os.mkdir(dir_name)
|
|
|
|
for collection in collections:
|
|
cmd = 'mongodump --db %s --collection %s -o %s' % (db_name, collection, dir_name)
|
|
print("Dumping %s: %s" % (collection, cmd))
|
|
os.system(cmd)
|
|
|
|
print("Compressing %s..." % filename)
|
|
cmd = 'tar -zcf %s %s' % (filename, dir_name)
|
|
os.system(cmd)
|
|
|
|
print('Uploading %s to S3...' % filename)
|
|
try:
|
|
s3.save_file_in_s3(filename, name="mongo/%s" % (filename))
|
|
except Exception as e:
|
|
print(" ****> Exceptions: %s" % e)
|
|
shutil.rmtree(dir_name)
|
|
os.remove(filename)
|