You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2014/04/04 19:17:54 UTC
git commit: Use a custom VM image. Work in progress.
Repository: incubator-aurora
Updated Branches:
refs/heads/wfarner/vagrant_dev_box [created] cc6a0531d
Use a custom VM image. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/cc6a0531
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/cc6a0531
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/cc6a0531
Branch: refs/heads/wfarner/vagrant_dev_box
Commit: cc6a0531dc33339f4e1c8baee2a0e72783126d0e
Parents: d65a6f6
Author: Bill Farner <wf...@apache.org>
Authored: Thu Apr 3 23:56:03 2014 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Fri Apr 4 10:17:32 2014 -0700
----------------------------------------------------------------------
.gitignore | 2 +
Vagrantfile | 10 ++-
docs/tutorial.md | 4 +-
examples/vagrant/packer/.ssh/authorized_keys | 1 +
examples/vagrant/packer/aurora_dev.json | 51 +++++++++++++++
examples/vagrant/packer/http/preseed.cfg | 77 +++++++++++++++++++++++
examples/vagrant/packer/setup.sh | 61 ++++++++++++++++++
examples/vagrant/provision-dev-cluster.sh | 14 -----
8 files changed, 202 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7e43385..435c670 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+*.box
*.iml
*.ipr
+*.iso
*.iws
*.pyc
*~
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index f339368..d5db638 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -20,14 +20,20 @@
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "precise64"
+ config.vm.box = "ubuntu-12.04.4-server-amd64-aurora-dev"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ # TODO(wfarner): HOst the box somewhere.
+ #config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.define "devcluster" do |dev|
dev.vm.network :private_network, ip: "192.168.33.7"
+
+ # Share the dependency cache from the host, hopefully saving the guest machine
+ # from needing to fetch all of the same files.
+ dev.vm.synced_folder "~/.gradle/caches/modules-2/files-2.1/", \
+ "/home/vagrant/.gradle/caches/modules-2/files-2.1/"
dev.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/docs/tutorial.md
----------------------------------------------------------------------
diff --git a/docs/tutorial.md b/docs/tutorial.md
index e428f4e..7d60212 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -141,7 +141,7 @@ identical, the job keys identify the same job.
cluster names. For Vagrant, from the top-level of your Aurora repository clone,
do:
- $ vagrant ssh devcluster
+ $ vagrant ssh
Followed by:
@@ -176,7 +176,7 @@ Or for our example:
This returns:
- $ vagrant ssh devcluster
+ $ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/examples/vagrant/packer/.ssh/authorized_keys
----------------------------------------------------------------------
diff --git a/examples/vagrant/packer/.ssh/authorized_keys b/examples/vagrant/packer/.ssh/authorized_keys
new file mode 100644
index 0000000..e026dfe
--- /dev/null
+++ b/examples/vagrant/packer/.ssh/authorized_keys
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/examples/vagrant/packer/aurora_dev.json
----------------------------------------------------------------------
diff --git a/examples/vagrant/packer/aurora_dev.json b/examples/vagrant/packer/aurora_dev.json
new file mode 100644
index 0000000..e1e1660
--- /dev/null
+++ b/examples/vagrant/packer/aurora_dev.json
@@ -0,0 +1,51 @@
+{
+ "builders": [
+ {
+ "type": "virtualbox-iso",
+ "guest_os_type": "Ubuntu_64",
+ "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso",
+ "iso_checksum": "3aeb42816253355394897ae80d99a9ba56217c0e98e05294b51f0f5b13bceb54",
+ "iso_checksum_type": "sha256",
+ "http_directory": "http",
+ "boot_command": [
+ "<esc><esc><enter><wait>",
+ "/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
+ "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
+ "hostname=aurora-dev ",
+ "fb=false debconf/frontend=noninteractive ",
+ "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
+ "initrd=/install/initrd.gz -- <enter>"
+ ],
+ "ssh_username": "vagrant",
+ "ssh_password": "vagrant",
+ "ssh_wait_timeout": "60m",
+ "shutdown_command": "echo vagrant | sudo -S shutdown -P now",
+ "guest_additions_path": "/tmp/VBoxGuestAdditions.iso"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "file",
+ "source": ".ssh",
+ "destination": "/home/vagrant/"
+ },
+ {
+ "type": "file",
+ "source": "../../../build-support/thrift/Makefile",
+ "destination": "/home/vagrant/Makefile.thrift"
+ },
+ {
+ "type": "shell",
+ "scripts": [
+ "setup.sh"
+ ],
+ "execute_command": "echo 'vagrant' | sudo -S sh '{{ .Path }}'"
+ }
+ ],
+ "post-processors": [
+ {
+ "type": "vagrant",
+ "output": "ubuntu-12.04.4-server-amd64-aurora-dev.box"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/examples/vagrant/packer/http/preseed.cfg
----------------------------------------------------------------------
diff --git a/examples/vagrant/packer/http/preseed.cfg b/examples/vagrant/packer/http/preseed.cfg
new file mode 100644
index 0000000..61b6353
--- /dev/null
+++ b/examples/vagrant/packer/http/preseed.cfg
@@ -0,0 +1,77 @@
+# Some inspiration:
+# * https://github.com/chrisroberts/vagrant-boxes/blob/master/definitions/precise-64/preseed.cfg
+# * https://github.com/cal/vagrant-ubuntu-precise-64/blob/master/preseed.cfg
+
+# English plx
+d-i debian-installer/language string en
+d-i debian-installer/locale string en_US.UTF-8
+d-i localechooser/preferred-locale string en_US.UTF-8
+d-i localechooser/supported-locales en_US.UTF-8
+
+# Including keyboards
+d-i console-setup/ask_detect boolean false
+d-i keyboard-configuration/layout select USA
+d-i keyboard-configuration/variant select USA
+d-i keyboard-configuration/modelcode string pc105
+
+
+# Just roll with it
+d-i netcfg/get_hostname string this-host
+d-i netcfg/get_domain string this-host
+
+d-i time/zone string UTC
+d-i clock-setup/utc-auto boolean true
+d-i clock-setup/utc boolean true
+
+
+# Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
+d-i debconf debconf/frontend select Noninteractive
+
+d-i pkgsel/install-language-support boolean false
+tasksel tasksel/first multiselect standard, ubuntu-server
+
+
+# Stuck between a rock and a HDD place
+d-i partman-auto/method string lvm
+d-i partman-lvm/confirm boolean true
+d-i partman-lvm/device_remove_lvm boolean true
+d-i partman-auto/choose_recipe select atomic
+
+d-i partman/confirm_write_new_label boolean true
+d-i partman/confirm_nooverwrite boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+
+# Write the changes to disks and configure LVM?
+d-i partman-lvm/confirm boolean true
+d-i partman-lvm/confirm_nooverwrite boolean true
+d-i partman-auto-lvm/guided_size string max
+
+# No proxy, plx
+d-i mirror/http/proxy string
+
+# Default user, change
+d-i passwd/user-fullname string vagrant
+d-i passwd/username string vagrant
+d-i passwd/user-password password vagrant
+d-i passwd/user-password-again password vagrant
+d-i user-setup/encrypt-home boolean false
+d-i user-setup/allow-password-weak boolean true
+
+# No language support packages.
+d-i pkgsel/install-language-support boolean false
+
+# Individual additional packages to install
+d-i pkgsel/include string build-essential ssh automake
+
+#For the update
+d-i pkgsel/update-policy select none
+
+# Whether to upgrade packages after debootstrap.
+# Allowed values: none, safe-upgrade, full-upgrade
+d-i pkgsel/upgrade select safe-upgrade
+
+# Go grub, go!
+d-i grub-installer/only_debian boolean true
+
+d-i finish-install/reboot_in_progress note
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/examples/vagrant/packer/setup.sh
----------------------------------------------------------------------
diff --git a/examples/vagrant/packer/setup.sh b/examples/vagrant/packer/setup.sh
new file mode 100644
index 0000000..e0593e4
--- /dev/null
+++ b/examples/vagrant/packer/setup.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+sudo apt-get update -y -qq > /dev/null
+sudo apt-get upgrade -y -qq > /dev/null
+
+# Install necessary libraries for guest additions and Vagrant NFS Share
+sudo apt-get -y -q install linux-headers-$(uname -r) build-essential dkms nfs-common
+
+# Install guest additions
+mkdir -p /mnt/virtualbox
+mount -o loop /tmp/VBoxGuestAdditions.iso /mnt/virtualbox
+(sh /mnt/virtualbox/VBoxLinuxAdditions.run --nox11) || {
+ echo "VirtualBox Guest Additions Installer failed. This may be safely ignored..." >&2
+}
+
+# Workaround for https://www.virtualbox.org/ticket/12879
+# See also https://github.com/mitchellh/vagrant/issues/3341
+if [ ! -d /usr/lib/VBoxGuestAdditions ]
+then
+ vbox_version=$(cat /home/vagrant/.vbox_version)
+ if [ "$?" -eq 0 ]
+ then
+ ln -s /opt/VBoxGuestAdditions-$vbox_version/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
+ echo 'Fixed missing symlink to VBoxGuestAdditions.'
+ else
+ echo 'The symlink for VBoxGuestAdditions is missing, and I could not repair it.'
+ echo 'The box may fail to properly use VirtualBox Guest Additions.'
+ fi
+else
+ echo 'Symlink to VBoxGuestAdditions exists, no need to repair.'
+fi
+
+# Install necessary dependencies
+sudo apt-get -y -q install \
+ curl \
+ git \
+ libcurl4-openssl-dev \
+ libsasl2-dev \
+ libtool \
+ openjdk-7-jdk \
+ python-dev \
+ zookeeper
+
+# Build and install thrift
+cd /home/vagrant
+mkdir thrift
+mv Makefile.thrift thrift/Makefile
+cd thrift
+make
+install thrift-0.9.1/compiler/cpp/thrift /usr/local/bin/thrift
+
+# Setup sudo to allow no-password sudo for "admin"
+groupadd -r admin
+usermod -a -G admin vagrant
+cp /etc/sudoers /etc/sudoers.orig
+sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
+sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers
+
+# Zero out the free space to save space in the final image:
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cc6a0531/examples/vagrant/provision-dev-cluster.sh
----------------------------------------------------------------------
diff --git a/examples/vagrant/provision-dev-cluster.sh b/examples/vagrant/provision-dev-cluster.sh
index ec95543..9b7e36d 100755
--- a/examples/vagrant/provision-dev-cluster.sh
+++ b/examples/vagrant/provision-dev-cluster.sh
@@ -15,20 +15,6 @@
# limitations under the License.
#
-apt-get update
-apt-get -y install \
- automake \
- curl \
- git \
- g++ \
- libcurl4-openssl-dev \
- libsasl2-dev \
- libtool \
- make \
- openjdk-7-jdk \
- python-dev \
- zookeeper
-
# Ensure java 7 is the default java.
update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java