incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: Changes for automating the vagrant build
Date Tue, 23 Apr 2013 21:39:39 GMT
Updated Branches:
  refs/heads/tv/vagrant e3d765427 -> 8b01c0896


Changes for automating the vagrant build

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


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

Branch: refs/heads/tv/vagrant
Commit: 8b01c0896a3cbaba5cc556ded9ed4f08be423167
Parents: e3d7654
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue Apr 23 17:39:14 2013 -0400
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Apr 23 17:39:14 2013 -0400

----------------------------------------------------------------------
 vagrant/README                                |   15 +++++-
 vagrant/Vagrantfile                           |   54 ++++++++++++--------
 vagrant/Vagrantfile.pkg                       |   10 ++--
 vagrant/allura_setup.sh                       |    9 +--
 vagrant/compress.sh                           |   21 ++++++++
 vagrant/manifests/ubuntu-1204-server-amd64.pp |   20 ++++++-
 6 files changed, 92 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/vagrant/README
----------------------------------------------------------------------
diff --git a/vagrant/README b/vagrant/README
index 69f3bbc..39b14eb 100644
--- a/vagrant/README
+++ b/vagrant/README
@@ -7,7 +7,8 @@ $ mkdir ~/vagrant_allura && cd ~/vagrant_allura
 $ 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 (note, Vagrantfile may change from release to release
and may need manual updating)
+# 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
@@ -17,7 +18,17 @@ $ cp -R /var/local/allura/vagrant/* .
 # Provision the box (this will take a while)
 $ vagrant up
 
-# If you get an error, you can run `vagrant ssh` to get in and debug, and then `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
+
+# Once the provisioning succeeds, `vagrant ssh` to the vm and do any testing
+# you want to do. You should at least run `./update.sh && ~/start_allura` and
+# make sure you can access the app at http://localhost:8080. After testing,
+# remain logged into the vm for the next step (compression).
+
+# Compress the VM. This will make your final .box file much smaller. It'll
+# take a while. Once it finished, logout of the vm.
+$ sudo /vagrant/compress.sh
 
 # Package the Allura box
 $ vagrant package --vagrantfile Vagrantfile.pkg

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/vagrant/Vagrantfile
----------------------------------------------------------------------
diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile
index 4852673..a13c86f 100644
--- a/vagrant/Vagrantfile
+++ b/vagrant/Vagrantfile
@@ -1,7 +1,7 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-Vagrant::Config.run do |config|
+Vagrant.configure("2") do |config|
   # All Vagrant configuration is done here. The most common configuration
   # options are documented and commented below. For a complete reference,
   # please see the online documentation at vagrantup.com.
@@ -13,29 +13,41 @@ Vagrant::Config.run do |config|
   # doesn't already exist on the user's system.
   # config.vm.box_url = "http://domain.com/path/to/above.box"
 
-  # Boot with a GUI so you can see the screen. (Default is headless)
-  # config.vm.boot_mode = :gui
+  # Create a forwarded port mapping which allows access to a specific port
+  # within the machine from a port on the host machine. In the example below,
+  # accessing "localhost:8080" will access port 80 on the guest machine.
+  config.vm.network :forwarded_port, guest: 8080, host: 8080
+  config.vm.network :forwarded_port, guest: 8983, host: 8983
 
-  # Assign this VM to a host-only network IP, allowing you to access it
-  # via the IP. Host-only networks can talk to the host machine as well as
-  # any other machines on the same network, but cannot be accessed (through this
-  # network interface) by any external networks.
-  # config.vm.network :hostonly, "192.168.33.10"
+  # Create a private network, which allows host-only access to the machine
+  # using a specific IP.
+  # config.vm.network :private_network, ip: "192.168.33.10"
 
-  # Assign this VM to a bridged network, allowing you to connect directly to a
-  # network using the host's network device. This makes the VM appear as another
-  # physical device on your network.
-  # config.vm.network :bridged
-
-  # Forward a port from the guest to the host, which allows for outside
-  # computers to access the VM, whereas host only networking does not.
-  config.vm.forward_port 8080, 8080
-  config.vm.forward_port 8983, 8983 # solr
+  # Create a public network, which generally matched to bridged network.
+  # Bridged networks make the machine appear as another physical device on
+  # your network.
+  # config.vm.network :public_network
 
   # Share an additional folder to the guest VM. The first argument is
-  # an identifier, the second is the path on the guest to mount the
-  # folder, and the third is the path on the host to the actual folder.
-  # config.vm.share_folder "v-data", "/vagrant_data", "../data"
+  # the path on the host to the actual folder. The second argument is
+  # the path on the guest to mount the folder. And the optional third
+  # argument is a set of non-required options.
+  # config.vm.synced_folder "../data", "/vagrant_data"
+
+  # Provider-specific configuration so you can fine-tune various
+  # backing providers for Vagrant. These expose provider-specific options.
+  # Example for VirtualBox:
+  #
+  config.vm.provider :virtualbox do |vb|
+    # Don't boot with headless mode
+    # vb.gui = true
+  
+    # Use VBoxManage to customize the VM. For example to change memory:
+    vb.customize ["modifyvm", :id, "--memory", "1024"]
+  end
+  #
+  # View the documentation for the provider you're using for more
+  # information on available options.
 
   # Enable provisioning with Puppet stand alone.  Puppet manifests
   # are contained in a directory path relative to this Vagrantfile.
@@ -95,7 +107,7 @@ Vagrant::Config.run do |config|
   # If you're using the Opscode platform, your validator client is
   # ORGNAME-validator, replacing ORGNAME with your organization name.
   #
-  # IF you have your own Chef Server, the default validation client name is
+  # If you have your own Chef Server, the default validation client name is
   # chef-validator, unless you changed the configuration.
   #
   #   chef.validation_client_name = "ORGNAME-validator"

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/vagrant/Vagrantfile.pkg
----------------------------------------------------------------------
diff --git a/vagrant/Vagrantfile.pkg b/vagrant/Vagrantfile.pkg
index e65f77d..4ab9f99 100644
--- a/vagrant/Vagrantfile.pkg
+++ b/vagrant/Vagrantfile.pkg
@@ -1,6 +1,6 @@
-Vagrant::Config.run do |config|
-  # Forward Allura web port so you can browse the site at
-  # http://localhost:8080 (local port is the second number)
-  config.vm.forward_port 8080, 8080
-  config.vm.forward_port 8983, 8983 # solr
+Vagrant.configure("2") do |config|
+  # allura
+  config.vm.network :forwarded_port, guest: 8080, host: 8080
+  # solr
+  config.vm.network :forwarded_port, guest: 8983, host: 8983 
 end

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/vagrant/allura_setup.sh
----------------------------------------------------------------------
diff --git a/vagrant/allura_setup.sh b/vagrant/allura_setup.sh
index a1fb942..aa64a6e 100755
--- a/vagrant/allura_setup.sh
+++ b/vagrant/allura_setup.sh
@@ -30,6 +30,9 @@ then
     chown vagrant:vagrant /home/vagrant/.bash_profile
 fi
 
+# Make sure vagrant user can execute venv bin scripts
+sudo chown -R vagrant:vagrant /home/vagrant/env-allura/bin/
+
 # Setup Allura python packages
 cd /home/vagrant/src/allura
 sudo -u vagrant bash -c '. /home/vagrant/env-allura/bin/activate; ./rebuild-all.bash'
@@ -41,12 +44,6 @@ aptitude -y -q purge installation-report landscape-client landscape-common
wirel
 aptitude -y -q purge python-dbus libnl1 python-smartpm linux-headers-server python-twisted-core
libiw30 language-selector-common
 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;
-echo "Errors about 'No space left' are ok; carrying on..."
-sync;sleep 1;sync;rm -f zero.fill
-dd if=/dev/zero of=/EMPTY bs=1M
-rm -f /EMPTY
 echo "Done with allura_setup.sh"
 
 # sometimes mongo ends up stopped

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/vagrant/compress.sh
----------------------------------------------------------------------
diff --git a/vagrant/compress.sh b/vagrant/compress.sh
new file mode 100755
index 0000000..c9bcd77
--- /dev/null
+++ b/vagrant/compress.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+echo 'Cleanup bash history'
+unset HISTFILE
+[ -f /root/.bash_history ] && rm /root/.bash_history
+[ -f /home/vagrant/.bash_history ] && rm /home/vagrant/.bash_history
+ 
+echo 'Cleanup log files'
+find /var/log -type f | while read f; do echo -ne '' > $f; done;
+ 
+echo 'Whiteout root'
+count=`df --sync -kP / | tail -n1  | awk -F ' ' '{print $4}'`; 
+let count--
+dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count;
+rm /tmp/whitespace;
+ 
+echo 'Whiteout /boot'
+count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`;
+let count--
+dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count;
+rm /boot/whitespace;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b01c089/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
index fc55460..0181e67 100644
--- a/vagrant/manifests/ubuntu-1204-server-amd64.pp
+++ b/vagrant/manifests/ubuntu-1204-server-amd64.pp
@@ -90,18 +90,32 @@ file { '/home/vagrant/src/allura':
   require => [ File['/home/vagrant/src'], Exec['clone repo'] ],
 }
 
+# HACK to get numpy installed in the venv before installing
+# remaining dependencies via requirements file
+exec { "pip install numpy":
+  command => "/home/vagrant/env-allura/bin/pip install numpy==1.6.1",
+  cwd     => "/vagrant/allura",
+  timeout => 0,
+  logoutput => true,
+  returns => 0,
+  tries => 3,
+  require => [ Exec[ "clone repo"], Exec[ "create allura venv" ],
+               ],
+}
+
 # install Allura dependencies
 exec { "pip install":
-  command => "/usr/bin/sudo /home/vagrant/env-allura/bin/pip install -r requirements.txt",
+  command => "/home/vagrant/env-allura/bin/pip install -r requirements.txt",
   cwd     => "/vagrant/allura",
-  user => "vagrant",
-  group => "vagrant",
+  # 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"],
+               Exec["pip install numpy"],
                ],
 }
 


Mime
View raw message