mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Mounting DO volume on mongo machines.
This commit is contained in:
parent
047c86f8c8
commit
82e46fe04b
2 changed files with 62 additions and 37 deletions
|
@ -6,6 +6,31 @@
|
|||
mode: 0777
|
||||
path: /var/log/mongodb
|
||||
|
||||
- name: Get the volume name
|
||||
shell: ls /dev/disk/by-id/ | grep -v part
|
||||
register: volume_name_raw
|
||||
|
||||
- set_fact:
|
||||
volume_name: "{{ volume_name_raw.stdout }}"
|
||||
|
||||
- debug:
|
||||
msg: "{{ volume_name }}"
|
||||
|
||||
- name: Create the mount point
|
||||
become: yes
|
||||
file:
|
||||
path: "/mnt/{{ inventory_hostname | regex_replace('db-|-', '') }}"
|
||||
state: directory
|
||||
|
||||
- name: Mount volume read-write
|
||||
become: yes
|
||||
mount:
|
||||
path: "/mnt/{{ inventory_hostname | regex_replace('db-|-', '') }}"
|
||||
src: "/dev/disk/by-id/{{ volume_name }}"
|
||||
fstype: xfs
|
||||
opts: defaults,discard
|
||||
state: mounted
|
||||
|
||||
- name: Copy MongoDB keyfile
|
||||
become: yes
|
||||
copy:
|
||||
|
@ -87,43 +112,43 @@
|
|||
tags:
|
||||
- sanity-checker
|
||||
|
||||
- name: Add mongo backup
|
||||
cron:
|
||||
name: mongo backup
|
||||
minute: "0"
|
||||
hour: "4"
|
||||
job:
|
||||
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
|
||||
)
|
||||
for collection in collections; do
|
||||
echo Dumping $collection
|
||||
now=$(date '+%Y-%m-%d-%H-%M')
|
||||
# - name: Add mongo backup
|
||||
# cron:
|
||||
# name: mongo backup
|
||||
# minute: "0"
|
||||
# hour: "4"
|
||||
# job:
|
||||
# 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
|
||||
# )
|
||||
# for collection in collections; do
|
||||
# echo Dumping $collection
|
||||
# now=$(date '+%Y-%m-%d-%H-%M')
|
||||
|
||||
docker exec -it mongo mongodump --db newsblur --collection $collection -o /backup/backup_mongo_${now}
|
||||
# docker exec -it mongo mongodump --db newsblur --collection $collection -o /backup/backup_mongo_${now}
|
||||
|
||||
echo Compressing /opt/mongo/newsblur/backup/backup_mongo_${now}.tgz
|
||||
tar -zcf /opt/mongo/newsblur/backup/backup_mongo_${now}.tgz /opt/mongo/newsblur/backup/backup_mongo_${now})
|
||||
# echo Compressing /opt/mongo/newsblur/backup/backup_mongo_${now}.tgz
|
||||
# tar -zcf /opt/mongo/newsblur/backup/backup_mongo_${now}.tgz /opt/mongo/newsblur/backup/backup_mongo_${now})
|
||||
|
||||
done;
|
||||
# done;
|
||||
|
||||
echo Uploading backups to S3
|
||||
docker run --rm
|
||||
-v /srv/newsblur:/srv/newsblur
|
||||
-v /opt/mongo/newsblur/backup/:/opt/mongo/newsblur/backup/
|
||||
--network=newsblurnet
|
||||
newsblur/newsblur_python3:latest /srv/newsblur/utils/backups/backup_mongo.py
|
||||
# echo Uploading backups to S3
|
||||
# docker run --rm
|
||||
# -v /srv/newsblur:/srv/newsblur
|
||||
# -v /opt/mongo/newsblur/backup/:/opt/mongo/newsblur/backup/
|
||||
# --network=newsblurnet
|
||||
# newsblur/newsblur_python3:latest /srv/newsblur/utils/backups/backup_mongo.py
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
- name: Template file for prometheus
|
||||
vars:
|
||||
monitor_server: "{{ 'staging.newsblur.com' if disable_consul_services_ie_staging is defined else 'beta.newsblur.com' }}"
|
||||
monitor_server: "{{ 'staging.newsblur.com' if disable_consul_services_ie_staging is defined else 'newsblur.com' }}"
|
||||
template:
|
||||
src: /srv/newsblur/docker/prometheus/prometheus.consul.yml.j2
|
||||
dest: /srv/newsblur/docker/prometheus/prometheus.yml
|
||||
|
|
Loading…
Add table
Reference in a new issue