Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Fix the vagrants
Browse files Browse the repository at this point in the history
Add a new, lean base box, have puppet scripts for most things to
easisly rebuild our box, and have it work out-of-the-box. YAY!
  • Loading branch information
tofumatt committed Mar 7, 2012
1 parent b7c4d29 commit 701fda7
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 58 deletions.
12 changes: 4 additions & 8 deletions Vagrantfile
Expand Up @@ -16,20 +16,17 @@ CONF = _config
MOUNT_POINT = '/home/vagrant/mozillians' MOUNT_POINT = '/home/vagrant/mozillians'


Vagrant::Config.run do |config| Vagrant::Config.run do |config|
config.vm.box = "mozillians-v1.0"
config.vm.box_url = "http://people.mozilla.org/~mmacpherson/mozillians-v1.0.box"


config.vm.box = "mozillians-v9.box" config.vm.forward_port 8000, 8000
config.vm.box_url = "http://people.mozilla.com/~ddash/mozillians-v9.box"

config.vm.forward_port("web", 8001, 8001)
config.vm.forward_port("ldap", 1389, 1389)


# Increase vagrant's patience during hang-y CentOS bootup # Increase vagrant's patience during hang-y CentOS bootup
# see: https://github.com/jedi4ever/veewee/issues/14 # see: https://github.com/jedi4ever/veewee/issues/14
config.ssh.max_tries = 50 config.ssh.max_tries = 50
config.ssh.timeout = 300 config.ssh.timeout = 300


# nfs needs to be explicitly enabled to run. # nfs needs to be explicitly enabled to run.

if CONF['nfs'] == false or RUBY_PLATFORM =~ /mswin(32|64)/ if CONF['nfs'] == false or RUBY_PLATFORM =~ /mswin(32|64)/
config.vm.share_folder("v-root", MOUNT_POINT, ".") config.vm.share_folder("v-root", MOUNT_POINT, ".")
else else
Expand All @@ -41,12 +38,11 @@ Vagrant::Config.run do |config|
# config.vm.customize ["modifyvm", :id, "--cpuexecutioncap", "90"] # config.vm.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]


# Add to /etc/hosts: 33.33.33.24 dev.mozillians.org # Add to /etc/hosts: 33.33.33.24 dev.mozillians.org
config.vm.network "33.33.33.24" config.vm.network :hostonly, "33.33.33.24"


config.vm.provision :puppet do |puppet| config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests" puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "dev-vagrant.pp" puppet.manifest_file = "dev-vagrant.pp"
puppet.module_path = "puppet/modules" puppet.module_path = "puppet/modules"
end end

end end
37 changes: 24 additions & 13 deletions puppet/files/home/vagrant/zshrc
@@ -1,36 +1,47 @@
# Path to your oh-my-zsh configuration. # Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh ZSH=$HOME/.oh-my-zsh


# Set name of the theme to load. # Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/ # Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each # Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded. # time that oh-my-zsh is loaded.
export ZSH_THEME="cypher" # Themes just cause trouble inside vagrant, so we disable them.
# ZSH_THEME="robbyrussell"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias dj="./manage.py"
alias runserver="dj runserver 0.0.0.0:8000"
alias rs="runserver"
alias t="dj test -x --logging-clear-handlers --with-nicedots"
alias td="FORCE_DB=True t"
alias tf="dj test --logging-clear-handlers --with-nicedots --failed"
alias tp="t --pdb --pdb-failure"


# Set to this to use case-sensitive completion # Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true" # CASE_SENSITIVE="true"


# Comment this out to disable weekly auto-update checks # Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true" DISABLE_AUTO_UPDATE="true"


# Uncomment following line if you want to disable colors in ls # Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true" # DISABLE_LS_COLORS="true"


# Uncomment following line if you want to disable autosetting terminal title. # Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true" # DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"


# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse) # Example format: plugins=(rails git textmate ruby lighthouse)
plugins=() plugins=(git django vagrant python pip)


source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh


# Customize to your needs... # Customize to your needs...
export PATH=$HOME/mozillians/directory/localtest/bin:/usr/local/libexec/:/vagrant/directory/localtest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/


. $HOME/.virtualenvs/mozillians/bin/activate
cd $HOME/mozillians cd $HOME/mozillians

pushd $HOME/mozillians/directory/devslapd/
. $HOME/mozillians/directory/devslapd/setup.sh
popd
2 changes: 1 addition & 1 deletion puppet/manifests/classes/dev_tools.pp
Expand Up @@ -10,7 +10,7 @@


ubuntu: { ubuntu: {
package { package {
[ "git-core", "vim", "emacs" ]: [ "git-core", "vim", "emacs", "zsh" ]:
ensure => installed; ensure => installed;
} }
} }
Expand Down
25 changes: 25 additions & 0 deletions puppet/manifests/classes/init.pp
@@ -0,0 +1,25 @@
# stage {"pre": before => Stage["main"]} class {'apt': stage => 'pre'}

# Commands to run before all others in puppet.
class init {
group { "puppet":
ensure => "present",
}

case $operatingsystem {
ubuntu: {
exec { "update_apt":
command => "sudo apt-get update",
}

# Provides "add-apt-repository" command, useful if you need
# to install software from other apt repositories.
package { "python-software-properties":
ensure => present,
require => [
Exec['update_apt'],
];
}
}
}
}
15 changes: 15 additions & 0 deletions puppet/manifests/classes/oh_my_zsh.pp
@@ -0,0 +1,15 @@
class oh_my_zsh {
exec { "oh-my-zsh":
command => "wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh",
require => Package['git-core', 'zsh'],
cwd => '/home/vagrant/',
user => 'vagrant';
#path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
#refreshonly => true,
}

exec { "change-shell":
command => "sudo chsh vagrant /usr/bin/zsh",
require => Exec['oh-my-zsh'];
}
}
2 changes: 1 addition & 1 deletion puppet/manifests/classes/playdoh.pp
Expand Up @@ -18,7 +18,7 @@
# TODO: make this support centos or ubuntu (#centos) # TODO: make this support centos or ubuntu (#centos)
exec { "sql_migrate": exec { "sql_migrate":
cwd => "$PROJ_DIR", cwd => "$PROJ_DIR",
command => "/usr/bin/python2.6 ./vendor/src/schematic/schematic migrations/", command => "/usr/bin/python2.6 manage.py syncdb --noinput",
require => [ require => [
Service["mysql"], Service["mysql"],
Package["python2.6-dev", "libapache2-mod-wsgi", "python-wsgi-intercept" ], Package["python2.6-dev", "libapache2-mod-wsgi", "python-wsgi-intercept" ],
Expand Down
2 changes: 1 addition & 1 deletion puppet/manifests/classes/python.pp
Expand Up @@ -29,4 +29,4 @@
} }


} }
} }
23 changes: 21 additions & 2 deletions puppet/manifests/dev-vagrant.pp
Expand Up @@ -12,10 +12,15 @@
$USE_YUM_CACHE_ON_HOST = 0 $USE_YUM_CACHE_ON_HOST = 0
$USE_SOUTH = 1 $USE_SOUTH = 1


Exec { path => [ "/bin/"] } $DONT_REPROVISION = 1

Exec {
path => "/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
}


class dev { class dev {
class { class {
init: before => Class[dev_hacks];
dev_hacks: before => Class[repos]; dev_hacks: before => Class[repos];
repos: before => Class[dev_tools]; repos: before => Class[dev_tools];
dev_tools: before => Class[mysql]; dev_tools: before => Class[mysql];
Expand All @@ -25,7 +30,21 @@
memcached:; memcached:;
playdoh_site:; playdoh_site:;
elasticsearch: version => "0.18.6"; elasticsearch: version => "0.18.6";
# oh_my_zsh:;
}
}

if $DONT_REPROVISION == 1 {
file { "$PROJ_DIR/settings/local.py":
ensure => file,
source => "$PROJ_DIR/settings/local.py-dist";
} }
} else {
include dev
} }


include dev exec { "es-restart":
command => "/usr/local/elasticsearch/bin/service/elasticsearch restart",
#path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
#refreshonly => true,
}
69 changes: 38 additions & 31 deletions puppet/modules/elasticsearch/manifests/init.pp
Expand Up @@ -17,47 +17,54 @@


class sun_java_6 { class sun_java_6 {


$release = regsubst(generate("/usr/bin/lsb_release", "-s", "-c"), '(\w+)\s', '\1') # $release = regsubst(generate("/usr/bin/lsb_release", "-s", "-c"), '(\w+)\s', '\1')


file { "partner.list": # file { "partner.list":
path => "/etc/apt/sources.list.d/partner.list", # path => "/etc/apt/sources.list.d/partner.list",
ensure => file, # ensure => file,
owner => "root", # owner => "root",
group => "root", # group => "root",
content => "deb http://archive.canonical.com/ $release partner\ndeb-src http://archive.canonical.com/ $release partner\n", # content => "deb http://archive.canonical.com/ $release partner\ndeb-src http://archive.canonical.com/ $release partner\n",
notify => Exec["apt-get-update"], # notify => Exec["apt-get-update"],
} # require => Exec['add-java'],
# }

# exec { "add-java":
# command => "sudo add-apt-repository ppa:ferramroberto/java",
# #path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
# #refreshonly => true,
# }


exec { "apt-get-update": exec { "apt-get-update":
command => "/usr/bin/apt-get update", command => "/usr/bin/apt-get update",
refreshonly => true, refreshonly => true,
} }


package { "debconf-utils": package { ["debconf-utils", "openjdk-6-jre-headless"]:
ensure => installed ensure => installed
} }


exec { "agree-to-jdk-license": # exec { "agree-to-jdk-license":
command => "/bin/echo -e sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | debconf-set-selections", # command => "/bin/echo -e sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | debconf-set-selections",
unless => "debconf-get-selections | grep 'sun-java6-jdk.*shared/accepted-sun-dlj-v1-1.*true'", # unless => "debconf-get-selections | grep 'sun-java6-jdk.*shared/accepted-sun-dlj-v1-1.*true'",
path => ["/bin", "/usr/bin"], require => Package["debconf-utils"], # path => ["/bin", "/usr/bin"], require => Package["debconf-utils"],
} # }


exec { "agree-to-jre-license": # exec { "agree-to-jre-license":
command => "/bin/echo -e sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | debconf-set-selections", # command => "/bin/echo -e sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | debconf-set-selections",
unless => "debconf-get-selections | grep 'sun-java6-jre.*shared/accepted-sun-dlj-v1-1.*true'", # unless => "debconf-get-selections | grep 'sun-java6-jre.*shared/accepted-sun-dlj-v1-1.*true'",
path => ["/bin", "/usr/bin"], require => Package["debconf-utils"], # path => ["/bin", "/usr/bin"], require => Package["debconf-utils"],
} # }


package { "sun-java6-jdk": # package { "sun-java6-jdk":
ensure => latest, # ensure => latest,
require => [ File["partner.list"], Exec["agree-to-jdk-license"], Exec["apt-get-update"] ], # require => [ File["partner.list"], Exec["agree-to-jdk-license"], Exec["apt-get-update"] ],
} # }


package { "sun-java6-jre": # package { "sun-java6-jre":
ensure => latest, # ensure => latest,
require => [ File["partner.list"], Exec["agree-to-jre-license"], Exec["apt-get-update"] ], # require => [ File["partner.list"], Exec["agree-to-jre-license"], Exec["apt-get-update"] ],
} # }


} }


Expand All @@ -84,7 +91,7 @@
$esJarfile = "${esName}.jar" $esJarfile = "${esName}.jar"
$esServiceRev = "3e0b23d" $esServiceRev = "3e0b23d"


include sun_java_6 # include sun_java_6


download_file { download_file {
["${esName}.tar.gz"]: ["${esName}.tar.gz"]:
Expand All @@ -105,7 +112,7 @@
comment => "Elasticsearch user created by puppet", comment => "Elasticsearch user created by puppet",
managehome => true, managehome => true,
shell => "/bin/false", shell => "/bin/false",
require => [Package["sun-java6-jre"]], #require => [Package["sun-java6-jre"]],
uid => 901 uid => 901
} }


Expand Down
4 changes: 3 additions & 1 deletion settings/local.py-dist
Expand Up @@ -6,7 +6,7 @@ from settings import *
# For absoluate urls # For absoluate urls
DOMAIN = "localhost" DOMAIN = "localhost"
PROTOCOL = "http://" PROTOCOL = "http://"
PORT = 8001 PORT = 8000


SITE_URL = '%s%s:%d' % (PROTOCOL, DOMAIN, PORT) SITE_URL = '%s%s:%d' % (PROTOCOL, DOMAIN, PORT)


Expand Down Expand Up @@ -55,3 +55,5 @@ DEBUG = TEMPLATE_DEBUG = True
ES_DISABLED = False ES_DISABLED = False
ES_HOSTS = ['127.0.0.1:9200'] ES_HOSTS = ['127.0.0.1:9200']
ES_INDEXES = dict(default='mozillians_dev') ES_INDEXES = dict(default='mozillians_dev')

CELERY_ALWAYS_EAGER = True

0 comments on commit 701fda7

Please sign in to comment.