2010-11-28 15:06:48 +00:00
|
|
|
pan.do/ra - open media archive
|
|
|
|
|
2011-11-03 12:32:23 +00:00
|
|
|
== SETUP ==
|
2012-04-19 12:43:54 +00:00
|
|
|
pan.do/ra is known to work with Ubuntu 12.04, older versions of
|
2012-06-11 10:25:10 +00:00
|
|
|
Ubuntu or other distributions should also work.
|
2012-04-19 12:43:54 +00:00
|
|
|
|
|
|
|
To setup pan.do/ra, you need python, bazaar, pip and virtualenv
|
|
|
|
and several other python modules:
|
2010-11-28 15:06:48 +00:00
|
|
|
|
|
|
|
* Packages
|
2012-04-19 12:43:54 +00:00
|
|
|
(add pandora ppa to get all packages in the required version)
|
|
|
|
|
2011-12-19 19:42:18 +00:00
|
|
|
apt-get install python-software-properties
|
|
|
|
add-apt-repository ppa:j/pandora
|
|
|
|
apt-get update
|
|
|
|
|
2012-04-19 12:43:54 +00:00
|
|
|
(install dependencies)
|
2011-10-18 09:08:09 +00:00
|
|
|
apt-get install bzr git subversion mercurial \
|
|
|
|
python-setuptools python-pip python-virtualenv ipython \
|
2011-12-03 16:17:07 +00:00
|
|
|
python-dev python-imaging python-numpy python-psycopg2 \
|
2011-12-26 14:30:30 +00:00
|
|
|
python-geoip python-html5lib python-lxml \
|
2012-06-11 10:25:10 +00:00
|
|
|
python-gst0.10 gstreamer0.10-plugins-good gstreamer0.10-plugins-bad \
|
2012-04-19 12:43:54 +00:00
|
|
|
postgresql postgresql-contrib rabbitmq-server \
|
|
|
|
ffmpeg2theora ffmpeg \
|
2012-06-11 10:25:10 +00:00
|
|
|
python-ox oxframe
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2011-11-03 12:32:23 +00:00
|
|
|
* Pan.do/ra
|
|
|
|
Get code from bazzar
|
2012-04-19 12:43:54 +00:00
|
|
|
cd /srv/
|
2010-07-03 11:14:16 +00:00
|
|
|
bzr branch http://code.0x2620.org/pandora pandora
|
2010-02-16 10:22:34 +00:00
|
|
|
cd pandora
|
2012-05-17 09:38:59 +00:00
|
|
|
virtualenv --system-site-packages .
|
2009-12-31 15:04:32 +00:00
|
|
|
pip -E . install -r requirements.txt
|
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
cd static
|
|
|
|
bzr branch http://code.0x2620.org/oxjs
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2012-04-22 19:43:15 +00:00
|
|
|
create local_settings.py and create config.jsonc in /srv/pandora/pandora
|
2012-04-19 12:43:54 +00:00
|
|
|
do noy copy settings.py but only add your changes to local_settings.py
|
2012-03-23 20:57:43 +00:00
|
|
|
(check https://wiki.0x2620.org/wiki/pandora/configuration
|
2012-04-20 10:22:32 +00:00
|
|
|
and use settings.py / config.jsonc / config.*.jsonc as example)
|
2012-03-23 20:57:43 +00:00
|
|
|
|
2012-04-19 12:43:54 +00:00
|
|
|
create and configure database as described below
|
|
|
|
after that
|
2011-11-03 12:32:23 +00:00
|
|
|
|
|
|
|
create / update static files
|
|
|
|
|
2012-06-11 10:25:10 +00:00
|
|
|
./manage.py collectstatic -l --noinput
|
2011-11-03 12:32:23 +00:00
|
|
|
./manage.py update_static
|
|
|
|
./manage.py compile_pyc
|
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
* Database
|
|
|
|
We use postgresql but other databases might also work
|
|
|
|
(make sure you have the python bindings installed).
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2012-03-30 14:57:07 +00:00
|
|
|
create a postgresql database
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2012-03-30 14:57:07 +00:00
|
|
|
sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora
|
2011-10-11 17:44:45 +00:00
|
|
|
|
2011-11-03 12:32:23 +00:00
|
|
|
(setting locale to C is required to fix a bug in sort if set to UTF8)
|
|
|
|
|
2012-03-30 14:57:07 +00:00
|
|
|
now add settings to local_settings.py:
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'NAME': 'pandora',
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'USER': 'pandora',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
and run ./manage.py syncdb to populate the database.
|
|
|
|
|
|
|
|
Optionaly use pg_trgm to improve find speed (requires postgres 9.1 and postgresql-contrib)
|
|
|
|
|
|
|
|
echo "CREATE EXTENSION pg_trgm;" | sudo -u postgres psql pandora
|
|
|
|
./manage.py sqlfindindex | ./manage.py dbshell
|
|
|
|
echo "DB_GIN_TRGM = True" >> local_settings.py
|
|
|
|
|
|
|
|
|
2012-04-19 12:43:54 +00:00
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
* RabbitMQ
|
2012-03-30 14:57:07 +00:00
|
|
|
For background tasks RabbitMQ is required, to install rabbitmq:
|
|
|
|
|
2009-12-31 15:04:32 +00:00
|
|
|
sudo apt-get install rabbitmq-server
|
2010-11-28 15:06:48 +00:00
|
|
|
|
|
|
|
and create permissions according to BROKER_* in local_settings.py i.e.:
|
|
|
|
|
2010-06-25 11:53:57 +00:00
|
|
|
sudo rabbitmqctl add_user pandora box
|
2010-02-16 10:22:34 +00:00
|
|
|
sudo rabbitmqctl add_vhost /pandora
|
2010-06-25 11:53:57 +00:00
|
|
|
sudo rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2012-03-30 14:57:07 +00:00
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
* H264
|
2012-04-19 12:43:54 +00:00
|
|
|
for h264 videos, you need ffmpeg with x264 and libfaac enabled,
|
2012-03-30 14:57:07 +00:00
|
|
|
you also need to install qt-faststart (from ffmpeg/tools)
|
2012-04-19 12:43:54 +00:00
|
|
|
(you can use medibuntu.org packages or compile ffmpeg yourself)
|
2012-03-30 14:57:07 +00:00
|
|
|
to enable h264 derivatives add "mp4" to video.formats in your config.jsonc
|
|
|
|
|
2009-12-31 15:04:32 +00:00
|
|
|
|
2012-03-23 20:57:43 +00:00
|
|
|
== Deployment ==
|
2011-11-03 12:32:23 +00:00
|
|
|
* Install upstart scripts
|
|
|
|
check etc/init for upstart scripts, adjust path and user and put into /etc/init
|
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
To run pan.do/ra in production, we use nginx, using apache2 is also possible.
|
2010-11-26 15:07:24 +00:00
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
* nginx setup
|
2010-11-14 21:49:16 +00:00
|
|
|
sudo apt-get install nginx
|
2010-02-16 12:41:57 +00:00
|
|
|
|
2011-11-03 12:32:23 +00:00
|
|
|
add this to local_settings.py:
|
|
|
|
XACCELREDIRECT = True
|
|
|
|
|
|
|
|
setup nginx according to etc/nginx/vhost.in
|
|
|
|
|
2010-11-28 15:06:48 +00:00
|
|
|
* apache2 setup
|
2011-11-03 12:32:23 +00:00
|
|
|
apt-get install apache2-mpm-prefork libapache2-mod-xsendfile
|
|
|
|
|
|
|
|
add this to local_settings.py:
|
|
|
|
XSENDFILE = True
|
2010-09-07 13:08:23 +00:00
|
|
|
|
2011-11-03 12:32:23 +00:00
|
|
|
setup apache according to etc/apache2/vhost.in
|
2010-12-24 10:31:44 +00:00
|
|
|
|
2012-04-19 12:43:54 +00:00
|
|
|
now you can start pandora services:
|
|
|
|
service pandora start
|
|
|
|
service pandora-tasks start
|
|
|
|
service pandora-encoding start
|
|
|
|
|
2012-03-23 20:57:43 +00:00
|
|
|
=== Updating ===
|
|
|
|
To update a pandora installation get the latest version from bzr by running
|
|
|
|
./update.sh
|
|
|
|
|
|
|
|
this will update pandora/oxjs/python-ox and list possible upgrades to the db
|
|
|
|
|
|
|
|
to update your database tables, use
|
|
|
|
./manage.py sqldiff -a
|
|
|
|
to check if there are changes and
|
|
|
|
./manage.py sqldiff -a | ./manage.py dbshell
|
|
|
|
to apply them.
|
|
|
|
|
|
|
|
=== Development ===
|
|
|
|
in one terminal:
|
|
|
|
./manage.py runserver
|
2012-03-30 14:57:07 +00:00
|
|
|
|
|
|
|
and background task in another:
|
2012-06-11 10:25:10 +00:00
|
|
|
./manage.py celeryd -B -Q celery,default,encoding
|
2012-03-30 14:57:07 +00:00
|
|
|
|