Created
August 2, 2011 10:48
-
-
Save telent/1119996 to your computer and use it in GitHub Desktop.
Puppetised redmine on Debian, first pass
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
# gist has no puppet syntax highlighting? shurely shome mishtake | |
# Faced with the choice of writing down in English how I installed redmine so that | |
# A N Other admin could repeat it at a later date, or writing down in Puppet | |
# syntax how I would propose to install it, I went for the latter option and | |
# now I can repeat it at any date I like. Oh, let's run it again! | |
# This works for me. If you have the Debian Squeeze versions of ruby and puppet, | |
# it may also work for you. If it breaks, you get to keep both halves. I used | |
# sqlite3 mostly because I loathe and detest mysql and expect to have only a | |
# few users, but if that doesn't apply to you then please edit the | |
# config/database.yml so that it makes sense for your requirement | |
# You should probably put a reverse proxy (varnish, or nginx, or apache, or | |
# pound, or something) in front of this for real-world use. Although thin is | |
# most likely a lot more robust/performant than webrick, it's still an | |
# unfriendly world out there | |
class redmine { | |
$dir='/usr/local/lib/redmine/redmine-1.2.1/' | |
package {["libsqlite3-ruby1.8","sqlite3","libsqlite3-dev", | |
"libsqlite3-0","rake","rubygems"]: | |
} | |
file {'/usr/local/lib/redmine': | |
ensure=>directory,owner=>"www-data", | |
} | |
exec { 'unpack-redmine': | |
cwd=>'/usr/local/lib/redmine', | |
user=>"www-data", | |
command=>'/bin/sh -c "wget -O redmine.tgz http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-1.2.1.tar.gz && tar zxf redmine.tgz >>/tmp/make.log 2>&1"', | |
creates=>"$dir/config", | |
} | |
file { "$dir/config/database.yml": | |
require=>Exec['unpack-redmine'], | |
content=>'production: | |
adapter: sqlite3 | |
database: db/redmine.sqlite3 | |
' | |
} | |
package {'i18n': ensure=>'0.4.2', provider=>gem, } | |
package {'rack': ensure=>'1.1.2', provider=>gem, } | |
package {'thin': ensure=>'latest', provider=>gem, } | |
exec {'install-redmine': | |
require=>[File["$dir/config/database.yml"], | |
Package['rake','rubygems','i18n']], | |
creates=>"$dir/config/initializers/session_store.rb", | |
user=>"www-data", | |
cwd=>$dir, | |
environment=>['RAILS_ENV=production','REDMINE_LANG=en'], | |
command=>'/usr/bin/rake generate_session_store db:migrate redmine:load_default_data', | |
logoutput=>true | |
} | |
service {'redmine': | |
require=>[Exec['install-redmine'],Package['thin','rack']], | |
ensure=>'running', | |
start=>"/bin/su www-data -c \"cd $dir && /usr/bin/ruby script/server thin -d -e production\"", | |
stop=>"/bin/kill -INT `cat $dir/tmp/pids/server.pid`", | |
status=>"/bin/kill -0 `cat $dir/tmp/pids/server.pid`", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment