taming the river of news
Python JavaScript HTML Makefile Shell
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
archive archive deprecated code Feb 6, 2016
palala moved state to a sqlite db; refactored to deal with that Feb 29, 2016
.gitignore palala update; nginx push server; sse listener; api; webmention Feb 8, 2016
LICENSE initial setup for Flask environment Feb 6, 2016
Makefile moved state to a sqlite db; refactored to deal with that Feb 29, 2016
README.md moved state to a sqlite db; refactored to deal with that Feb 29, 2016
circle.yml initial setup for Flask environment Feb 6, 2016
docker-compose.yml add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
docker-nginx add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
docker-palala add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
indienews.db.sql moved state to a sqlite db; refactored to deal with that Feb 29, 2016
manage.py moved state to a sqlite db; refactored to deal with that Feb 29, 2016
palala-docker-nginx.conf add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
palala-nginx.conf moved state to a sqlite db; refactored to deal with that Feb 29, 2016
requirements-test.txt add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
requirements.txt add webtests; fix manage.py for test calling; add docker support Feb 27, 2016
setup.cfg initial setup for Flask environment Feb 6, 2016
uwsgi-app.py moved state to a sqlite db; refactored to deal with that Feb 29, 2016
wait_for_ip.sh add webtests; fix manage.py for test calling; add docker support Feb 27, 2016

README.md

palala - taming the river of news

Circle CI Requirements Status codecov.io

Local Development Environment

Currently I'm assuming an OS X environment as that is what I am using...

brew tap homebrew/nginx
brew install nginx-full --with-push-stream-module
brew install uwsgi --with-python

cd /path/to/your/palala
pyenv install 2.7.11
pyenv virtualenv 2.7.11 palala
make update-all

Example Nginx config

# palala.conf
#
# With a homebrew installed nginx:
#     /usr/local/etcc/nginx/servers/
#     ~/homebrew/etc/nginx/servers/
# On a Debian/Ubuntu installed nginx:
#     /etc/nginx/conf.d/
# Currently assumes uwsgi config
#
# configuration items for http block
#
#   charset     utf-8;
#   client_max_body_size 75M;
#   push_stream_shared_memory_size 100m;
#
upstream uwsgicluster {
    server 127.0.0.1:5080;
}
server {
    listen      8080;
    server_name palala.org;

    location / {
        try_files $uri @palala_web;
    }
    location @palala_web {
        include            uwsgi_params;
        uwsgi_pass         uwsgicluster;

        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
    }

    # endpoint to push events to clients
    location /pub {
        # activate publisher (admin) mode for this location
        push_stream_publisher admin;

        # query string based channel id
        push_stream_channels_path               $arg_id;
    }
    # endpoint SSE clients subscribe to
    location ~ /ev/(.*) {
        # activate event source mode for this location
        push_stream_subscriber eventsource;

        # positional channel path
        push_stream_channels_path                   $1;
        # message template
        push_stream_message_template                "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";

        # ping frequency
        push_stream_ping_message_interval           10s;
    }

}

Testing the webmention handler - this assumes that you have a /etc/hosts entry to make palala.org to 127.0.0.1

./sm.py http://webmention.tools/test1.html

Testing the nginx push stream module - this assumes that you have a /etc/hosts entry to make palala.org to 127.0.0.1

make uwsgi
make server
open http://palala.org:8080/en
curl http://palala.org:8080/pub?id=push -d "Some Text"