Setting up morss (Full Text RSS Expander) on Debian Wheezy

  1. Install Debian Wheezy
  2. Install git apt-get install git
  3. Install dependencies
    Python: apt-get install python-pip python-dev build-essential libxml2-dev libxslt-dev python-dev
  4. Install the morss requirements: pip install -r requirements.txt Or install the Python packages individually:
    a. lxml: pip install lxml
    b. readability: pip install readability-lxml
    c. dateutil: pip install python-dateutil (this might not work as you need <= 1.5, see (4))
    d. html2text: pip install html2text
  5. Clone project: git clone https://github.com/pictuga/morss/morss.git
  6. Make /morss/morss.py executable chmod +x morss.py
  7. You should be able to just run ./morss.py and access it via a browser at http://<YOUR IP ADDRESS>
Setting up uWSGI
  1. Set up a virtualenv for morss
    a. I chose not to have the app in a separate directory as I couldn't figure out how to correctly set the paths to make it run
    a. Clone project into the current www directory git clone https://github.com/pictuga/morss/morss.git
    b. cd /var/www/morss
    c. virtualenv morss_venv

  2. Since we're going to run it in server mode, we will move all the files to the root /var/www/morss

     mv morss/* .
     mv www/* .
    
  3. Activate the interpreter inside the virtual environment: source morss_venv/bin/activate

  4. Set up uWSGI
    a. pip install uwsgi
    b. Since the Virtual Environment is self contained, grab the morss requirements: pip install -r requirements.txt
    c. Test to see if it works, run uwsgi --http-socket :8080 --wsgi-file morss.py --callable cgi_wrapper
    d. Access http://<YOUR IP>:8080 and you should get the morss default page.
    morss default page

Setting up nginx to connect to uWSGI
  1. Create a new nginx config file for morss with the following, Example configuration for webapplications:

     location / {
             include            uwsgi_params;
             uwsgi_pass         uwsgicluster; #OR THE <IP ADDRESS>:<PORT> OF MORSS SERVER
    
             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;
    
     }
    
  2. Launch uWSGI with uwsgi --socket :8080 --file morss.py --callable cgi_wrapper

  3. nginx should now be serving up everything at http://<NGINX X SERVER IP>

Setting up uWSGI to run automatically
  1. Use the init script found here

     		wget https://raw.githubusercontent.com/pir2/morss/master/morss.sh
             mv morss.sh /etc/init.d/morss
             chmod +x /etc/init.d/morss
             update-rc.d morss defaults
    
  2. Start the new init script service morss start


References:
http://serverfault.com/questions/411361/uwsgi-ini-configuration-for-python-apps

http://kuttler.eu/code/debian-init-script-virtualenv-gunicorn-django/