mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
Add AWS support for running Docker on AWS
This commit is contained in:
@@ -1,7 +1,34 @@
|
||||
class virtualbox {
|
||||
Package { ensure => "installed" }
|
||||
|
||||
# remove some files from the base vagrant image because they're old
|
||||
file { "/home/vagrant/docker-master":
|
||||
ensure => absent,
|
||||
recurse => true,
|
||||
force => true,
|
||||
purge => true,
|
||||
}
|
||||
file { "/usr/local/bin/dockerd":
|
||||
ensure => absent,
|
||||
}
|
||||
|
||||
# Set up VirtualBox guest utils
|
||||
package { "virtualbox-guest-utils": }
|
||||
exec { "vbox-add" :
|
||||
command => "/etc/init.d/vboxadd setup",
|
||||
require => [
|
||||
Package["virtualbox-guest-utils"],
|
||||
Package["linux-headers-3.5.0-25-generic"], ],
|
||||
}
|
||||
}
|
||||
|
||||
class ec2 {
|
||||
}
|
||||
|
||||
class docker {
|
||||
|
||||
# update this with latest docker binary distro
|
||||
$docker_url = "http://docker.io.s3.amazonaws.com/builds/$kernel/$hardwaremodel/docker-master.tgz"
|
||||
$docker_url = "http://get.docker.io/builds/$kernel/$hardwaremodel/docker-master.tgz"
|
||||
# update this with latest go binary distry
|
||||
$go_url = "http://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz"
|
||||
|
||||
@@ -11,18 +38,32 @@ class docker {
|
||||
"pkg-config", "libsqlite3-dev",
|
||||
"linux-image-3.5.0-25-generic",
|
||||
"linux-image-extra-3.5.0-25-generic",
|
||||
"virtualbox-guest-utils",
|
||||
"linux-headers-3.5.0-25-generic"]: }
|
||||
|
||||
notify { "docker_url = $docker_url": withpath => true }
|
||||
|
||||
exec { "debootstrap" :
|
||||
require => Package["debootstrap"],
|
||||
command => "/usr/sbin/debootstrap --arch=amd64 quantal /var/lib/docker/images/docker-ut",
|
||||
creates => "/var/lib/docker/images/docker-ut",
|
||||
timeout => 0
|
||||
$ec2_version = file("/etc/ec2_version", "/dev/null")
|
||||
if ($ec2_version) {
|
||||
include ec2
|
||||
} else {
|
||||
# virtualbox is the vagrant default, so it should be safe to assume
|
||||
include virtualbox
|
||||
}
|
||||
|
||||
user { "vagrant":
|
||||
ensure => present,
|
||||
comment => "Vagrant User",
|
||||
shell => "/bin/bash",
|
||||
home => "/home/vagrant",
|
||||
}
|
||||
|
||||
file { "/usr/local/bin":
|
||||
ensure => directory,
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 755,
|
||||
}
|
||||
|
||||
exec { "fetch-go":
|
||||
require => Package["wget"],
|
||||
command => "/usr/bin/wget -O - $go_url | /bin/tar xz -C /usr/local",
|
||||
@@ -30,9 +71,8 @@ class docker {
|
||||
}
|
||||
|
||||
exec { "fetch-docker" :
|
||||
command => "/usr/bin/wget -O - $docker_url | /bin/tar xz -C /tmp",
|
||||
require => Package["wget"],
|
||||
command => "/usr/bin/wget -O - $docker_url | /bin/tar xz -C /home/vagrant",
|
||||
creates => "/home/vagrant/docker-master"
|
||||
}
|
||||
|
||||
file { "/etc/init/dockerd.conf":
|
||||
@@ -40,25 +80,25 @@ class docker {
|
||||
owner => "root",
|
||||
group => "root",
|
||||
content => template("docker/dockerd.conf"),
|
||||
require => [Exec["fetch-docker"], Exec["debootstrap"]]
|
||||
require => Exec["fetch-docker"],
|
||||
}
|
||||
|
||||
file { "/home/vagrant":
|
||||
mode => 644,
|
||||
require => User["vagrant"],
|
||||
}
|
||||
|
||||
file { "/home/vagrant/.profile":
|
||||
mode => 644,
|
||||
owner => "vagrant",
|
||||
group => "vagrant",
|
||||
group => "ubuntu",
|
||||
content => template("docker/profile"),
|
||||
require => File["/home/vagrant"],
|
||||
}
|
||||
|
||||
exec { "copy-docker-bin" :
|
||||
require => Exec["fetch-docker"],
|
||||
command => "/bin/cp /home/vagrant/docker-master/docker /usr/local/bin",
|
||||
creates => "/usr/local/bin/docker"
|
||||
}
|
||||
|
||||
exec { "vbox-add" :
|
||||
require => Package["linux-headers-3.5.0-25-generic"],
|
||||
command => "/etc/init.d/vboxadd setup",
|
||||
command => "/usr/bin/sudo /bin/cp -f /tmp/docker-master/docker /usr/local/bin/",
|
||||
require => [ Exec["fetch-docker"], File["/usr/local/bin"] ],
|
||||
}
|
||||
|
||||
service { "dockerd" :
|
||||
@@ -69,6 +109,4 @@ class docker {
|
||||
name => "dockerd",
|
||||
provider => "base"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user