- Install Debian Wheezy
- Install git
apt-get install git
- Install dependencies
Python:apt-get install python-pip python-dev build-essential libxml2-dev libxslt-dev python-dev
- 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
- Clone project:
git clone https://github.com/pictuga/morss/morss.git
- Make
/morss/morss.py
executablechmod +x morss.py
- You should be able to just run
./morss.py
and access it via a browser athttp://<YOUR IP ADDRESS>
Setting up uWSGI
-
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 currentwww
directorygit clone https://github.com/pictuga/morss/morss.git
b.cd /var/www/morss
c.virtualenv morss_venv
-
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/* .
-
Activate the interpreter inside the virtual environment:
source morss_venv/bin/activate
-
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, runuwsgi --http-socket :8080 --wsgi-file morss.py --callable cgi_wrapper
d. Accesshttp://<YOUR IP>:8080
and you should get the morss default page.
Setting up nginx to connect to uWSGI
-
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; }
-
Launch uWSGI with
uwsgi --socket :8080 --file morss.py --callable cgi_wrapper
-
nginx should now be serving up everything at
http://<NGINX X SERVER IP>
Setting up uWSGI to run automatically
-
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
-
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/