1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
pan.do/ra - open media archive
for more information on pan.do/ra visit our website at https://pan.do/ra
== SETUP ==
pan.do/ra is known to work with Ubuntu 12.04,
but other distributions should also work.
The instructions below are for Ubuntu 12.04.
All commans given expect that you are root.
To run pan.do/ra you need to install and setup:
python
postgres
nginx (or apache2)
additinal video packages
* Installing required packages
1) add pandora ppa to get all packages in the required version
apt-get install python-software-properties
add-apt-repository ppa:j/pandora
apt-get update
2) install all required packages
apt-get install bzr git subversion mercurial \
python-setuptools python-pip python-virtualenv ipython \
python-dev python-imaging python-numpy python-psycopg2 \
python-geoip python-html5lib python-lxml \
python-gst0.10 gstreamer0.10-plugins-good gstreamer0.10-plugins-bad \
postgresql postgresql-contrib rabbitmq-server \
ffmpeg2theora libav-tools libavcodec-extra-53 \
python-ox oxframe imagemagick poppler-utils ufraw-batch ufraw oshash
* Prepare Environment
1) add pandora user and set permissions
adduser pandora --disabled-login --disabled-password
2) Setup Database
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
Important: "use_your_own" is a password and you have to use the same value here and below for BROKER_PASSWORD
rabbitmqctl add_user pandora use_your_own
rabbitmqctl add_vhost /pandora
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
* Install Pan.do/ra
1) Get code from bazzar
cd /srv/
bzr branch https://code.launchpad.net/~wafaa-mohamed/pandora-image/dev pandora
cd pandora
virtualenv --system-site-packages .
./bin/pip install -r requirements.txt
cd static
bzr branch https://code.launchpad.net/~wafaa-mohamed/oxjs-image/dev oxjs
cd /srv
chown -R pandora.pandora pandora
2) create local_settings.py and config.jsonc
1) create file /srv/pandora/pandora/local_settings.py with the following content:
DATABASES = {
'default': {
'NAME': 'pandora',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'pandora',
'PASSWORD': '',
}
}
DB_GIN_TRGM = True
BROKER_PASSWORD = "use_your_own"
#with apache x-sendfile or lighttpd set this to True
XSENDFILE = False
#with nginx X-Accel-Redirect set this to True
XACCELREDIRECT = True
#refer to site configuration file using
SITE_CONFIG = '/srv/pandora/pandora/pandora_image.jsonc'
2) create config.jsonc
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.
#If you want some filters like (event, month and day) of the photo, you can add them to config.yoursite.jsonc file by adding the following lines after "itemKeys": [
A) Add their fields by adding the following lines after "itemKeys": [
{
"id": "event",
"title": "Event",
"type": "text"
},
{
"id": "month",
"title": "Month",
"type": "text"
},
{
"id": "photos_day",
"title": "Day",
"type": "text"
},
{
"id": "collection",
"title": "Collection",
"type": "text"
},
B) Then, add their filters by adding the following lines after "filters": [
{"id": "event", "sort": [{"key": "items", "operator": "-"}]},
{"id": "month", "sort": [{"key": "items", "operator": "-"}]},
{"id": "photos_day", "sort": [{"key": "items", "operator": "-"}]},
3) initialize database
su pandora
cd /srv/pandora/pandora
./manage.py syncdb --noinput
./manage.py migrate
./manage.py sqlfindindex
./manage.py sync_itemsort
./manage.py collectstatic -l --noinput
./manage.py update_static
./manage.py compile_pyc
4) install init scripts and start daemons
cp /srv/pandora/etc/init/*.conf /etc/init/
/srv/pandora/ctl start
5) Setup Webserver
a) nginx (recommended)
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
b) apache2 (if you need it for other sites on the same server)
apt-get install apache2-mpm-prefork libapache2-mod-xsendfile
a2enmod xsendfile
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
Now you can open pandora in your browser by typing http://127.0.0.1 the first user to sign up will become admin.
PANDORA_CLIENT
================
--> Install the ufraw-batch package in your system if you are going to upload images with format CR2 or NEF
apt-get install ufraw-batch
1) Download the final revison from bzr
1- First we will download the ox package as dependency separately till figure out how to pass url of private repository to install_requires in the setup.py file of pandora_client. Go to you home directory and run the following commands:
bzr branch https://code.launchpad.net/~wafaa-mohamed/python-ox-image/dev ox
cd ox
python setup.py install
2- Now the ox is installed. To install pandora_client, run these following commands from your home directory:
bzr branch https://code.launchpad.net/~wafaa-mohamed/pandora-client-image/dev pandora_client
cd pandora_client
python setup.py install
2) Usage
pandora_client config
enter api url of your pandora server(i.e. https://pad.ma/api/), username, password
pandora_client add_volume <name of volume> </path/to/volume>
add or update a volume that should be scanned for files, if you added a volume with that name previously, it will update the path.
pandora_client scan
scan all available volumes for changes
pandora_client sync
sync information about files with server
pandora_client upload
encode and upload videos that are needed
=== Updating ===
To update a pandora installation get the latest version from bzr by running
su pandora
cd /srv/pandora
./update.py
this will update pandora/oxjs/python-ox and list possible upgrades to the db
to update your database tables, use
su pandora
cd /srv/pandora/pandora
./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
and background task in another:
./manage.py celeryd -B -Q celery,default,encoding
now you can access your local pandora instace at http://127.0.0.1:8000/
we use virtual machines for development, you can get a vm from our site
or use the script in vm/build.sh to create one.
|