pandora/README.md

177 lines
4.6 KiB
Markdown
Raw Normal View History

2016-04-15 14:21:24 +02:00
# pan.do/ra - open media archive
2016-04-15 14:21:24 +02:00
for more information on pan.do/ra visit our website at https://pan.do/ra
2016-04-15 14:21:24 +02:00
## SETUP
2017-08-21 21:08:29 +02:00
pan.do/ra is known to work with Ubuntu 16.04,
but other distributions might also work.
2017-11-03 17:34:03 +01:00
The instructions below are for Ubuntu 16.04.
All command given expect that you are root.
2016-04-15 14:21:24 +02:00
To run pan.do/ra you need to install and setup:
2017-02-16 13:49:22 +01:00
python 3.5
postgres
nginx (or apache2)
2017-11-03 17:34:03 +01:00
additional video packages
2012-04-19 14:43:54 +02:00
2016-04-15 14:21:24 +02:00
## Installing required packages
1) add pandora ppa to get all packages in the required version
2012-04-19 14:43:54 +02:00
apt-get install software-properties-common
2011-12-20 01:12:18 +05:30
add-apt-repository ppa:j/pandora
apt-get update
2) install all required packages
2016-04-15 14:21:24 +02:00
2017-08-21 21:08:29 +02:00
apt-get install git \
2017-11-02 21:08:17 +00:00
python3-setuptools python3-pip python3-venv ipython3 \
2017-02-16 13:49:22 +01:00
python3-dev python3-pil python3-numpy python3-psycopg2 \
2017-08-21 21:08:29 +02:00
python3-pyinotify python3-simplejson \
2017-02-16 13:49:22 +01:00
python3-geoip python3-html5lib python3-lxml \
2012-04-19 14:43:54 +02:00
postgresql postgresql-contrib rabbitmq-server \
poppler-utils mkvtoolnix gpac imagemagick \
2017-08-21 21:08:29 +02:00
youtube-dl python3-ox oxframe ffmpeg
2016-04-15 14:21:24 +02:00
## Prepare Environment
1) add pandora user and set permissions
2016-04-15 14:21:24 +02:00
adduser pandora --disabled-login --disabled-password
2) Setup Database
2016-04-15 14:21:24 +02:00
su postgres
createuser pandora
createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora
echo "CREATE EXTENSION pg_trgm;" | psql pandora
exit
3) Setup RabbitMQ
2016-04-15 14:21:24 +02:00
You have to use the same password here and in BROKER_URL in local_settings.py
2015-01-19 18:52:04 +01:00
rabbitmqctl add_user pandora PASSWORD
rabbitmqctl add_vhost /pandora
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
2016-04-15 14:21:24 +02:00
## Install Pan.do/ra
2015-11-14 15:22:40 +01:00
1) Get code from git
2016-04-15 14:21:24 +02:00
2012-04-19 14:43:54 +02:00
cd /srv/
2016-03-11 10:33:23 +01:00
git clone https://git.0x2620.org/pandora.git pandora
cd pandora
./ctl init
2009-12-31 16:04:32 +01:00
cd /srv
chown -R pandora.pandora pandora
2) create local_settings.py and config.jsonc
2.1) create file /srv/pandora/pandora/local_settings.py with the following content:
2016-04-15 14:21:24 +02:00
DATABASES = {
'default': {
'NAME': 'pandora',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'pandora',
'PASSWORD': '',
}
}
DB_GIN_TRGM = True
2015-01-19 18:52:04 +01:00
BROKER_URL = 'amqp://pandora:PASSWORD@localhost:5672//pandora'
#with apache x-sendfile or lighttpd set this to True
XSENDFILE = False
#with nginx X-Accel-Redirect set this to True
XACCELREDIRECT = True
2.2) create config.jsonc
2016-04-15 14:21:24 +02:00
config.jsonc holds the configuration for your site.
To start you can copy /srv/pandora/pandora/config.pandora.jsonc
to /srv/pandora/pandora/config.jsonc but have a look at
https://wiki.0x2620.org/wiki/pandora/configuration and
config.0xdb.jsonc config.padma.jsonc for configuration options.
3) initialize database
2016-04-15 14:21:24 +02:00
su pandora
cd /srv/pandora/pandora
./manage.py init_db
4) install init scripts and start daemons
/srv/pandora/ctl install
2013-07-10 16:14:48 +00:00
/srv/pandora/ctl start
5) Setup Webserver
a) nginx (recommended)
2016-04-15 14:21:24 +02:00
apt-get install nginx
cp /srv/pandora/etc/nginx/pandora /etc/nginx/sites-available/pandora
cd /etc/nginx/sites-enabled
ln -s ../sites-available/pandora
#read comments in /etc/nginx/sites-available/pandora for setting
#your hostname and other required settings
#make sure XACCELREDIRECT = True in /srv/pandora/pandora/local_settings.py
service nginx reload
2012-04-19 14:43:54 +02:00
b) apache2 (if you need it for other sites on the same server)
2016-04-15 14:21:24 +02:00
apt-get install apache2-mpm-prefork libapache2-mod-xsendfile
a2enmod xsendfile
2015-03-28 19:08:32 +01:00
a2enmod proxy_http
a2enmod proxy_wstunnel
cp /srv/pandora/etc/apache2/pandora.conf /etc/apache2/sites-available/pandora.conf
a2ensite pandora
#read comments in /etc/apache2/sites-available/pandora.conf for setting
#your hostname and other required settings
#make sure XSENDFILE = True in /srv/pandora/pandora/local_settings.py
service apache2 reload
2016-04-15 14:21:24 +02:00
Now you can open pandora in your browser, the first user to sign up will become admin.
## Updating
2017-08-21 21:08:29 +02:00
To update pandora to the latest development version run this:
2016-04-15 14:21:24 +02:00
su pandora
cd /srv/pandora
2017-08-21 21:08:29 +02:00
./update.py dev
2016-04-15 14:21:24 +02:00
this will update pandora/oxjs/python-ox and list possible upgrades to the db
2009-12-31 16:04:32 +01:00
2016-04-15 14:21:24 +02:00
to update your database run:
2016-04-15 14:21:24 +02:00
su pandora
cd /srv/pandora
./update.py db
2016-04-15 14:21:24 +02:00
## Development
in one terminal:
2016-04-15 14:21:24 +02:00
./manage.py runserver 2620
and background task in another:
2016-04-15 14:21:24 +02:00
./manage.py celeryd -B -Q celery,default,encoding -l INFO
now you can access your local pandora instace at http://127.0.0.1:8000/
2017-10-24 21:24:04 +02:00
we use virtual machines/lxc for development and deployment,
2018-03-16 13:55:29 +05:30
more info on that in vm/LXC_README.md