2021-07-16 12:25:25 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
collections=(
|
2022-02-03 13:21:06 -05:00
|
|
|
activities
|
|
|
|
category
|
|
|
|
category_site
|
2021-07-16 12:25:25 -04:00
|
|
|
classifier_author
|
|
|
|
classifier_feed
|
2022-02-03 13:21:06 -05:00
|
|
|
classifier_tag
|
2021-07-16 12:25:25 -04:00
|
|
|
classifier_title
|
2022-02-03 13:21:06 -05:00
|
|
|
custom_styling
|
|
|
|
dashboard_river
|
|
|
|
# feed_icons
|
|
|
|
# feed_pages
|
|
|
|
feedback
|
|
|
|
# fetch_exception_history
|
|
|
|
# fetch_history
|
|
|
|
follow_request
|
|
|
|
gift_codes
|
|
|
|
inline
|
|
|
|
interactions
|
|
|
|
m_dashboard_river
|
|
|
|
notification_tokens
|
|
|
|
notifications
|
|
|
|
popularity_query
|
|
|
|
redeemed_codes
|
|
|
|
saved_searches
|
2021-07-16 12:25:25 -04:00
|
|
|
sent_emails
|
2022-02-03 13:25:20 -05:00
|
|
|
# shared_stories
|
2022-02-03 13:21:06 -05:00
|
|
|
social_invites
|
2021-07-16 12:25:25 -04:00
|
|
|
social_profile
|
|
|
|
social_services
|
2022-02-03 13:21:06 -05:00
|
|
|
social_subscription
|
2022-02-03 13:25:20 -05:00
|
|
|
# starred_stories
|
2022-02-03 13:21:06 -05:00
|
|
|
starred_stories_counts
|
2021-07-16 12:25:25 -04:00
|
|
|
statistics
|
2022-02-03 13:21:06 -05:00
|
|
|
# stories
|
|
|
|
system.profile
|
|
|
|
system.users
|
2022-02-03 13:38:36 -05:00
|
|
|
# uploaded_opml
|
2021-07-16 12:25:25 -04:00
|
|
|
user_search
|
|
|
|
)
|
|
|
|
|
2022-02-03 15:24:49 -05:00
|
|
|
if [ "$1" = "stories" ]; then
|
2022-02-03 13:38:36 -05:00
|
|
|
collections+=(
|
2022-02-03 13:25:20 -05:00
|
|
|
shared_stories
|
|
|
|
starred_stories
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2022-02-03 15:24:49 -05:00
|
|
|
now=$(date '+%Y-%m-%d-%H-%M')
|
|
|
|
|
2021-07-16 12:40:50 -04:00
|
|
|
for collection in ${collections[@]}; do
|
2021-07-16 12:25:25 -04:00
|
|
|
echo "---> Dumping $collection - ${now}"
|
|
|
|
|
2022-02-03 13:49:23 -05:00
|
|
|
docker exec -it mongo mongodump -d newsblur -c $collection -o /backup
|
2021-07-16 12:25:25 -04:00
|
|
|
done;
|
|
|
|
|
2022-02-03 15:20:02 -05:00
|
|
|
echo " ---> Compressing /srv/newsblur/backup/newsblur into /srv/newsblur/backup/backup_mongo.tgz"
|
2022-02-03 15:24:49 -05:00
|
|
|
tar -zcf /srv/newsblur/backup/backup_mongo_${now}.tgz -C / srv/newsblur/backup/newsblur
|
2021-07-16 12:25:25 -04:00
|
|
|
|
|
|
|
echo " ---> Uploading backups to S3"
|
2022-02-03 15:20:02 -05:00
|
|
|
docker run --user 1000:1001 --rm -v /srv/newsblur:/srv/newsblur -v /srv/newsblur/backup/:/srv/newsblur/backup/ --network=host newsblur/newsblur_python3:latest python /srv/newsblur/utils/backups/backup_mongo.py
|
2021-07-23 19:01:06 -04:00
|
|
|
|
2021-07-23 19:04:30 -04:00
|
|
|
# Don't delete backup since the backup_mongo.py script will rm them
|
|
|
|
## rm /opt/mongo/newsblur/backup/backup_mongo_${now}.tgz
|
|
|
|
## rm /opt/mongo/newsblur/backup/backup_mongo_${now}
|
2021-07-29 18:17:02 -04:00
|
|
|
echo " ---> Finished uploading backups to S3: backup_mongo.tgz"
|