Skip to content

Bridgy pulls comments and likes from social networks back to your web site. You can also use it to publish your posts to those networks.

Notifications You must be signed in to change notification settings

uniteddiversity/bridgy

 
 

Repository files navigation

Got a web site? Want social network replies and likes on your site? Want to post and tweet from your site? Bridgy is for you.

http://brid.gy/

Bridgy pulls comments and likes from social networks back to your web site. You can also use it to publish your posts to those networks. See the docs for more details.

License: This project is placed in the public domain.

Development

You'll need the App Engine Python SDK version 1.9.15 or later (for vendor support). Add it to your $PYTHONPATH, e.g. export PYTHONPATH=$PYTHONPATH:/usr/local/google_appengine, and then run:

virtualenv local
source local/bin/activate
pip install -r requirements.txt
python -m unittest discover

The last command runs the unit tests. If you send a pull request, please include (or update) a test for the new functionality if possible!

There's a good chance you'll need to make changes to granary or oauth-dropins at the same time as bridgy. To do that, clone their repos, then install them in "source" mode with:

pip install -e <path to oauth-dropins>
ln -s <path to oauth-dropins>/oauth_dropins \
  local/lib/python2.7/site-packages/oauth_dropins

pip install -e <path to granary>
ln -s <path to granary>/granary local/lib/python2.7/site-packages/granary

The symlinks are necessary because App Engine's vendor module evidently doesn't follow .egg-link files. :/

Requires the App Engine SDK.

This command runs the tests, pushes any changes in your local repo, and deploys to App Engine:

cd ../oauth-dropins && source local/bin/activate.csh && python -m unittest discover && \
  cd ../granary && source local/bin/activate.csh && python -m unittest discover && \
  cd ../bridgy && source local/bin/activate.csh && python -m unittest discover && \
  ./facebook_test_live.py && git push && ~/google_appengine/appcfg.py update .

Monitoring

App Engine's built in dashboard and log browser are pretty good for interactive monitoring and debugging.

For alerting, we've set up Google Cloud Monitoring (née Stackdriver). Background in #377. It sends alerts by email and SMS when HTTP 4xx responses average >.1qps or 5xx >.05qps, latency averages >15s, or instance count averages >5 over the last 15m window.

Misc

The datastore is automatically backed up by a cron job that runs Datastore Admin backup and stores the results in Cloud Storage, in the brid-gy.appspot.com bucket. It backs up all entities weekly, and all entities except Response and SyndicatedPost daily, since they make up 92% of all entities by size and they aren't as critical to keep.

We use this command to set a Cloud Storage lifecycle policy on that bucket that deletes all files over 30 days old:

gsutil lifecycle set cloud_storage_lifecycle.json gs://brid-gy.appspot.com

So far, this has kept us within the 5GB free quota. Run this command to see how much space we're currently using:

gsutil du -hsc gs://brid-gy.appspot.com/\*

Here are remote_api_shell and shell commands for generating the statistics published at brid.gy/about#stats:

# remote_api_shell
from models import Response
cursor = None
with open('sent_urls', 'w') as sent, open('unsent_urls', 'w') as unsent:
  while True:
    results, cursor, _ = Response.query(
#      projection=[Response.sent,Response.skipped,Response.error,Response.failed]
      ).fetch_page(100, start_cursor=cursor)
    if not results:
      break
    for r in results:
      print >> sent, '\n'.join(r.sent)
      print >> unsent, '\n'.join(r.skipped + r.error + r.failed)

# shell
sort sent_urls  | uniq > sent_uniq
cut -f3 -d/ sent_uniq | sed 's/^www\.//' | sort --ignore-case | uniq -i > sent_domains
wc sent_urls sent_uniq sent_domains

Related projects and docs

About

Bridgy pulls comments and likes from social networks back to your web site. You can also use it to publish your posts to those networks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.3%
  • HTML 13.3%
  • Other 1.4%