pandora/vm/firstboot.sh

62 lines
1.7 KiB
Bash
Raw Normal View History

#!/bin/sh
2010-12-22 15:15:49 +00:00
#fails in bootstrap
apt-get -y install ipython
#ffmpeg
wget http://firefogg.org/nightly/ffmpeg.linux -O /usr/local/bin/ffmpeg
chmod 755 /usr/local/bin/ffmpeg
wget http://firefogg.org/nightly/ffmpeg2theora.linux -O /usr/local/bin/ffmpeg2theora
chmod 755 /usr/local/bin/ffmpeg2theora
#postgresql
apt-get -y install postgresql postgresql-contrib
sudo -u postgres createuser -S -D -R pandora
sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora
#rabbitmq
RABBITPWD=$(pwgen -n 16 -1)
rabbitmqctl add_user pandora $RABBITPWD
rabbitmqctl add_vhost /pandora
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
#pandora
HOST=$(hostname -s)
SITE_CONFIG="/srv/pandora/pandora/$HOST.jsonc"
test -e $SITE_CONFIG || cp /srv/pandora/pandora/0xdb.jsonc $SITE_CONFIG
cat > /srv/pandora/pandora/local_settings.py << EOF
DATABASES = {
'default': {
'NAME': 'pandora',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'pandora',
'PASSWORD': '',
}
}
2012-03-21 14:11:12 +00:00
DEBUG = False
DATA_SERVICE = ""
SITE_CONFIG = '$SITE_CONFIG'
BROKER_PASSWORD = "$RABBITPWD"
XACCELREDIRECT = True
EOF
cd /srv/pandora/pandora
2012-03-21 14:11:12 +00:00
sudo -u pandora python manage.py syncdb --noinput
echo "UPDATE django_site SET domain = '$HOST.local', name = '$HOST.local' WHERE 1=1;" | sudo -u pandora python manage.py dbshell
mkdir /srv/pandora/data
chown -R pandora:pandora /srv/pandora
2011-12-16 14:13:37 +00:00
sudo -u pandora python manage.py update_static
cp /srv/pandora/etc/init/* /etc/init/
service pandora-encoding start
service pandora-tasks start
service pandora start
#nginx
sed "s/__PREFIX__/\/srv\/pandora/g" "/srv/pandora/etc/nginx/vhost.in" > "/etc/nginx/sites-available/default"
service nginx restart