update docs and example nginx/apache config

This commit is contained in:
j 2010-11-28 16:06:48 +01:00
parent 40e537a027
commit 5d205f2aee
5 changed files with 63 additions and 49 deletions

87
README
View file

@ -1,56 +1,67 @@
To setup a local instance of pandora: pan.do/ra - open media archive
== DEVELOPMENT ==
To setup a development instance of pan.do/ra,
you need python, bazaar, pip and virtualenv and several other python modules:
* Packages
apt-get install python-setuptools python-pip python-virtualenv ipython
apt-get install python-dev python-imaging python-numpy python-psycopg2 python-pip python-vir
bzr branch http://code.0x2620.org/pandora pandora bzr branch http://code.0x2620.org/pandora pandora
cd pandora cd pandora
virtualenv . virtualenv .
pip -E . install -r requirements.txt pip -E . install -r requirements.txt
cd static
bzr branch http://code.0x2620.org/oxjs
you need python, bazaar, pip and virtualenv: * Additional pandora tools:
You need current versions of mkvtoolnix, oxframe, oxtimeline installed.
For Ubuntu we provide these packages in a ppa:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:j/pandora
sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update
sudo apt-get install oxframe oxtimeline mkvtoolnix
apt-get install python-setuptools bzr * Database
easy_install pip We use postgresql but other databases might also work
pip install virtualenv (make sure you have the python bindings installed).
apt-get install python-dev python-imaging python-numpy
also it uses system python moduels, so make sure you have create a postgresql database and adjust settings in local_settings.py
ipython, dbmodule(psycopg2, python-mysqldb,..) and run python manage.py syncdb to populate the database
installed via apt-get/pip/easy_install in your system path. you might want to load example configurations from fixutes.
Install rabbitmq and carrot: * RabbitMQ
For background tasks we use RabbitMQ, to install rabbitmq:
sudo apt-get install rabbitmq-server sudo apt-get install rabbitmq-server
and create permissions according to BROKER_* in local_settings.py i.e.:
sudo rabbitmqctl add_user pandora box sudo rabbitmqctl add_user pandora box
sudo rabbitmqctl add_vhost /pandora sudo rabbitmqctl add_vhost /pandora
sudo rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*" sudo rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
* H264
update BROKER_* settings in local_settings.py: to support h264 videos, install ffmpeg with x264 enabled,
install qt-faststart from (ffmpeg/tools)
get current oxjs
cd static
bzr branch http://code.0x2620.org/oxjs
Database:
with postresql install python-psycopg2
Development:
we are using django, http://docs.djangoproject.com/en/dev/
Nginx setup:
sudo apt-get install nginx
or if you use apache:
sudo apt-get install libapache2-mod-xsendfile
add pandora repository:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:j/pandora
sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update
sudo apt-get install oxtools mkvtoolnix
H264:
install ffmpeg with x264 enabled, install qt-faststart from (ffmpeg/tools)
set VIDEO_H264 = True in local_settings.py set VIDEO_H264 = True in local_settings.py
Running developer environment:
in one terminal:
python manage.py runserver
and in another one:
python manage.py celeryd -Q default,encoding
== DEPLOYMENT ==
To run pan.do/ra in production, we use nginx, using apache2 is also possible.
* nginx setup
sudo apt-get install nginx
* apache2 setup
sudo apt-get install apache2-mpm-prefork
sudo apt-get install libapache2-mod-xsendfile

View file

@ -14,16 +14,18 @@
</Location> </Location>
Alias /.bzr __PREFIX__/.bzr Alias /.bzr __PREFIX__/.bzr
Alias /static __PREFIX__/pandora/static Alias /static __PREFIX__/static
Alias /favicon.ico __PREFIX__/pandora/static/favicon.ico Alias /favicon.ico __PREFIX__/static/favicon.ico
Alias /media __PREFIX__/pandora/media Alias /data __PREFIX__/data
Alias /admin/media __PREFIX__/src/django/django/contrib/admin/media Alias /admin/media __PREFIX__/src/django/django/contrib/admin/media
Alias /static/js/jquery.js __PREFIX__/src/django/django/contrib/admin/media/js/jquery.min.js Alias /static/js/jquery.js __PREFIX__/src/django/django/contrib/admin/media/js/jquery.min.js
WSGIScriptAlias / __PREFIX__/wsgi/django.wsgi RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.bzr
WSGIDaemonProcess pandora user=pandora group=pandora threads=25 python-path=__PREFIX__/lib/python2.6/site-packages/ RewriteCond %{REQUEST_URI} !^/static
WSGIProcessGroup pandora RewriteCond %{REQUEST_URI} !^/data
RewriteCond %{REQUEST_URI} !^/admin/media
RewriteRule ^/(.*) http://127.0.0.1:2620/$1 [P]
ServerSignature Off ServerSignature Off
</VirtualHost> </VirtualHost>

View file

@ -13,5 +13,5 @@ env USER=pandora
script script
cd $VENV/pandora cd $VENV/pandora
exec sudo -u $USER $VENV/bin/gunicorn_django -b 127.0.0.1:8083 -w5 $VENV/pandora/settings.py exec sudo -u $USER $VENV/bin/gunicorn_django -b 127.0.0.1:2620 -w5 $VENV/pandora/settings.py
end script end script

View file

@ -10,16 +10,16 @@ server {
autoindex on; autoindex on;
} }
location /favicon.ico { location /favicon.ico {
root __PREFIX__/pandora/static; root __PREFIX__/static;
} }
location /static { location /static/ {
root __PREFIX__/pandora; root __PREFIX__;
autoindex on; autoindex on;
} }
location /media/ { location /data/ {
internal; internal;
root __PREFIX__/pandora/; root __PREFIX__;
} }
location / { location / {
@ -28,7 +28,7 @@ server {
proxy_redirect off; proxy_redirect off;
if (!-f $request_filename) { if (!-f $request_filename) {
proxy_pass http://127.0.0.1:8083; proxy_pass http://127.0.0.1:2620;
break; break;
} }
} }
@ -44,6 +44,6 @@ server {
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location /50x.html { location /50x.html {
root __PREFIX__/pandora/static; root __PREFIX__/static;
} }
} }

View file

@ -11,7 +11,8 @@ if(typeof(console)=='undefined') {
console.log = function() {}; console.log = function() {};
} }
</script> </script>
<script type="text/javascript" src="/static/oxjs/build/js/jquery-1.4.2.js"></script> <script type="text/javascript" src="/static/js/jquery/jquery.js"></script>
<script type="text/javascript" src="/static/js/jquery/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="/static/js/jquery/jquery.videosupport.js"></script> <script type="text/javascript" src="/static/js/jquery/jquery.videosupport.js"></script>
<script type="text/javascript" src="/static/oxjs/build/js/ox.load.js"></script> <script type="text/javascript" src="/static/oxjs/build/js/ox.load.js"></script>
<script type="text/javascript" src="/static/oxjs/build/js/ox.js"></script> <script type="text/javascript" src="/static/oxjs/build/js/ox.js"></script>