-
-
Save cpb/6736057 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vagrant up --provider=virtualbox 1 ↵ | |
Bringing machine 'default' up with 'virtualbox' provider... | |
[default] Clearing any previously set forwarded ports... | |
[default] Creating shared folders metadata... | |
[default] Clearing any previously set network interfaces... | |
[default] Preparing network interfaces based on configuration... | |
[default] Forwarding ports... | |
[default] -- 22 => 2222 (adapter 1) | |
[default] -- 80 => 3001 (adapter 1) | |
[default] Booting VM... | |
[default] Waiting for machine to boot. This may take a few minutes... | |
[default] Machine booted and ready! | |
[default] The guest additions on this VM do not match the installed version of | |
VirtualBox! In most cases this is fine, but in rare cases it can | |
cause things such as shared folders to not work properly. If you see | |
shared folder errors, please update the guest additions within the | |
virtual machine and reload your VM. | |
Guest Additions Version: 4.1.12 | |
VirtualBox Version: 4.2 | |
[default] Mounting shared folders... | |
[default] -- /vagrant | |
The following SSH command responded with a non-zero exit status. | |
Vagrant assumes that this means the command failed! | |
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant | |
Stdout from the command: | |
Stderr from the command: | |
stdin: is not a tty | |
/sbin/mount.vboxsf: mounting failed with the error: No such device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.require_plugin "vagrant-aws" | |
BOX_NAME = ENV['BOX_NAME'] || "ubuntu" | |
BOX_URI = ENV['BOX_URI'] || "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" | |
AWS_REGION = ENV['AWS_REGION'] || "us-east-1" | |
AWS_AMI = ENV['AWS_AMI'] || "ami-d0f89fb9" | |
FORWARD_DOCKER_PORTS = ENV['FORWARD_DOCKER_PORTS'] | |
Vagrant.configure("2") do |config| | |
# Setup virtual machine box. This VM configuration code is always executed. | |
config.vm.box = BOX_NAME | |
config.vm.box_url = BOX_URI | |
# Provision docker and new kernel if deployment was not done. | |
# It is assumed Vagrant can successfully launch the provider instance. | |
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty? | |
# Add lxc-docker package | |
pkg_cmd = "wget -q -O - https://get.docker.io/gpg | apt-key add -;" \ | |
"echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;" \ | |
"apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; " | |
# Add Ubuntu raring backported kernel | |
pkg_cmd << "apt-get update -qq; apt-get install -q -y linux-image-generic-lts-raring; " | |
# Add guest additions if local vbox VM. As virtualbox is the default provider, | |
# it is assumed it won't be explicitly stated. | |
if ENV["VAGRANT_DEFAULT_PROVIDER"].nil? && ARGV.none? { |arg| arg.downcase.start_with?("--provider") } | |
puts "default provider" | |
pkg_cmd << "apt-get install -q -y linux-headers-generic-lts-raring dkms; " \ | |
"echo 'Downloading VBox Guest Additions...'; " \ | |
"wget -q http://dlc.sun.com.edgesuite.net/virtualbox/4.2.12/VBoxGuestAdditions_4.2.12.iso; " | |
# Prepare the VM to add guest additions after reboot | |
pkg_cmd << "echo -e 'mount -o loop,ro /home/vagrant/VBoxGuestAdditions_4.2.12.iso /mnt\n" \ | |
"echo yes | /mnt/VBoxLinuxAdditions.run\numount /mnt\n" \ | |
"rm /root/guest_additions.sh; ' > /root/guest_additions.sh; " \ | |
"chmod 700 /root/guest_additions.sh; " \ | |
"sed -i -E 's#^exit 0#[ -x /root/guest_additions.sh ] \\&\\& /root/guest_additions.sh#' /etc/rc.local; " \ | |
"echo 'Installation of VBox Guest Additions is proceeding in the background.'; " \ | |
"echo '\"vagrant reload\" can be used in about 2 minutes to activate the new guest additions.'; " | |
end | |
# Activate new kernel | |
pkg_cmd << "shutdown -r +1; " | |
config.vm.provision :shell, :inline => pkg_cmd | |
end | |
config.vm.provider :aws do |aws, override| | |
aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"] | |
aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"] | |
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"] | |
override.ssh.private_key_path = ENV["AWS_SSH_PRIVKEY"] | |
override.ssh.username = "ubuntu" | |
aws.region = AWS_REGION | |
aws.ami = AWS_AMI | |
aws.instance_type = "t1.micro" | |
end | |
config.vm.provider :virtualbox do |vb, override| | |
config.vm.network :forwarded_port, host: 3001, guest: 80 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment