diff --git a/vm/README.txt b/vm/README.txt index a78f229c..0480e82c 100644 --- a/vm/README.txt +++ b/vm/README.txt @@ -1,31 +1,33 @@ Create virtual disk of pan.do/ra -== ubuntu-vm-builder setup == +== Preparations == -on ubuntu 11.10 you need to install python-vm-builder +Pan.do/ra VM scripts use python-vm-builder, +its available in ubuntu 12.04 and later 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: - sudo cp virtualbox_vm.py /usr/lib/python2.6/dist-packages/VMBuilder/plugins/virtualbox/vm.py -(or change vbox to kvm to build kvm image) +== Building == -with that installed build image: +You can configure some of the arguments in build.sh once done run: ./build.sh this will create a vdi image in pandora/ + == VirtualBox Usage == + Now you can create a new VirtualBox machine, select Linux/Ubuntu and use vdi image as existing hard disk. Before starting up: In Network -> Adpater 1 set to Bridged Adapter with your connected controller + == Use for development == + Login via ssh or in terminal as pandora with password pandora ssh pandora@pandora.local @@ -37,13 +39,8 @@ 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 - ./update.sh - -you might have to adjust the database at this point. now restart pandora daemons - - service pandora restart - service pandora-tasks restart - service pandora-encoding restart + ./update.py diff --git a/vm/build.sh b/vm/build.sh index 4ae3e210..0675350f 100755 --- a/vm/build.sh +++ b/vm/build.sh @@ -1,15 +1,30 @@ #!/bin/sh +size=1048576 #in MB +arch=amd64 #i368 or amd64 +password=pandora + +hypervisor=vbox #vbox or kvm + +extra="" + +#make available as pandora.local +extra="--addpkg avahi-daemon" + +#to create and include in libvirt: +#hypervisor=kvm +#extra="--libvirt qemu:///system" + base=$(pwd) sudo vmbuilder vbox ubuntu --suite=precise \ --verbose --debug \ - --arch i386 \ + --arch $arch \ --flavour generic \ --dest $base/pandora \ --hostname pandora \ --swapsize 512 \ - --rootsize 1048576 \ + --rootsize $size \ --user pandora \ - --pass pandora \ + --pass $password \ --components main,universe,multiverse \ --ppa j/pandora \ --addpkg openssh-server \ @@ -23,7 +38,6 @@ sudo vmbuilder vbox ubuntu --suite=precise \ --addpkg git \ --addpkg subversion \ --addpkg mercurial \ - --addpkg avahi-daemon \ --addpkg update-manager-core \ --addpkg python-software-properties \ --addpkg python-setuptools \ @@ -47,6 +61,5 @@ sudo vmbuilder vbox ubuntu --suite=precise \ --addpkg libav-tools \ --addpkg ffmpeg2theora \ --addpkg imagemagick \ - --execscript=$base/install.sh \ - --firstboot=$base/firstboot.sh - + --firstboot=$base/firstboot.sh \ + $extra diff --git a/vm/firstboot.sh b/vm/firstboot.sh index 8499c800..703fa834 100755 --- a/vm/firstboot.sh +++ b/vm/firstboot.sh @@ -2,7 +2,7 @@ #fails in bootstrap apt-get -y install ipython ntp -add-apt-repository ppa:j/pandora +add-apt-repository -y ppa:j/pandora #postgresql apt-get -y install postgresql postgresql-contrib @@ -17,6 +17,11 @@ rabbitmqctl add_vhost /pandora rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*" #pandora +bzr branch http://code.0x2620.org/pandora /srv/pandora +bzr branch http://code.0x2620.org/oxjs /srv/pandora/static/oxjs +virtualenv --system-site-packages /srv/pandora +/srv/pandora/bin/pip install -r /srv/pandora/requirements.txt + HOST=$(hostname -s) HOST_CONFIG="/srv/pandora/pandora/config.$HOST.jsonc" SITE_CONFIG="/srv/pandora/pandora/config.jsonc" @@ -56,13 +61,10 @@ $MANAGE collectstatic -l --noinput cp /srv/pandora/etc/init/* /etc/init/ -service pandora-cron start -service pandora-encoding start -service pandora-tasks start -service pandora start +/srv/pandora/ctl start #logrotate -cp "/srv/pandora/etc/logrotate.d/pandora" "/etc/logroated.d/pandora" +cp "/srv/pandora/etc/logrotate.d/pandora" "/etc/logrotate.d/pandora" #nginx cp "/srv/pandora/etc/nginx/pandora" "/etc/nginx/sites-available/default" @@ -88,6 +90,7 @@ done echo EOF chmod +x /usr/local/bin/genissue +/usr/local/bin/genissue > /etc/issue cat > /etc/rc.local << EOF #!/bin/sh -e @@ -101,3 +104,41 @@ rm -f /etc/udev/rules.d/70-persistent-net.rules /usr/local/bin/genissue > /etc/issue EOF chmod +x /etc/rc.local + +cat > /home/pandora/.vimrc < "+gP +imap i +vmap "+y + +filetype plugin indent on +syntax on + +nmap :tabprev +nmap :tabnext + +hi SpellBad ctermbg=0 + +nnoremap :set invpaste paste? +set pastetoggle= +set showmode +EOF diff --git a/vm/install.sh b/vm/install.sh deleted file mode 100755 index 3d53673a..00000000 --- a/vm/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -CH="chroot $1" -$CH bzr branch http://code.0x2620.org/pandora /srv/pandora -$CH bzr branch http://code.0x2620.org/oxjs /srv/pandora/static/oxjs -$CH virtualenv --system-site-packages /srv/pandora -$CH /srv/pandora/bin/pip install -r /srv/pandora/requirements.txt - diff --git a/vm/virtualbox_vm.py b/vm/virtualbox_vm.py deleted file mode 100644 index fad5296a..00000000 --- a/vm/virtualbox_vm.py +++ /dev/null @@ -1,69 +0,0 @@ -# -# Uncomplicated VM Builder -# Copyright (C) 2007-2009 Canonical Ltd. -# -# See AUTHORS for list of contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3, as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -import os -import os.path -import stat -import VMBuilder -from VMBuilder import register_hypervisor, Hypervisor -from VMBuilder.disk import vbox_manager_path -import VMBuilder.hypervisor - -class VirtualBox(Hypervisor): - preferred_storage = VMBuilder.hypervisor.STORAGE_DISK_IMAGE - needs_bootloader = True - name = 'VirtualBox' - arg = 'vbox' - - def register_options(self): - group = self.setting_group('VM settings') - group.add_setting('mem', extra_args=['-m'], type='int', default=128, help='Assign MEM megabytes of memory to the guest vm. [default: %default]') - group.add_setting('cpus', type='int', default=1, help='Assign NUM cpus to the guest vm. [default: %default]') - group.add_setting('vbox-disk-format', metavar='FORMAT', default='vdi', help='Desired disk format. Valid options are: vdi vmdk. [default: %default]') - - def convert(self, disks, destdir): - self.imgs = [] - for disk in disks: - img_path = disk.convert(destdir, self.context.get_setting('vbox-disk-format')) - self.imgs.append(img_path) - self.call_hooks('fix_ownership', img_path) - - def deploy(self, destdir): - hostname = self.context.distro.get_setting('hostname') - mac = self.context.get_setting('mac') - ip = self.context.get_setting('ip') - vm_deploy = VMBuilder.util.render_template('virtualbox', - self.context, - 'vm_deploy_script', - { 'os_type' : self.context.distro.__class__.__name__, - 'vm_name' : hostname, - 'vm_disks' : self.imgs, - 'mac' : mac, - 'ip' : ip, - 'memory' : self.context.get_setting('mem'), - 'cpus' : self.context.get_setting('cpus') }) - - script_file = '%s/deploy_%s.sh' % (destdir, hostname) - fp = open(script_file, 'w') - fp.write(vm_deploy) - fp.close() - os.chmod(script_file, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH) - self.call_hooks('fix_ownership', script_file) - -register_hypervisor(VirtualBox)