From 0eeb3e223d59bc508f4d57d1e573ec65496b0bce Mon Sep 17 00:00:00 2001
From: j <0x006A@0x2620.org>
Date: Tue, 8 Nov 2011 18:05:26 +0100
Subject: [PATCH] update vm build. use title for new lists not id, also make
first user admin
---
etc/apache2/vhost.conf.in | 5 +++++
pandora/app/config.py | 13 +++++++++----
pandora/urls.py | 1 -
pandora/user/models.py | 3 +++
pandora/user/views.py | 2 +-
vm/README.txt | 12 +++---------
vm/build.sh | 5 +----
vm/firstboot.sh | 23 +++++++++++++----------
8 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/etc/apache2/vhost.conf.in b/etc/apache2/vhost.conf.in
index 802ba224..66abe8ed 100644
--- a/etc/apache2/vhost.conf.in
+++ b/etc/apache2/vhost.conf.in
@@ -12,6 +12,11 @@
XSendFile on
XSendFilePath __PREFIX__
+ ProxyRequests Off
+
+ Order deny,allow
+ Allow from all
+
Alias /.bzr __PREFIX__/.bzr
Alias /static __PREFIX__/static
diff --git a/pandora/app/config.py b/pandora/app/config.py
index 60d28670..bedd8cda 100644
--- a/pandora/app/config.py
+++ b/pandora/app/config.py
@@ -41,9 +41,10 @@ def load_config():
settings.CONFIG = config
admin = len(settings.CONFIG['userLevels']) - 1
- settings.ADMIN = tuple([(u.username, u.email)
- for u in User.objects.filter(profile__level=admin)])
- settings.MANAGERS = settings.ADMINS
+ 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
def reloader_thread():
_config_mtime = 0
@@ -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 = []
diff --git a/pandora/urls.py b/pandora/urls.py
index e602c571..eb275a1c 100644
--- a/pandora/urls.py
+++ b/pandora/urls.py
@@ -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.*)$', 'app.views.redirect_url'),
(r'^file/(?P.*)$', 'archive.views.lookup_file'),
diff --git a/pandora/user/models.py b/pandora/user/models.py
index 90371058..8c581a61 100644
--- a/pandora/user/models.py
+++ b/pandora/user/models.py
@@ -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)
diff --git a/pandora/user/views.py b/pandora/user/views.py
index 8e2d58a0..388006e5 100644
--- a/pandora/user/views.py
+++ b/pandora/user/views.py
@@ -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])
diff --git a/vm/README.txt b/vm/README.txt
index 98aa01c1..ec7fb868 100644
--- a/vm/README.txt
+++ b/vm/README.txt
@@ -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
diff --git a/vm/build.sh b/vm/build.sh
index a9f7e646..facc8256 100755
--- a/vm/build.sh
+++ b/vm/build.sh
@@ -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 \
diff --git a/vm/firstboot.sh b/vm/firstboot.sh
index 09c9c7fd..64d573c9 100755
--- a/vm/firstboot.sh
+++ b/vm/firstboot.sh
@@ -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