Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow puppet scripts to be more customizable #171

Merged
merged 2 commits into from

3 participants

Matthew Riley MacPherson Owen Coutts Tim Watts
Matthew Riley MacPherson

Includes easier bash setup/use, including persistant bash as
shell inside local.pp and better bashrc stuff.

Owen Coutts

Why do we not want to run migrations from puppet?

Matthew Riley MacPherson

@readevalprint didn't want them running there because he argued that not running them by hand hid things developers needed to do I think? And it was erroring out at the time because of bad migrations. (Paraphrasing, but I think that was it.) He asked me to remove them so I did.

I would rather them there but I just added running them into my own local.pp file instead.

puppet/files/home/vagrant/bashrc_vagrant
@@ -0,0 +1,13 @@
+# bash aliases
+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"

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Tim Watts

looks good, i'll test it

Owen Coutts

Why don't we just make it so the default is to run the migrations automatically but you can overide that in your local.pp file? (i'm not sure if thats possible)

Matthew Riley MacPherson

@tallowen That is slightly more work I think, though I am no puppet master. I can look into that if you want? I think @readevalprint wanted them off by default though, right?

Tim Watts

that's right, forgot to get back to this
r+

Owen Coutts

Can you update the install docs to match the fact that you need to migrate before you do anything? r+wc

tofumatt added some commits
Matthew Riley MacPherson tofumatt Allow puppet scripts to be more customizable
Includes easier bash setup/use, including persistant bash as
shell inside local.pp and better bashrc stuff.
b06d806
Matthew Riley MacPherson tofumatt Don't run migrations in puppet 3309ab6
Matthew Riley MacPherson tofumatt merged commit ad375f5 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2012
  1. Matthew Riley MacPherson

    Allow puppet scripts to be more customizable

    tofumatt authored
    Includes easier bash setup/use, including persistant bash as
    shell inside local.pp and better bashrc stuff.
  2. Matthew Riley MacPherson
This page is out of date. Refresh to see the latest.
13 puppet/files/home/vagrant/bashrc_vagrant
View
@@ -0,0 +1,13 @@
+# bash aliases
+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 --noinput"
+alias tf="dj test --logging-clear-handlers --with-nicedots --failed"
+alias tp="t --pdb --pdb-failure"
+
+# Customize to your needs...
+export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/
+
+cd $HOME/mozillians
1  puppet/manifests/classes/.gitignore
View
@@ -0,0 +1 @@
+local.pp
11 puppet/manifests/classes/dev_hacks.pp
View
@@ -6,6 +6,17 @@
source => "$PROJ_DIR/settings/local.py-dist";
}
+ file { "/home/vagrant/.bashrc_vagrant":
+ ensure => file,
+ source => "$PROJ_DIR/puppet/files/home/vagrant/bashrc_vagrant",
+ owner => "vagrant", group => "vagrant", mode => 0644;
+ }
+
+ # Put our custom bash commands in a separate file.
+ exec { "amend_rc":
+ command => "echo 'if [ -f /home/vagrant/.bashrc_vagrant ] && ! shopt -oq posix; then . /home/vagrant/.bashrc_vagrant; fi' >> /home/vagrant/.bashrc"
+ }
+
file { "/home/vagrant/.zshrc":
ensure => file,
source => "$PROJ_DIR/puppet/files/home/vagrant/zshrc",
20 puppet/manifests/classes/local.pp-dist
View
@@ -0,0 +1,20 @@
+# You can customize this file however you like; it won't be overwritten by
+# vagrant/puppet/git.
+
+# TODO: Have this file have a bunch of variables that are currently in
+# dev-vagrant.pp so you can toggle provisioning steps locally.
+class local {
+
+ # Example: use bash as the default shell instead of zsh with oh-my-zsh.
+ exec { "use_bash":
+ command => "sudo chsh vagrant -s /bin/bash",
+ }
+
+ # Put our custom bash commands in a separate file.
+ # TODO: This is only here because the box wasn't provisioned with this
+ # inside its .bashrc. Next box provision you can remove this.
+ exec { "amend_rc":
+ command => "echo 'if [ -f /home/vagrant/.bashrc_vagrant ] && ! shopt -oq posix; then . /home/vagrant/.bashrc_vagrant; fi' >> /home/vagrant/.bashrc"
+ }
+
+}
2  puppet/manifests/classes/oh_my_zsh.pp
View
@@ -9,7 +9,7 @@
}
exec { "change-shell":
- command => "sudo chsh vagrant /usr/bin/zsh",
+ command => "sudo chsh vagrant -s /usr/bin/zsh",
require => Exec['oh-my-zsh'];
}
}
22 puppet/manifests/classes/playdoh.pp
View
@@ -15,26 +15,4 @@
require => Exec["create_mysql_database"]
}
- # TODO: make this support centos or ubuntu (#centos)
- exec { "sql_migrate":
- cwd => "$PROJ_DIR",
- command => "/usr/bin/python2.6 manage.py syncdb --noinput",
- require => [
- Service["mysql"],
- Package["python2.6-dev", "libapache2-mod-wsgi", "python-wsgi-intercept" ],
-
- #centos Service["mysqld"],
- #centos Package["python26-devel", "python26-mod_wsgi" ],
- Exec["grant_mysql_database"]
- ];
- }
-
- if $USE_SOUTH == 1 {
- exec { "south_migrate":
- cwd => "$PROJ_DIR",
- command => "/usr/bin/python2.6 manage.py migrate",
- require => [ Exec["sql_migrate"] ];
- }
- }
-
}
33 puppet/manifests/dev-vagrant.pp
View
@@ -12,12 +12,25 @@
$USE_YUM_CACHE_ON_HOST = 0
$USE_SOUTH = 1
+# Set this to zero to reprovision a box from scatch. It will take awhile.
$DONT_REPROVISION = 1
Exec {
path => "/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
}
+# You can define custom puppet commands to tailor your local development
+# environment to your taste in classes/local.pp. See local.py-dist for an
+# example.
+#
+# When provisioning a new box, don't include your local customizations.
+# TODO: Disable provisioning if local class is defined.
+if defined(local) {
+ include local
+} else {
+ notice("No local.pp found; use classes/local.pp for customizations.")
+}
+
class dev {
class {
init: before => Class[dev_hacks];
@@ -40,24 +53,16 @@
source => "$PROJ_DIR/settings/local.py-dist";
}
- file { "/home/vagrant/.zshrc":
+ file { "/home/vagrant/.bashrc_vagrant":
ensure => file,
- source => "$PROJ_DIR/puppet/files/home/vagrant/zshrc",
+ source => "$PROJ_DIR/puppet/files/home/vagrant/bashrc_vagrant",
owner => "vagrant", group => "vagrant", mode => 0644;
}
- # TODO: make this support centos or ubuntu (#centos)
- exec { "sql_migrate":
- cwd => "$PROJ_DIR",
- command => "/usr/bin/python2.6 manage.py syncdb --noinput",
- }
-
- if $USE_SOUTH == 1 {
- exec { "south_migrate":
- cwd => "$PROJ_DIR",
- command => "/usr/bin/python2.6 manage.py migrate",
- require => Exec["sql_migrate"],
- }
+ file { "/home/vagrant/.zshrc":
+ ensure => file,
+ source => "$PROJ_DIR/puppet/files/home/vagrant/zshrc",
+ owner => "vagrant", group => "vagrant", mode => 0644;
}
} else {
include dev
Something went wrong with that request. Please try again.