Merge remote-tracking branch 'amesserl/raxcloud-support'

Conflicts:
	Vagrantfile
This commit is contained in:
Charles Hooper 2013-03-24 10:16:50 +00:00
commit bea7894166
3 changed files with 50 additions and 14 deletions

View file

@ -94,10 +94,11 @@ Docker probably works on other distributions featuring a recent kernel, the AUFS
Installing with Vagrant Installing with Vagrant
----------------------- -----------------------
Currently, Docker can be installed with Vagrant both on your localhost Currently, Docker can be installed with Vagrant on your localhost with VirtualBox,
with VirtualBox as well as on Amazon EC2. Vagrant 1.1 is required for Amazon EC2, and Rackspace Cloud Servers. Vagrant 1.1 is required for EC2 and
EC2, but deploying is as simple as: Rackspace Cloud, but deploying is as simple as:
Amazon EC2:
```bash ```bash
$ export AWS_ACCESS_KEY_ID=xxx \ $ export AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \ AWS_SECRET_ACCESS_KEY=xxx \
@ -114,6 +115,23 @@ The environment variables are:
* `AWS_KEYPAIR_NAME` - The name of the keypair used for this EC2 instance * `AWS_KEYPAIR_NAME` - The name of the keypair used for this EC2 instance
* `AWS_SSH_PRIVKEY` - The path to the private key for the named keypair * `AWS_SSH_PRIVKEY` - The path to the private key for the named keypair
Rackspace Cloud Servers:
```bash
$ export RS_USERNAME=xxx \
RS_API_KEY=xxx \
RS_PUBLIC_KEY=xxx \
RS_PRIVATE_KEY=xxx
$ vagrant plugin install vagrant-rackspace
$ vagrant up --provider=rackspace
```
The environment variables are:
* `RS_USERNAME` - The user name used to make requests to Rackspace Cloud
* `RS_API_KEY` - The secret key to make Rackspace Cloud API requests
* `RS_PUBLIC_KEY` - The location on disk to your public key that will be injected into the instance.
* `RS_PRIVATE_KEY` - The private key that matches the public key being injected.
For VirtualBox, you can simply ignore setting any of the environment For VirtualBox, you can simply ignore setting any of the environment
variables and omit the `provider` flag. VirtualBox is still supported with variables and omit the `provider` flag. VirtualBox is still supported with
Vagrant <= 1.1: Vagrant <= 1.1:

16
Vagrantfile vendored
View file

@ -31,12 +31,12 @@ def v10(config)
# computers to access the VM, whereas host only networking does not. # computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080 # config.vm.forward_port 80, 8080
# Ensure puppet is installed on the instance
config.vm.provision :shell, :inline => "apt-get -qq update; apt-get install -y puppet"
# Share an additional folder to the guest VM. The first argument is # 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 # 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. # folder, and the third is the path on the host to the actual folder.
if not File.exist? File.expand_path '~/docker'
Dir.mkdir(File.expand_path '~/docker')
end
config.vm.share_folder "v-data", "~/docker", "~/docker" config.vm.share_folder "v-data", "~/docker", "~/docker"
# Enable provisioning with Puppet stand alone. Puppet manifests # Enable provisioning with Puppet stand alone. Puppet manifests
@ -123,6 +123,16 @@ end
aws.ssh_username = "vagrant" aws.ssh_username = "vagrant"
aws.instance_type = "t1.micro" aws.instance_type = "t1.micro"
end end
config.vm.provider :rackspace do |rs|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box"
config.ssh.private_key_path = ENV["RS_PRIVATE_KEY"]
rs.username = ENV["RS_USERNAME"]
rs.api_key = ENV["RS_API_KEY"]
rs.public_key_path = ENV["RS_PUBLIC_KEY"]
rs.flavor = /512MB/
rs.image = /Ubuntu/
end
config.vm.provider :virtualbox do |vb| config.vm.provider :virtualbox do |vb|
config.vm.box = "quantal64_3.5.0-25" config.vm.box = "quantal64_3.5.0-25"
config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box" config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"

View file

@ -25,6 +25,9 @@ class virtualbox {
class ec2 { class ec2 {
} }
class rax {
}
class docker { class docker {
# update this with latest docker binary distro # update this with latest docker binary distro
@ -42,13 +45,17 @@ class docker {
notify { "docker_url = $docker_url": withpath => true } notify { "docker_url = $docker_url": withpath => true }
$ec2_version = file("/etc/ec2_version", "/dev/null") $ec2_version = file("/etc/ec2_version", "/dev/null")
if ($ec2_version) { $rax_version = inline_template("<%= %x{/usr/bin/xenstore-read vm-data/provider_data/provider} %>")
include ec2
} else { if ($ec2_version) {
# virtualbox is the vagrant default, so it should be safe to assume include ec2
include virtualbox } elsif ($rax_version) {
} include rax
} else {
# virtualbox is the vagrant default, so it should be safe to assume
include virtualbox
}
user { "vagrant": user { "vagrant":
ensure => present, ensure => present,
@ -84,6 +91,7 @@ class docker {
} }
file { "/home/vagrant": file { "/home/vagrant":
ensure => directory,
mode => 644, mode => 644,
require => User["vagrant"], require => User["vagrant"],
} }
@ -91,7 +99,7 @@ class docker {
file { "/home/vagrant/.profile": file { "/home/vagrant/.profile":
mode => 644, mode => 644,
owner => "vagrant", owner => "vagrant",
group => "ubuntu", group => "vagrant",
content => template("docker/profile"), content => template("docker/profile"),
require => File["/home/vagrant"], require => File["/home/vagrant"],
} }