This commit is contained in:
rolux 2011-11-08 17:22:31 +00:00
commit 4812870a30
8 changed files with 35 additions and 29 deletions

View file

@ -12,6 +12,11 @@
XSendFile on
XSendFilePath __PREFIX__
</Location>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
Alias /.bzr __PREFIX__/.bzr
Alias /static __PREFIX__/static

View file

@ -41,6 +41,7 @@ def load_config():
settings.CONFIG = config
admin = len(settings.CONFIG['userLevels']) - 1
if not 'syncdb' in sys.argv:
settings.ADMIN = tuple([(u.username, u.email)
for u in User.objects.filter(profile__level=admin)])
settings.MANAGERS = settings.ADMINS
@ -61,7 +62,11 @@ def update_static():
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
if os.path.exists(oxjs_build):
print 'update oxjs'
os.system('%s -nogeo >/dev/null' % oxjs_build)
if os.path.exists(os.path.join(settings.STATIC_ROOT, 'oxjs/build/Ox.Geo/json/Ox.Geo.json')):
geo = '-nogeo'
else:
geo = ''
os.system('%s %s >/dev/null' % (oxjs_build, geo))
data = ''
js = []

View file

@ -21,7 +21,6 @@ def serve_static_file(path, location, content_type):
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
(r'^api/upload/$', 'archive.views.firefogg_upload'),
(r'^url=(?P<url>.*)$', 'app.views.redirect_url'),
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),

View file

@ -129,6 +129,9 @@ class UserProfile(models.Model):
def user_post_save(sender, instance, **kwargs):
profile, new = UserProfile.objects.get_or_create(user=instance)
if new and instance.is_superuser:
profile.level = len(settings.CONFIG['userLevels']) - 1
profile.save()
SessionData.objects.filter(user=instance).update(level=profile.level,
username=instance.username)
models.signals.post_save.connect(user_post_save, sender=User)

View file

@ -161,7 +161,7 @@ def signup(request):
user.save()
#create default user lists:
for l in settings.CONFIG['personalLists']:
list = models.List(name=l['id'], user=user)
list = models.List(name=l['title'], user=user)
for key in ('query', 'public', 'featured'):
if key in l:
setattr(list, key, l[key])

View file

@ -2,13 +2,9 @@ Create virtual disk of pan.do/ra
== ubuntu-vm-builder setup ==
due to https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/676132
we need to use maverick-proposed repository:
echo "deb http://archive.ubuntu.com/ubuntu/ maverick-proposed restricted main multiverse universe" > /etc/apt/sources.list.d/ubunt-proposed.list
apt-get update
apt-get -t maverick-proposed install ubuntu-vm-builder
on ubuntu 11.10 you need to install python-vm-builder
apt-get install python-vm-builder
due to https://bugs.launchpad.net/vmbuilder/+bug/683614
building vbox images does not work. install virtualbox_vm.py:
@ -43,9 +39,7 @@ Pan.do/ra is installed in /srv/pandora and is served with nginx on http://pandor
== Update ==
to get the latest version of pan.do/ra
cd /srv/pandora
bzr pull
cd static/oxjs
bzr pull
./update.sh
you might have to adjust the database at this point. now restart pandora daemons

View file

@ -1,6 +1,6 @@
#!/bin/sh
base=$(pwd)
sudo vmbuilder vbox ubuntu --suite=maverick \
sudo vmbuilder vbox ubuntu --suite=oneiric \
--verbose --debug \
--arch i386 \
--dest $base/pandora \
@ -11,7 +11,6 @@ sudo vmbuilder vbox ubuntu --suite=maverick \
--pass pandora \
--components main,universe,multiverse \
--ppa j/pandora \
--ppa gstreamer-developers/ppa \
--addpkg openssh-server \
--addpkg acpid \
--addpkg vim \
@ -33,8 +32,6 @@ sudo vmbuilder vbox ubuntu --suite=maverick \
--addpkg python-numpy \
--addpkg python-psycopg2 \
--addpkg python-simplejson \
--addpkg python-transmissionrpc \
--addpkg transmission-daemon \
--addpkg oxtimeline \
--addpkg oxframe \
--addpkg mkvtoolnix \

View file

@ -12,11 +12,7 @@ chmod 755 /usr/local/bin/ffmpeg2theora
#postgresql
apt-get -y install postgresql
sudo -u postgres createuser -S -D -R pandora
sudo -u postgres createdb -O pandora pandora
#do not start systemwide transmission-daemon
/etc/init.d/transmission-daemon stop
sed -i "s/ENABLE_DAEMON=1/ENABLE_DAEMON=0/g" /etc/default/transmission-daemon
sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora
#rabbitmq
RABBITPWD=$(pwgen -n 16 -1)
@ -26,11 +22,16 @@ rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
#pandora
cat > /srv/pandora/pandora/local_settings.py << EOF
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'pandora'
DATABASE_USER = 'pandora'
DATABASES = {
'default': {
'NAME': 'pandora',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'pandora',
'PASSWORD': '',
}
}
POSTER_SERVICES=['http://data.0xdb.org/poster/']
DATA_SERVICE='http://data.0xdb.org/api/'
BROKER_PASSWORD = "$RABBITPWD"
@ -41,6 +42,8 @@ cd /srv/pandora/pandora
sudo -u pandora python manage.py syncdb --noinput
echo "UPDATE django_site SET domain = 'pandora.local', name = 'pandora.local' WHERE 1=1;" | sudo -u pandora python manage.py dbshell
sudo -u pandora python manage.py update_static
mkdir /srv/pandora/data
chown -R pandora:pandora /srv/pandora
@ -51,6 +54,6 @@ service pandora-tasks start
service pandora start
#nginx
sed "s/__PREFIX__/\/srv\/pandora/g" "/srv/pandora/nginx/vhost.in" > "/etc/nginx/sites-available/default"
sed "s/__PREFIX__/\/srv\/pandora/g" "/srv/pandora/etc/nginx/vhost.in" > "/etc/nginx/sites-available/default"
service nginx restart