You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/03/19 19:27:46 UTC

[4/4] git commit: [#5973] update vagrant scripts

Updated Branches:
  refs/heads/db/5973 9dfd7e74c -> 801bb934a


[#5973] update vagrant scripts

* update instructions
* update ubuntu base
* various other fixes & improvements


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/801bb934
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/801bb934
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/801bb934

Branch: refs/heads/db/5973
Commit: 801bb934aa16f1b986543b4aa117fae71e876444
Parents: 8f04707
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Mar 19 11:19:36 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 19 11:25:05 2013 -0700

----------------------------------------------------------------------
 vagrant/README                                |   14 ++-
 vagrant/Vagrantfile                           |    6 +-
 vagrant/allura_setup.sh                       |   16 ++--
 vagrant/manifests/ubuntu-1204-server-amd64.pp |  134 ++++++++++++++++++++
 vagrant/start_allura                          |    6 +-
 5 files changed, 156 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/801bb934/vagrant/README
----------------------------------------------------------------------
diff --git a/vagrant/README b/vagrant/README
index f5b4552..69f3bbc 100644
--- a/vagrant/README
+++ b/vagrant/README
@@ -2,20 +2,22 @@ To build an Allura vagrant box:
 
 $ mkdir ~/vagrant_allura && cd ~/vagrant_allura
 
-# Get the base box
-$ vagrant box add ubuntu-1110-server-amd64 http://timhuegdon.com/vagrant-boxes/ubuntu-11.10.box
-$ vagrant init ubuntu-1110-server-amd64
+# Get the base box, see http://www.vagrantbox.es/
+# 12.04 is LTS, so will be good to stick with for some time
+$ vagrant box add ubuntu-1204-server-amd64 http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box
+$ vagrant init ubuntu-1204-server-amd64
 
-# Get a copy of the provisioning scripts
+# Get a copy of the provisioning scripts (note, Vagrantfile may change from release to release and may need manual updating)
 $ cp -R /var/local/allura/vagrant/* .
 
 # At this point you can make whatever changes you want to the provisioning
-# scripts
+# scripts.  Currently, the .pp puppet file runs first and sets some stuff up
+# and then allura_setup.sh runs and does more.
 
 # Provision the box (this will take a while)
 $ vagrant up
 
-# If you get an error, you can run `vagrant destroy` to start over
+# If you get an error, you can run `vagrant ssh` to get in and debug, and then `vagrant destroy` to start over
 
 # Package the Allura box
 $ vagrant package --vagrantfile Vagrantfile.pkg

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/801bb934/vagrant/Vagrantfile
----------------------------------------------------------------------
diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile
index 9de2455..4852673 100644
--- a/vagrant/Vagrantfile
+++ b/vagrant/Vagrantfile
@@ -7,7 +7,7 @@ Vagrant::Config.run do |config|
   # please see the online documentation at vagrantup.com.
 
   # Every Vagrant virtual environment requires a box to build off of.
-  config.vm.box = "ubuntu-1110-server-amd64"
+  config.vm.box = "ubuntu-1204-server-amd64"
 
   # The url from where the 'config.vm.box' box will be fetched if it
   # doesn't already exist on the user's system.
@@ -40,7 +40,7 @@ Vagrant::Config.run do |config|
   # Enable provisioning with Puppet stand alone.  Puppet manifests
   # are contained in a directory path relative to this Vagrantfile.
   # You will need to create the manifests directory and a manifest in
-  # the file ubuntu-1110-server-amd64.pp in the manifests_path directory.
+  # the file ubuntu-1204-server-amd64.pp in the manifests_path directory.
   #
   # An example Puppet manifest to provision the message of the day:
   #
@@ -57,7 +57,7 @@ Vagrant::Config.run do |config|
   #
   config.vm.provision :puppet do |puppet|
     puppet.manifests_path = "manifests"
-    puppet.manifest_file  = "ubuntu-1110-server-amd64.pp"
+    puppet.manifest_file  = "ubuntu-1204-server-amd64.pp"
   end
 
   config.vm.provision :shell, :path => "allura_setup.sh"

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/801bb934/vagrant/allura_setup.sh
----------------------------------------------------------------------
diff --git a/vagrant/allura_setup.sh b/vagrant/allura_setup.sh
index cf93e5d..7cb70b8 100755
--- a/vagrant/allura_setup.sh
+++ b/vagrant/allura_setup.sh
@@ -5,12 +5,12 @@ cd /home/vagrant/src
 if [ ! -d apache-solr-1.4.1 ]
 then
     echo "Installing Solr..."
-    wget -q http://apache.mirrors.tds.net/lucene/solr/1.4.1/apache-solr-1.4.1.tgz
+    wget -nv http://archive.apache.org/dist/lucene/solr/1.4.1/apache-solr-1.4.1.tgz
     tar xf apache-solr-1.4.1.tgz && rm -f apache-solr-1.4.1.tgz
     cd apache-solr-1.4.1/example/
-    mkdir -p /home/vagrant/src/forge/solr_config/conf
-    cp solr/conf/solrconfig.xml /home/vagrant/src/forge/solr_config/conf/
-    chown -R vagrant:vagrant /home/vagrant/src/apache-solr* /home/vagrant/src/forge/solr_config/conf/
+    mkdir -p /home/vagrant/src/allura/solr_config/conf
+    cp solr/conf/solrconfig.xml /home/vagrant/src/allura/solr_config/conf/
+    chown -R vagrant:vagrant /home/vagrant/src/apache-solr* /home/vagrant/src/allura/solr_config/conf/
 fi
 
 # Create log dir
@@ -33,20 +33,20 @@ if [ ! -f /home/vagrant/.bash_profile ]
 then
     echo "Creating ~/.bash_profile ..."
     cp /home/vagrant/.profile /home/vagrant/.bash_profile
-    echo -e "\n# Activate Allura virtualenv\n. /home/vagrant/anvil/bin/activate && cd /home/vagrant/src/forge" >> /home/vagrant/.bash_profile
+    echo -e "\n# Activate Allura virtualenv\n. /home/vagrant/anvil/bin/activate && cd /home/vagrant/src/allura" >> /home/vagrant/.bash_profile
     chown vagrant:vagrant /home/vagrant/.bash_profile
 fi
 
 # Setup Allura python packages
-cd /home/vagrant/src/forge
+cd /home/vagrant/src/allura
 sudo -u vagrant bash -c '. /home/vagrant/anvil/bin/activate; ./rebuild.bash'
 
 echo "Purging unneeded packages..."
 aptitude clean
 aptitude -y -q purge ri
-aptitude -y -q purge installation-report landscape-common wireless-tools wpasupplicant
+aptitude -y -q purge installation-report landscape-client landscape-common wireless-tools wpasupplicant
 aptitude -y -q purge python-dbus libnl1 python-smartpm linux-headers-server python-twisted-core libiw30 language-selector-common
-aptitude -y -q purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam accountsservice libaccountsservice0
+aptitude -y -q purge cloud-init juju python-twisted python-twisted-bin libdbus-glib-1-2 python-pexpect python-serial python-gobject python-pam accountsservice libaccountsservice0
 
 echo "Zeroing free space to aid VM compression..."
 cat /dev/zero > zero.fill;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/801bb934/vagrant/manifests/ubuntu-1204-server-amd64.pp
----------------------------------------------------------------------
diff --git a/vagrant/manifests/ubuntu-1204-server-amd64.pp b/vagrant/manifests/ubuntu-1204-server-amd64.pp
new file mode 100644
index 0000000..d80e22a
--- /dev/null
+++ b/vagrant/manifests/ubuntu-1204-server-amd64.pp
@@ -0,0 +1,134 @@
+# create puppet group
+group { "puppet":
+  ensure => "present",
+}
+
+exec { "package index update":
+    command => "/usr/bin/apt-get update",
+}
+
+# install required system packages
+Package { ensure => "installed" }
+
+$packages = [
+ "git-core",
+ "subversion",
+ "python-svn",
+ "default-jre-headless",
+ "python-dev",
+ "libssl-dev",
+ "libldap2-dev",
+ "libsasl2-dev",
+ "libjpeg8-dev",
+ "zlib1g-dev",
+ "mongodb-server",
+ "python-pip"
+]
+
+package { $packages:
+    require => Exec[ "package index update" ],
+}
+
+file { '/usr/lib/libz.so':
+  ensure => 'link',
+  target => '/usr/lib/x86_64-linux-gnu/libz.so',
+  require => Package[ "zlib1g-dev" ],
+}
+file { '/usr/lib/libjpeg.so':
+  ensure => 'link',
+  target => '/usr/lib/x86_64-linux-gnu/libjpeg.so',
+  require => Package[ "libjpeg8-dev" ],
+}
+
+# install python pip
+exec { "install venv":
+  command => "/usr/bin/pip install virtualenv",
+  creates => "/usr/local/bin/virtualenv",
+  require => Package[ "python-pip" ],
+}
+
+# create Allura virtualenv
+exec { "create allura venv":
+  command => "/usr/local/bin/virtualenv anvil",
+  cwd     => "/home/vagrant",
+  creates => "/home/vagrant/anvil",
+  user => "vagrant",
+  group => "vagrant",
+  require => Exec[ "install venv" ],
+}
+
+# create dir for Allura source
+file { "/home/vagrant/src":
+  ensure => "directory",
+  owner => "vagrant",
+  group => "vagrant",
+}
+
+# create dir for Allura logs
+file { "/var/log/allura":
+  ensure => "directory",
+  owner => "vagrant",
+  group => "vagrant",
+}
+
+# clone Allura source from git
+exec { "clone repo":
+  command => "/usr/bin/git clone https://git-wip-us.apache.org/repos/asf/incubator-allura.git allura",
+  cwd     => "/home/vagrant/src",
+  creates => "/home/vagrant/src/allura",
+  user => "vagrant",
+  group => "vagrant",
+  require => [ File[ "/home/vagrant/src" ], Package[ "git-core" ] ],
+}
+
+# install Allura dependencies
+exec { "pip install":
+  command => "/home/vagrant/anvil/bin/pip install -r requirements.txt",
+  cwd     => "/home/vagrant/src/allura",
+  user => "vagrant",
+  group => "vagrant",
+  timeout => 0,
+  logoutput => true,
+  returns => 0,
+  tries => 3,
+  require => [ Exec[ "clone repo"], Exec[ "create allura venv" ],
+               File["/usr/lib/libjpeg.so"], File["/usr/lib/libz.so"],
+               ],
+}
+
+# symlink pysvn in from the system installation
+file { '/home/vagrant/anvil/lib/python2.7/site-packages/pysvn':
+  ensure => 'link',
+  target => '/usr/lib/python2.7/dist-packages/pysvn',
+  require => [ Package[ "python-svn" ], Exec[ "pip install" ]],
+}
+
+# create SCM repo dirs
+file { [ "/home/vagrant/scm", "/home/vagrant/scm/git", "/home/vagrant/scm/hg", "/home/vagrant/scm/svn" ]:
+  ensure => "directory",
+  owner => "vagrant",
+  group => "vagrant",
+  mode   => 777,
+}
+
+# create symlinks to repo dirs
+file { '/git':
+  ensure => "link",
+  target => "/home/vagrant/scm/git",
+  owner => "vagrant",
+  group => "vagrant",
+}
+
+file { '/hg':
+  ensure => "link",
+  target => "/home/vagrant/scm/hg",
+  owner => "vagrant",
+  group => "vagrant",
+}
+
+file { '/svn':
+  ensure => "link",
+  target => "/home/vagrant/scm/svn",
+  owner => "vagrant",
+  group => "vagrant",
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/801bb934/vagrant/start_allura
----------------------------------------------------------------------
diff --git a/vagrant/start_allura b/vagrant/start_allura
index d9f228f..8c66187 100755
--- a/vagrant/start_allura
+++ b/vagrant/start_allura
@@ -19,10 +19,10 @@ then
 else
     echo "Starting Solr..."
     cd /home/vagrant/src/apache-solr-1.4.1/example
-    nohup java -Dsolr.solr.home=/home/vagrant/src/forge/solr_config -jar start.jar >/var/log/allura/solr.log 2>&1 &
+    nohup java -Dsolr.solr.home=/home/vagrant/src/allura/solr_config -jar start.jar >/var/log/allura/solr.log 2>&1 &
 fi
 
-cd /home/vagrant/src/forge/Allura
+cd /home/vagrant/src/allura/Allura
 
 # Start taskd
 if pgrep -f "paster taskd" >/dev/null
@@ -37,7 +37,7 @@ fi
 if [ ! -f /var/lib/mongodb/allura.0 ]
 then
     echo "Initializing database..."
-    paster setup-app development.ini >/var/log/allura/setup-app.log 2>&1
+    paster setup-app development.ini >/var/log/allura/setup-app.log 2>&1 || echo "Error, see /var/log/allura/setup-app.log"
 fi
 
 # Start the web server