mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Adding redis to monit.
This commit is contained in:
parent
495ccac8ce
commit
0679d7d956
5 changed files with 23 additions and 7 deletions
|
@ -1977,7 +1977,7 @@ class MStarredStory(mongo.Document):
|
||||||
return stories
|
return stories
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def trim_old_stories(cls, stories=10, days=30, dryrun=False):
|
def trim_old_stories(cls, stories=10, days=60, dryrun=False):
|
||||||
print " ---> Fetching starred story counts..."
|
print " ---> Fetching starred story counts..."
|
||||||
stats = settings.MONGODB.newsblur.starred_stories.aggregate([{
|
stats = settings.MONGODB.newsblur.starred_stories.aggregate([{
|
||||||
"$group": {
|
"$group": {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<key>application-identifier</key>
|
<key>application-identifier</key>
|
||||||
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||||
<key>get-task-allow</key>
|
<key>get-task-allow</key>
|
||||||
<false/>
|
<true/>
|
||||||
<key>keychain-access-groups</key>
|
<key>keychain-access-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||||
|
|
11
config/monit_debug.sh
Normal file
11
config/monit_debug.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
{
|
||||||
|
echo "MONIT-WRAPPER date"
|
||||||
|
date
|
||||||
|
echo "MONIT-WRAPPER env"
|
||||||
|
env
|
||||||
|
echo "MONIT-WRAPPER $@"
|
||||||
|
$@
|
||||||
|
R=$?
|
||||||
|
echo "MONIT-WRAPPER exit code $R"
|
||||||
|
} 2>&1 | logger
|
|
@ -3,8 +3,8 @@ set daemon 30
|
||||||
set logfile /var/log/monit.log
|
set logfile /var/log/monit.log
|
||||||
|
|
||||||
check process redis with pidfile /var/run/redis.pid
|
check process redis with pidfile /var/run/redis.pid
|
||||||
stop program = "/etc/init.d/redis stop"
|
stop program = "/etc/monit/monit_debug.sh /etc/init.d/redis stop"
|
||||||
as uid root and gid root
|
as uid root and gid root
|
||||||
start program = "/etc/init.d/redis start"
|
start program = "/etc/monit/monit_debug.sh /etc/init.d/redis start"
|
||||||
as uid root and gid root
|
as uid root and gid root
|
||||||
if failed host 127.0.0.1 port 6379 then restart
|
# if failed host 127.0.0.1 port 6379 then restart
|
||||||
|
|
7
fabfile.py
vendored
7
fabfile.py
vendored
|
@ -477,6 +477,10 @@ def config_monit_app():
|
||||||
sudo('/etc/init.d/monit restart')
|
sudo('/etc/init.d/monit restart')
|
||||||
|
|
||||||
def config_monit_redis():
|
def config_monit_redis():
|
||||||
|
sudo('chown root.root /etc/init.d/redis')
|
||||||
|
sudo('chmod a+x /etc/init.d/redis')
|
||||||
|
put('config/monit_debug.sh', '/etc/monit/monit_debug.sh', use_sudo=True)
|
||||||
|
sudo('chmod a+x /etc/monit/monit_debug.sh')
|
||||||
put('config/monit_redis.conf', '/etc/monit/conf.d/redis.conf', use_sudo=True)
|
put('config/monit_redis.conf', '/etc/monit/conf.d/redis.conf', use_sudo=True)
|
||||||
sudo('echo "START=yes" > /etc/default/monit')
|
sudo('echo "START=yes" > /etc/default/monit')
|
||||||
sudo('/etc/init.d/monit restart')
|
sudo('/etc/init.d/monit restart')
|
||||||
|
@ -863,7 +867,7 @@ def setup_mongo_mms():
|
||||||
|
|
||||||
|
|
||||||
def setup_redis(slave=False):
|
def setup_redis(slave=False):
|
||||||
redis_version = '2.6.14'
|
redis_version = '2.6.16'
|
||||||
with cd(env.VENDOR_PATH):
|
with cd(env.VENDOR_PATH):
|
||||||
run('wget http://redis.googlecode.com/files/redis-%s.tar.gz' % redis_version)
|
run('wget http://redis.googlecode.com/files/redis-%s.tar.gz' % redis_version)
|
||||||
run('tar -xzf redis-%s.tar.gz' % redis_version)
|
run('tar -xzf redis-%s.tar.gz' % redis_version)
|
||||||
|
@ -887,6 +891,7 @@ def setup_redis(slave=False):
|
||||||
sudo('/etc/init.d/redis stop')
|
sudo('/etc/init.d/redis stop')
|
||||||
sudo('/etc/init.d/redis start')
|
sudo('/etc/init.d/redis start')
|
||||||
setup_syncookies()
|
setup_syncookies()
|
||||||
|
config_monit_redis()
|
||||||
|
|
||||||
def setup_munin():
|
def setup_munin():
|
||||||
# sudo('apt-get update')
|
# sudo('apt-get update')
|
||||||
|
|
Loading…
Add table
Reference in a new issue