OLD | NEW |
(Empty) | |
| 1 class rietveld($domain) inherits private::rietveld { |
| 2 |
| 3 include nginx |
| 4 $django_home = '/home/rietveld/django-gae2django' |
| 5 $rietveld_home = "${django_home}/examples/rietveld" |
| 6 |
| 7 Exec { |
| 8 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
| 9 } |
| 10 |
| 11 nginx::hostconfig {$domain: |
| 12 content => template('rietveld/site.erb'), |
| 13 enabled => true |
| 14 } |
| 15 |
| 16 package {['python-django', 'make', 'patch', 'gunicorn']: ensure => present} |
| 17 |
| 18 user {'rietveld': |
| 19 ensure => present, |
| 20 comment => 'User of the rietveld installation', |
| 21 home => '/home/rietveld', |
| 22 managehome => true |
| 23 } |
| 24 |
| 25 exec {'get_rietveld': |
| 26 command => "hg clone https://code.google.com/p/django-gae2django/ ${django_h
ome}/", |
| 27 require => Package['mercurial'], |
| 28 user => rietveld, |
| 29 onlyif => "test ! -d ${django_home}", |
| 30 } |
| 31 |
| 32 file {"${rietveld_home}/Makefile": |
| 33 ensure => file, |
| 34 owner => rietveld, |
| 35 require => Exec['get_rietveld'], |
| 36 source => 'puppet:///modules/rietveld/Makefile', |
| 37 } |
| 38 |
| 39 file {"${rietveld_home}/settings.py": |
| 40 ensure => file, |
| 41 owner => rietveld, |
| 42 require => Exec['get_rietveld'], |
| 43 content => template('rietveld/settings.py.erb'), |
| 44 } |
| 45 |
| 46 exec {'install_rietveld': |
| 47 command => "make all", |
| 48 cwd => "${rietveld_home}", |
| 49 user => rietveld, |
| 50 require => [ |
| 51 File["${rietveld_home}/Makefile"], |
| 52 File["${rietveld_home}/settings.py"]], |
| 53 onlyif => "test ! -f ${$rietveld_home}/dev.db", |
| 54 } |
| 55 |
| 56 file {'/etc/init/rietveld.conf': |
| 57 ensure => file, |
| 58 owner => root, |
| 59 source => 'puppet:///modules/rietveld/rietveld.conf', |
| 60 notify => Service['rietveld'], |
| 61 } |
| 62 |
| 63 #work around puppets limitation towards upstart |
| 64 file {'/etc/init.d/rietveld': |
| 65 ensure => link, |
| 66 target => '/lib/init/upstart-job', |
| 67 require => File['/etc/init/rietveld.conf'] |
| 68 } |
| 69 |
| 70 service {'rietveld': |
| 71 ensure => running, |
| 72 hasstatus => false, |
| 73 require => [Package['gunicorn'], File['/etc/init.d/rietveld'], Exec['install
_rietveld']] |
| 74 } |
| 75 |
| 76 exec {'set_superuser': |
| 77 command => "echo \"from django.db import DEFAULT_DB_ALIAS as database; from
django.contrib.auth.models import User; User.objects.db_manager(database).create
_superuser('admin', 'admins@adblockplus.org', '${admin_password}')\" | ./manage.
py shell", |
| 78 cwd => "${rietveld_home}", |
| 79 require => Exec['install_rietveld'], |
| 80 } |
| 81 } |
OLD | NEW |