update vm build. use title for new lists not id, also make first user admin

This commit is contained in:
j 2011-11-08 18:05:26 +01:00
parent 956854d5bc
commit 0eeb3e223d
8 changed files with 35 additions and 29 deletions

View File

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

View File

@ -41,9 +41,10 @@ def load_config():
settings.CONFIG = config settings.CONFIG = config
admin = len(settings.CONFIG['userLevels']) - 1 admin = len(settings.CONFIG['userLevels']) - 1
settings.ADMIN = tuple([(u.username, u.email) if not 'syncdb' in sys.argv:
for u in User.objects.filter(profile__level=admin)]) settings.ADMIN = tuple([(u.username, u.email)
settings.MANAGERS = settings.ADMINS for u in User.objects.filter(profile__level=admin)])
settings.MANAGERS = settings.ADMINS
def reloader_thread(): def reloader_thread():
_config_mtime = 0 _config_mtime = 0
@ -61,7 +62,11 @@ def update_static():
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py') oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
if os.path.exists(oxjs_build): if os.path.exists(oxjs_build):
print 'update oxjs' 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 = '' data = ''
js = [] js = []

View File

@ -21,7 +21,6 @@ def serve_static_file(path, location, content_type):
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
(r'^api/upload/$', 'archive.views.firefogg_upload'), (r'^api/upload/$', 'archive.views.firefogg_upload'),
(r'^url=(?P<url>.*)$', 'app.views.redirect_url'), (r'^url=(?P<url>.*)$', 'app.views.redirect_url'),
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'), (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): def user_post_save(sender, instance, **kwargs):
profile, new = UserProfile.objects.get_or_create(user=instance) 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, SessionData.objects.filter(user=instance).update(level=profile.level,
username=instance.username) username=instance.username)
models.signals.post_save.connect(user_post_save, sender=User) models.signals.post_save.connect(user_post_save, sender=User)

View File

@ -161,7 +161,7 @@ def signup(request):
user.save() user.save()
#create default user lists: #create default user lists:
for l in settings.CONFIG['personalLists']: 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'): for key in ('query', 'public', 'featured'):
if key in l: if key in l:
setattr(list, key, l[key]) setattr(list, key, l[key])

View File

@ -2,13 +2,9 @@ Create virtual disk of pan.do/ra
== ubuntu-vm-builder setup == == ubuntu-vm-builder setup ==
due to https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/676132 on ubuntu 11.10 you need to install python-vm-builder
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
apt-get install python-vm-builder
due to https://bugs.launchpad.net/vmbuilder/+bug/683614 due to https://bugs.launchpad.net/vmbuilder/+bug/683614
building vbox images does not work. install virtualbox_vm.py: 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 == == Update ==
to get the latest version of pan.do/ra to get the latest version of pan.do/ra
cd /srv/pandora cd /srv/pandora
bzr pull ./update.sh
cd static/oxjs
bzr pull
you might have to adjust the database at this point. now restart pandora daemons you might have to adjust the database at this point. now restart pandora daemons

View File

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

View File

@ -12,11 +12,7 @@ chmod 755 /usr/local/bin/ffmpeg2theora
#postgresql #postgresql
apt-get -y install postgresql apt-get -y install postgresql
sudo -u postgres createuser -S -D -R pandora sudo -u postgres createuser -S -D -R pandora
sudo -u postgres createdb -O pandora pandora sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -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
#rabbitmq #rabbitmq
RABBITPWD=$(pwgen -n 16 -1) RABBITPWD=$(pwgen -n 16 -1)
@ -26,11 +22,16 @@ rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
#pandora #pandora
cat > /srv/pandora/pandora/local_settings.py << EOF cat > /srv/pandora/pandora/local_settings.py << EOF
DATABASE_ENGINE = 'postgresql_psycopg2' DATABASES = {
DATABASE_NAME = 'pandora' 'default': {
DATABASE_USER = 'pandora' '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" BROKER_PASSWORD = "$RABBITPWD"
@ -41,6 +42,8 @@ cd /srv/pandora/pandora
sudo -u pandora python manage.py syncdb --noinput 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 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 mkdir /srv/pandora/data
chown -R pandora:pandora /srv/pandora chown -R pandora:pandora /srv/pandora
@ -51,6 +54,6 @@ service pandora-tasks start
service pandora start service pandora start
#nginx #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 service nginx restart