Merge branch 'master' into social

* master:
  Starred story titles, even if it kills us.
  Chucking ntpd in favor of bluntly recalibrating time on VPSs.
  Adding Robin Good press.
This commit is contained in:
Samuel Clay 2012-04-23 15:38:54 -07:00
commit 109decc5d0
4 changed files with 33 additions and 6 deletions

View file

@ -296,7 +296,7 @@ class GoogleReaderImporter(Importer):
"user_id": self.user_id,
"starred_date": datetime.datetime.fromtimestamp(story['updated']),
"story_date": datetime.datetime.fromtimestamp(story['published']),
"story_title": story.get('title'),
"story_title": story.get('title', story.get('origin', {}).get('title', '[Untitled]')),
"story_permalink": story['alternate'][0]['href'],
"story_guid": story['id'],
"story_content": content.get('content'),
@ -308,6 +308,6 @@ class GoogleReaderImporter(Importer):
MStarredStory.objects.create(**story_db)
except OperationError:
logging.user(self.user, "~FCAlready starred: ~SB%s" % (story_db['story_title'][:50]))
except:
logging.user(self.user, "~FC~BRFailed to star: ~SB%s" % (story))
except Exception, e:
logging.user(self.user, "~FC~BRFailed to star: ~SB%s / %s" % (story, e))

1
config/ntpdate.cron Normal file
View file

@ -0,0 +1 @@
ntpdate ntp.ubuntu.com

24
fabfile.py vendored
View file

@ -200,9 +200,16 @@ def backup_postgresql():
# ===============
def sync_time():
sudo("/etc/init.d/ntp stop")
sudo("/etc/init.d/ntp stop", warn_only=True)
sudo("ntpdate pool.ntp.org")
sudo("/etc/init.d/ntp start")
sudo("/etc/init.d/ntp start", warn_only=True)
def setup_time_calibration():
sudo('apt-get -y remove ntp')
put('config/ntpdate.cron', env.NEWSBLUR_PATH)
sudo('chmod 755 %s/ntpdate.cron' % env.NEWSBLUR_PATH)
sudo('mv %s/ntpdate.cron /etc/cron.hourly/ntpdate' % env.NEWSBLUR_PATH)
sudo('/etc/cron.hourly/ntpdate')
# =============
# = Bootstrap =
@ -230,6 +237,7 @@ def setup_common():
def setup_app():
setup_common()
setup_vps()
setup_app_firewall()
setup_app_motd()
setup_gunicorn(supervisor=True)
@ -239,6 +247,7 @@ def setup_app():
def setup_db():
setup_common()
setup_baremetal()
setup_db_firewall()
setup_db_motd()
# setup_rabbitmq()
@ -251,6 +260,7 @@ def setup_db():
def setup_task():
setup_common()
setup_vps()
setup_task_firewall()
setup_task_motd()
enable_celery_supervisor()
@ -265,7 +275,7 @@ def setup_task():
def setup_installs():
sudo('apt-get -y update')
sudo('apt-get -y upgrade')
sudo('apt-get -y install build-essential gcc scons libreadline-dev sysstat iotop git zsh python-dev locate python-software-properties libpcre3-dev libdbd-pg-perl libssl-dev make pgbouncer python-psycopg2 libmemcache0 python-memcache libyaml-0-2 python-yaml python-numpy python-scipy python-imaging munin munin-node munin-plugins-extra curl ntp monit')
sudo('apt-get -y install build-essential gcc scons libreadline-dev sysstat iotop git zsh python-dev locate python-software-properties libpcre3-dev libdbd-pg-perl libssl-dev make pgbouncer python-psycopg2 libmemcache0 python-memcache libyaml-0-2 python-yaml python-numpy python-scipy python-imaging munin munin-node munin-plugins-extra curl monit')
# sudo('add-apt-repository ppa:pitti/postgresql')
sudo('apt-get -y update')
sudo('apt-get -y install postgresql-client')
@ -432,6 +442,14 @@ def configure_nginx():
sudo("chmod 0755 /etc/init.d/nginx")
sudo("/usr/sbin/update-rc.d -f nginx defaults")
sudo("/etc/init.d/nginx restart")
def setup_vps():
# VPS suffer from severe time drift. Force blunt hourly time recalibration.
setup_time_calibration()
def setup_baremetal():
# Bare metal doesn't suffer from severe time drift. Use standard ntp slow-drift-calibration.
sudo('apt-get -y install ntp')
# ===============
# = Setup - App =

View file

@ -76,6 +76,14 @@
<span class="NB-press-author">Nathan Willis</span>,
<span class="NB-press-date">Nov 23, 2011</span>
</li>
<li>
<a href="http://curation.masternewmedia.org/p/1641985252/news-discovery-the-google-reader-open-source-alternative-is-here-and-it-s-called-newsblur">News Discovery: The Google Reader Open-Source Alternative Is Here and Its Called NewsBlur</a>
<span class="NB-press-publisher">
<img src="http://www.masternewmedia.org/favicon.ico">
Scoop It</span>,
<span class="NB-press-author">Robin Good</span>,
<span class="NB-press-date">April 21, 2012</span>
</li>
<li>
<a href="http://www.skimbu.it/2012/03/06/newsblur-approccio-alternativo-alla-lettura-dei-feed-rss/">NewsBlur: approccio alternativo alla lettura dei feed RSS</a>
<span class="NB-press-publisher">