Skip to content

Instantly share code, notes, and snippets.

@renoirb
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renoirb/5f46920242dee15f2059 to your computer and use it in GitHub Desktop.
Save renoirb/5f46920242dee15f2059 to your computer and use it in GitHub Desktop.
Debugging session
diff --git a/development.ini b/development.ini
index 4cc6b0d..6dceba2 100644
--- a/development.ini
+++ b/development.ini
@@ -1,10 +1,11 @@
[DEFAULT]
# ElasticSearch instance for document storage
# This is a URL of an ElasticSearch server.
-es: http://dokku.hypothes.is:9200
+es: http://elastic2.dho.wpdn:9200
# SQL provider URL for relational storage
-# This is a sqlalchemy engine string -- see sqlalchemy documentation
+# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html
+#sql: mysql://hypothesis:0000000000000000@master.db.wpdn/hypothesis
sql: sqlite:///h.db
[app:main]
@@ -27,9 +28,13 @@ use: egg:h
# currently supported.
api.endpoint: /api
api.key: 00000000-0000-0000-0000-000000000000
+api.secret: 00000000-0000-0000-0000-000000000000
# api.secret: 00000000-0000-0000-0000-000000000000
# api.url: http://api.example.com
+mail.default_sender: "Annotation Daemon" <notifier-notes@webplatform.org>
+mail.host: mail.webplatform.org
+mail.port: 25
#
# Authentication configuration -- see horus documentation
@@ -79,7 +84,7 @@ pyramid_deform.template_search_path: h:templates/deform
# Database configuration taken from [DEFAULTS]
#
es.host: %(es)s
-es.index: annotator
+es.index: notes
sqlalchemy.url: %(sql)s
@@ -97,13 +102,17 @@ webassets.manifest: False
[server:main]
+# #TODO
+#host: unix://tmp/hypothesis.sock (TODO)
use: egg:gunicorn
-host: 0.0.0.0
+host: 127.0.0.1
port: 5000
# Uncomment this line to test SSL deployment with a dummy certificate.
#certfile: %(here)s/host.pem
worker_class: gevent
+
+
[alembic]
# path to migration scripts
script_location = h:migrations
description "Hypothesis server"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
script
cd /srv/webplatform/h
#export SCRIPT_NAME='/notes'
# https://lukedrummond.net/2014/02/django-with-prefix-nginxgunicorndjango/
# http://albertoconnor.ca/blog/2011/Sep/15/hosting-django-under-different-locations
./bin/hypothesis start h.ini
end script
server {
listen 80;
root /srv/webplatform/h/h/;
server_name notes.webplatform.org;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location ~ ^/assets/(.*)$ {
expires max;
alias /srv/webplatform/h/h/$1;
add_header Access-Control-Allow-Origin *;
}
# See also:
# - https://www.varnish-cache.org/docs/3.0/tutorial/websockets.html
# - http://thruflo.com/post/23226473852/websockets-varnish-nginx
# ... but we should upgrade to NGINX 1.3+
#
location / {
#proxy_pass http://unix:/tmp/hypothesis.sock:/;
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
#
# Reference:
# - https://github.com/hypothesis/h/blob/develop/INSTALL.Ubuntu.rst
#
include:
- nodejs
- git
- hypothesis.nginx
openjdk-7-jdk-package:
pkg.installed:
- names:
- openjdk-7-jre-headless
- openjdk-7-jdk
hypothesis-service:
service:
- running
- name: hypothesis
- enable: True
- reload: true
- require:
- git: hypothesis-checkout
- pkg: hypothesis-dependencies
- file: /etc/init/hypothesis.conf
- watch:
- file: /srv/webplatform/h/h.ini
#/tmp/hypothesis.sock
#... make sure it has service with right user
#...
/srv/webplatform/h/h/favicon.ico:
file.managed:
- source: salt://hypothesis/files/favicon.ico
hypothesis-dependencies:
pkg.installed:
- names:
- python-yaml
- python-dev
- python-pip
- python-virtualenv
- git
- libpq-dev
- make
- rubygems
- ruby-full
- build-essential
- nodejs
- npm
- python-mysqldb
# pip install pyyaml
# gem install sass
# http://acervulus.info/2012/how-to-install-sass-on-ubuntu-precise-12-04-lts/
# gem install compass
required-gems:
cmd.run:
- name: gem install compass sass
- unless: /srv/webplatform/h/h.ini
- require:
- pkg: rubygems
# current latest on develop branch as per 20140324
hypothesis-checkout:
git.latest:
- name: https://github.com/hypothesis/h.git
- rev: 5f46920242dee15f2059
- target: /srv/webplatform/h
- unless: test -f /srv/webplatform/h/h.ini
- require:
- file: /srv/webplatform/h
- cmd: required-gems
- pkg: git
cmd.run:
- name: ./bootstrap
- cwd: /srv/webplatform/h
- require:
- git: hypothesis-checkout
- pkg: python-pip
# Make SURE this file exists, its required
# by the /etc/init/hypothesis.conf init script
/srv/webplatform/h/h.ini:
file.managed:
- template: jinja
- source: salt://hypothesis/files/h.ini.jinja
- require:
- file: /srv/webplatform/h
- git: hypothesis-checkout
/srv/webplatform/h:
file.directory:
- makedirs: True
/etc/init/hypothesis.conf:
file.managed:
- source: salt://hypothesis/files/hypothesis.init
- user: root
- group: root
- mode: 644
- requires:
- file: /srv/webplatform/h
- git: hypothesis-checkout
- file: /srv/webplatform/h/h.ini
npm-packages:
npm.installed:
- names:
- uglify-js
- clean-css
- coffee-script
- require:
- pkg: npm
2014-03-27 21:09:37,170 INFO  [h.streamer] An error occured during the match checking or the annotation sending phase.
2014-03-27 21:09:37,170 INFO  [h.streamer] {'updated': '2014-03-27T21:09:37.091141+00:00', 'target': [{'source': 'http://www.w3.org/2014/annotation/experiment/webaudio.html', 'showDiff': False, 'selector': [{'type': 'RangeSelector', 'startContainer': '/div[3]/p[1]/em[1]', 'endContainer': '/div[3]/p[1]/em[1]', 'startOffset': 128, 'endOffset': 147}, {'type': 'TextQuoteSelector', 'prefix': 'ts may supersede this document.', 'exact': 'A list of current W', 'suffix': '3C publications and the latest r'}, {'start': 1393, 'end': 1412, 'type': 'TextPositionSelector'}], '$$hashKey': '03R', 'quote': 'A list of current W'}], 'parent': {}, 'created': '2014-03-27T21:09:37.091109+00:00', 'quote': 'A list of current W', 'title': 'Web Audio API', 'favicon_link': '', 'uri': 'http://www.w3.org/2014/annotation/experiment/webaudio.html', 'source_stripped': 'w3.org', 'source': 'http://www.w3.org/', 'user': 'acct:renoirb@notes.webplatform.org', 'text': 'I hope those tests wont spam all over the place.', 'permissions': {'read': ['group:__world__', 'acct:renoirb@notes.webplatform.org'], 'admin': ['acct:renoirb@notes.webplatform.org'], 'update': ['acct:renoirb@notes.webplatform.org'], 'delete': ['acct:renoirb@notes.webplatform.org']}, 'document': {'eprints': {}, 'title': 'Web Audio API', 'twitter': {}, 'dc': {}, 'prism': {}, 'highwire': {}, 'facebook': {}, 'reply_to': ['public-audio-comments@w3.org'], 'link': [{'href': 'http://www.w3.org/2014/annotation/experiment/webaudio.html'}]}, 'consumer': '00000000-0000-0000-0000-000000000000', 'id': 'rbX3nIK5SviYm70hpORbtQ', 'reply_list': []}
2014-03-27 21:09:37,170 INFO  [h.streamer] <h.streamer.FilterHandler object at 0x4227310>
2014-03-27 21:09:37,171 INFO  [h.streamer] Traceback (most recent call last):
  File "/srv/webplatform/h/h/streamer.py", line 486, in after_action
    if not (flt and flt.match(annotation, action)):
  File "/srv/webplatform/h/h/streamer.py", line 381, in match
    return getattr(self, self.filter['match_policy'])(target)
  File "/srv/webplatform/h/h/streamer.py", line 360, in include_any
    if self.evaluate_clause(clause, target): return True
  File "/srv/webplatform/h/h/streamer.py", line 318, in evaluate_clause
    field_value = resolve_pointer(target, clause['field'], None)
  File "/srv/webplatform/h/local/lib/python2.7/site-packages/jsonpointer.py", line 102, in resolve_pointer    pointer = JsonPointer(pointer)  File "/srv/webplatform/h/local/lib/python2.7/site-packages/jsonpointer.py", line 112, in __init__    raise JsonPointerException('location must starts with /')JsonPointerException: location must starts with /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment