forked from mozilla/badges.mozilla.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Yo dawg I heard you liked developing so I developed a development VM.
- Loading branch information
Showing
13 changed files
with
288 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require "yaml" | ||
|
||
# Load up our vagrant config files -- vagrantconfig.yaml first | ||
_config = YAML.load(File.open(File.join(File.dirname(__FILE__), | ||
"vagrantconfig.yaml"), File::RDONLY).read) | ||
|
||
# Local-specific/not-git-managed config -- vagrantconfig_local.yaml | ||
begin | ||
_config.merge!(YAML.load(File.open(File.join(File.dirname(__FILE__), | ||
"vagrantconfig_local.yaml"), File::RDONLY).read)) | ||
rescue Errno::ENOENT # No vagrantconfig_local.yaml found -- that's OK; just | ||
# use the defaults. | ||
end | ||
|
||
CONF = _config | ||
MOUNT_POINT = '/home/vagrant/project' | ||
|
||
Vagrant::Config.run do |config| | ||
config.vm.box = "lucid32" | ||
config.vm.box_url = "http://files.vagrantup.com/lucid32.box" | ||
|
||
config.vm.forward_port("web", 8000, 8000) | ||
|
||
# Increase vagrant's patience during hang-y CentOS bootup | ||
# see: https://github.com/jedi4ever/veewee/issues/14 | ||
config.ssh.max_tries = 50 | ||
config.ssh.timeout = 300 | ||
|
||
# nfs needs to be explicitly enabled to run. | ||
if CONF['nfs'] == false or RUBY_PLATFORM =~ /mswin(32|64)/ | ||
config.vm.share_folder("v-root", MOUNT_POINT, ".") | ||
else | ||
config.vm.share_folder("v-root", MOUNT_POINT, ".", :nfs => true) | ||
end | ||
|
||
# Add to /etc/hosts: 33.33.33.24 dev.playdoh.org | ||
config.vm.network "33.33.33.24" | ||
|
||
config.vm.provision :puppet do |puppet| | ||
puppet.manifests_path = "puppet/manifests" | ||
puppet.manifest_file = "vagrant.pp" | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# HACK: Make the server reload after every hit to refresh django code | ||
MaxRequestsPerChild 1 | ||
|
||
WSGISocketPrefix /var/run/wsgi | ||
|
||
<VirtualHost *:443 *:80> | ||
ServerName dev.playdoh.org | ||
|
||
DirectoryIndex index.php index.html | ||
Options -Indexes | ||
|
||
RewriteEngine On | ||
|
||
DocumentRoot "/var/www/html/" | ||
|
||
Alias /media/ "/home/vagrant/project/media/" | ||
Alias /admin-media/ "/home/vagrant/project/vendor/src/django/django/contrib/admin/media/" | ||
|
||
WSGIDaemonProcess playdoh processes=1 threads=1 maximum-requests=1 | ||
WSGIProcessGroup playdoh | ||
|
||
WSGIScriptAlias / "/home/vagrant/project/wsgi/playdoh.wsgi" | ||
|
||
<Proxy *> | ||
AddDefaultCharset off | ||
Order deny,allow | ||
Deny from all | ||
Allow from all | ||
</Proxy> | ||
</VirtualHost> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Red Hat, CentOS, and Fedora think Apache is the only web server | ||
# ever, so we have to use a different package on CentOS than Ubuntu. | ||
class apache { | ||
case $operatingsystem { | ||
centos: { | ||
package { "httpd-devel": | ||
ensure => present, | ||
before => File['/etc/httpd/conf.d/playdoh.conf']; | ||
} | ||
|
||
file { "/etc/httpd/conf.d/playdoh.conf": | ||
source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/playdoh.conf", | ||
owner => "root", group => "root", mode => 0644, | ||
require => [ | ||
Package['httpd-devel'] | ||
]; | ||
} | ||
|
||
service { "httpd": | ||
ensure => running, | ||
enable => true, | ||
require => [ | ||
Package['httpd-devel'], | ||
File['/etc/httpd/conf.d/playdoh.conf'] | ||
]; | ||
} | ||
|
||
} | ||
ubuntu: { | ||
package { "apache2-dev": | ||
ensure => present, | ||
before => File['/etc/apache2/sites-enabled/playdoh.conf']; | ||
} | ||
|
||
file { "/etc/apache2/sites-enabled/playdoh.conf": | ||
source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/playdoh.conf", | ||
owner => "root", group => "root", mode => 0644, | ||
require => [ | ||
Package['apache2-dev'] | ||
]; | ||
} | ||
|
||
service { "apache2": | ||
ensure => running, | ||
enable => true, | ||
require => [ | ||
Package['apache2-dev'], | ||
File['/etc/apache2/sites-enabled/playdoh.conf'] | ||
]; | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# You can add custom puppet manifests for your app here. | ||
class custom { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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 => "/usr/bin/sudo /usr/bin/apt-get update", | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# We use memcached in production, so we _should_ use it while | ||
# we develop as well. That said, playdoh shouldn't *rely* on it | ||
# entirely; it should work with any non-null cache store in Django. | ||
class memcached { | ||
package { "memcached": | ||
ensure => installed; | ||
} | ||
|
||
service { "memcached": | ||
ensure => running, | ||
enable => true, | ||
require => Package['memcached']; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Get mysql up and running | ||
class mysql { | ||
package { "mysql-server": | ||
ensure => installed; | ||
} | ||
|
||
case $operatingsystem { | ||
centos: { | ||
package { "mysql-devel": | ||
ensure => installed; | ||
} | ||
} | ||
|
||
ubuntu: { | ||
package { "libmysqld-dev": | ||
ensure => installed; | ||
} | ||
} | ||
} | ||
|
||
service { "mysql": | ||
ensure => running, | ||
enable => true, | ||
require => Package['mysql-server']; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# playdoh-specific commands that get playdoh all going so you don't | ||
# have to. | ||
|
||
# TODO: Make this rely on things that are not straight-up exec. | ||
class playdoh { | ||
exec { "create_mysql_database": | ||
command => "/usr/bin/mysqladmin -uroot create $DB_NAME", | ||
unless => "/usr/bin/mysql -uroot -B --skip-column-names -e 'show databases' | /bin/grep '$DB_NAME'", | ||
} | ||
|
||
exec { "grant_mysql_database": | ||
command => "/usr/bin/mysql -uroot -B -e'GRANT ALL PRIVILEGES ON $DB_NAME.* TO $DB_USER@localhost # IDENTIFIED BY \"$DB_PASS\"'", | ||
unless => "/usr/bin/mysql -uroot -B --skip-column-names mysql -e 'select user from user' | /bin/grep '$DB_USER'", | ||
require => Exec["create_mysql_database"]; | ||
} | ||
|
||
exec { "syncdb": | ||
cwd => "$PROJ_DIR", | ||
command => "/usr/bin/python2.6 ./manage.py syncdb --noinput", | ||
require => Exec["grant_mysql_database"]; | ||
} | ||
|
||
exec { "sql_migrate": | ||
cwd => "$PROJ_DIR", | ||
command => "/usr/bin/python2.6 ./vendor/src/schematic/schematic migrations/", | ||
require => [ | ||
Service["mysql"], | ||
Package["python2.6-dev", "libapache2-mod-wsgi", "python-wsgi-intercept" ], | ||
Exec["syncdb"] | ||
]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Install python and compiled modules for project | ||
class python { | ||
case $operatingsystem { | ||
centos: { | ||
package { | ||
[ "python26-devel", "python26-libs", "python26-distribute", "python26-mod_wsgi" ]: | ||
ensure => installed; | ||
} | ||
|
||
exec { "pip-install": | ||
command => "/usr/bin/easy_install-2.6 -U pip", | ||
creates => "/usr/bin/pip", | ||
require => Package["python26-devel","python26-distribute"] | ||
} | ||
|
||
exec { "pip-install-compiled": | ||
command => "/usr/bin/pip install -r $PROJ_DIR/requirements/compiled.txt", | ||
require => Exec['pip-install'] | ||
} | ||
} | ||
|
||
ubuntu: { | ||
package { | ||
[ "python2.6-dev", "python2.6", "libapache2-mod-wsgi", "python-wsgi-intercept", "python-pip" ]: | ||
ensure => installed; | ||
} | ||
|
||
exec { "pip-install-compiled": | ||
command => "/usr/bin/pip install -r $PROJ_DIR/requirements/compiled.txt", | ||
require => Package['python-pip'] | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# Playdoh puppet magic for dev boxes | ||
# | ||
import "classes/*.pp" | ||
|
||
$PROJ_DIR = "/home/vagrant/project" | ||
|
||
# You can make these less generic if you like, but these are box-specific | ||
# so it's not required. | ||
$DB_NAME = "playdoh_app" | ||
$DB_USER = "root" | ||
|
||
class dev { | ||
class { | ||
init: before => Class[mysql]; | ||
mysql: before => Class[python]; | ||
python: before => Class[apache]; | ||
apache: before => Class[playdoh]; | ||
memcached: ; | ||
playdoh: ; | ||
custom: ; | ||
} | ||
} | ||
|
||
include dev |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Default config for Vagrant | ||
|
||
# Don't change this; use vagrantconfig_local.yaml to override these | ||
# settings instead. | ||
nfs: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Configuration for Vagrant | ||
|
||
# Change to true if you can use nfs; using nfs significantly | ||
# improves performance. | ||
nfs: false |