mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-21 05:45:13 +00:00
Merge branch 'master' into folder_rss
* master: Shift+L now toggles between unread stories and all stories. Adding roles to zgrep util. Adding pointer cursor to folders on Mute Feeds. Adding log tail to redis bgsave monitor. a+x on redis bgsave monitor. Adding redis bgsave monitor. Adding redis bgsave monitor.
This commit is contained in:
commit
1108c670cf
8 changed files with 71 additions and 8 deletions
|
@ -1 +1 @@
|
|||
slaveof db_redis_story 6379
|
||||
slaveof db_redis 6379
|
7
fabfile.py
vendored
7
fabfile.py
vendored
|
@ -260,8 +260,10 @@ def setup_db(engine=None, skip_common=False):
|
|||
elif engine == "redis":
|
||||
setup_redis()
|
||||
setup_redis_backups()
|
||||
setup_redis_monitor()
|
||||
elif engine == "redis_slave":
|
||||
setup_redis(slave=True)
|
||||
setup_redis_monitor()
|
||||
elif engine == "elasticsearch":
|
||||
setup_elasticsearch()
|
||||
setup_db_search()
|
||||
|
@ -1104,6 +1106,11 @@ def setup_usage_monitor():
|
|||
sudo('ln -fs %s/utils/monitor_disk_usage.py /etc/cron.daily/monitor_disk_usage' % env.NEWSBLUR_PATH)
|
||||
sudo('/etc/cron.daily/monitor_disk_usage')
|
||||
|
||||
@parallel
|
||||
def setup_redis_monitor():
|
||||
sudo('ln -fs %s/utils/monitor_redis_bgsave.py /etc/cron.daily/monitor_redis_bgsave' % env.NEWSBLUR_PATH)
|
||||
sudo('/etc/cron.daily/monitor_redis_bgsave')
|
||||
|
||||
# ================
|
||||
# = Setup - Task =
|
||||
# ================
|
||||
|
|
|
@ -9004,9 +9004,6 @@ form.opml_import_form input {
|
|||
.NB-modal-feedchooser .feed.NB-highlighted .feed_counts .unread_count_negative {
|
||||
display: none;
|
||||
}
|
||||
.NB-modal-feedchooser .NB-feedlist .folder_title {
|
||||
cursor: default;
|
||||
}
|
||||
.NB-modal-feedchooser .NB-feedlist .folder_title .feed_counts_floater {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -4396,6 +4396,17 @@
|
|||
this.slide_intelligence_slider(value);
|
||||
},
|
||||
|
||||
toggle_read_filter: function() {
|
||||
var read_filter = NEWSBLUR.assets.view_setting(this.active_feed, 'read_filter');
|
||||
var setting = {
|
||||
'read_filter': (read_filter == 'unread' ? 'all' : 'unread')
|
||||
};
|
||||
var changed = NEWSBLUR.assets.view_setting(this.active_feed, setting);
|
||||
if (!changed) return;
|
||||
|
||||
NEWSBLUR.reader.reload_feed(setting);
|
||||
},
|
||||
|
||||
switch_feed_view_unread_view: function(unread_view) {
|
||||
if (!_.isNumber(unread_view)) unread_view = this.get_unread_view_score();
|
||||
var $sidebar = this.$s.$sidebar;
|
||||
|
@ -6438,6 +6449,10 @@
|
|||
e.preventDefault();
|
||||
self.move_intelligence_slider(-1);
|
||||
});
|
||||
$document.bind('keypress', 'shift+l', function(e) {
|
||||
e.preventDefault();
|
||||
self.toggle_read_filter();
|
||||
});
|
||||
$document.bind('keypress', 'shift+d', function(e) {
|
||||
e.preventDefault();
|
||||
self.show_splash_page();
|
||||
|
|
|
@ -57,7 +57,7 @@ _.extend(NEWSBLUR.ReaderKeyboard.prototype, {
|
|||
]),
|
||||
$.make('div', { className: 'NB-keyboard-group' }, [
|
||||
$.make('div', { className: 'NB-keyboard-shortcut' }, [
|
||||
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Return to dashboard'),
|
||||
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Dashboard'),
|
||||
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
|
||||
'esc'
|
||||
]),
|
||||
|
@ -201,6 +201,16 @@ _.extend(NEWSBLUR.ReaderKeyboard.prototype, {
|
|||
'/'
|
||||
])
|
||||
])
|
||||
]),
|
||||
$.make('div', { className: 'NB-keyboard-group' }, [
|
||||
$.make('div', { className: 'NB-keyboard-shortcut' }, [
|
||||
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Toggle unread/all'),
|
||||
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
|
||||
'shift',
|
||||
$.make('span', '+'),
|
||||
'L'
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ if __name__ == '__main__':
|
|||
doapi = dop.client.Client(settings.DO_CLIENT_KEY, settings.DO_API_KEY)
|
||||
droplets = doapi.show_active_droplets()
|
||||
for droplet in droplets:
|
||||
if sys.argv[1] in droplet.name:
|
||||
if sys.argv[1] == droplet.name:
|
||||
print droplet.ip_address
|
||||
break
|
||||
|
||||
|
|
33
utils/monitor_redis_bgsave.py
Executable file
33
utils/monitor_redis_bgsave.py
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('/srv/newsblur')
|
||||
|
||||
import os
|
||||
import datetime
|
||||
import requests
|
||||
import settings
|
||||
import socket
|
||||
|
||||
def main():
|
||||
t = os.popen('stat -c%Y /var/lib/redis/dump.rdb')
|
||||
timestamp = t.read().split('\n')[0]
|
||||
modified = datetime.datetime.fromtimestamp(int(timestamp))
|
||||
ten_min_ago = datetime.datetime.now() - datetime.timedelta(minutes=10)
|
||||
hostname = socket.gethostname()
|
||||
modified_minutes = datetime.datetime.now() - modified
|
||||
log_tail = os.popen('tail -n 100 /var/log/redis.log').read()
|
||||
|
||||
if modified < ten_min_ago:
|
||||
requests.post(
|
||||
"https://api.mailgun.net/v2/%s/messages" % settings.MAILGUN_SERVER_NAME,
|
||||
auth=("api", settings.MAILGUN_ACCESS_KEY),
|
||||
data={"from": "NewsBlur Redis Monitor: %s <admin@%s.newsblur.com>" % (hostname, hostname),
|
||||
"to": [settings.ADMINS[0][1]],
|
||||
"subject": "%s hasn't bgsave'd redis in %s!" % (hostname, modified_minutes),
|
||||
"text": "Last modified %s: %s ago\n\n----\n\n%s" % (hostname, modified_minutes, log_tail)})
|
||||
else:
|
||||
print " ---> Redis bgsave fine: %s / %s ago" % (hostname, modified_minutes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -95,9 +95,11 @@ if __name__ == "__main__":
|
|||
parser = OptionParser()
|
||||
parser.add_option("-f", "--find", dest="find")
|
||||
parser.add_option("-p", "--path", dest="path")
|
||||
parser.add_option("-r", "--role", dest="role")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
path = options.path
|
||||
find = options.find
|
||||
role = options.role or 'app'
|
||||
command = "zgrep \"%s\"" % find
|
||||
main(role="app", command=command, path=path)
|
||||
main(role=role, command=command, path=path)
|
||||
|
|
Loading…
Add table
Reference in a new issue