| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 class rietveld($domain) inherits private::rietveld { | 1 class rietveld($domain) inherits private::rietveld { |
| 2 | 2 |
| 3 include nginx | 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 } | |
| 4 | 10 |
| 5 nginx::hostconfig {$domain: | 11 nginx::hostconfig {$domain: |
| 6 content => template('rietveld/site.erb'), | 12 content => template('rietveld/site.erb'), |
| 7 enabled => true | 13 enabled => true |
| 8 } | 14 } |
| 9 | 15 |
| 10 package {['python-django', 'make', 'patch', 'gunicorn']: ensure => present} | 16 package {['python-django', 'make', 'patch', 'gunicorn']: ensure => present} |
| 11 | 17 |
| 12 user {'rietveld': | 18 user {'rietveld': |
| 13 ensure => present, | 19 ensure => present, |
| 14 comment => 'User of the rietveld installation', | 20 comment => 'User of the rietveld installation', |
| 15 home => '/home/rietveld', | 21 home => '/home/rietveld', |
| 16 managehome => true | 22 managehome => true |
| 17 } | 23 } |
| 18 | 24 |
| 19 exec { "get_rietveld": | 25 exec {'get_rietveld': |
|
Felix Dahlke
2014/02/07 15:27:36
No space after {, and ' instead of ". Likewise bel
christian
2014/02/07 17:17:21
Done.
| |
| 20 command => "hg clone https://code.google.com/p/django-gae2django/ /home/riet veld/django-gae2django/", | 26 command => "hg clone https://code.google.com/p/django-gae2django/ ${django_h ome}/", |
|
Felix Dahlke
2014/02/07 15:27:36
' instead of ", likewise various times below. Acco
christian
2014/02/07 17:17:21
Done.
| |
| 21 require => Package['mercurial'], | 27 require => Package['mercurial'], |
| 22 user => rietveld, | 28 user => rietveld, |
| 23 onlyif => "test ! -d /home/rietveld/django-gae2django", | 29 onlyif => "test ! -d ${django_home}", |
|
Felix Dahlke
2014/02/07 15:27:36
This path (/home/rietveld/django-gae2django) is be
christian
2014/02/07 17:17:21
Done.
| |
| 24 path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin", | |
|
Felix Dahlke
2014/02/07 15:27:36
This is repeated below, you can have this above in
christian
2014/02/07 17:17:21
Done.
| |
| 25 #refreshonly => true, | |
|
Felix Dahlke
2014/02/07 15:27:36
Let's remove this if we don't need it. Likewise be
christian
2014/02/07 17:17:21
Done.
| |
| 26 } | 30 } |
| 27 | 31 |
| 28 file {'/home/rietveld/django-gae2django/examples/rietveld/Makefile': | 32 file {"${rietveld_home}/Makefile": |
|
Felix Dahlke
2014/02/07 15:27:36
This path (/home/rietveld/django-gae2django/exampl
christian
2014/02/07 17:17:21
Done.
| |
| 29 ensure => file, | 33 ensure => file, |
| 30 owner => rietveld, | 34 owner => rietveld, |
| 31 require => Exec['get_rietveld'], | 35 require => Exec['get_rietveld'], |
| 32 source => 'puppet:///modules/rietveld/Makefile', | 36 source => 'puppet:///modules/rietveld/Makefile', |
| 33 } | 37 } |
| 34 | 38 |
| 35 file {'/home/rietveld/django-gae2django/examples/rietveld/settings.py': | 39 file {"${rietveld_home}/settings.py": |
| 36 ensure => file, | 40 ensure => file, |
| 37 owner => rietveld, | 41 owner => rietveld, |
| 38 require => Exec['get_rietveld'], | 42 require => Exec['get_rietveld'], |
| 39 source => 'puppet:///modules/rietveld/settings.py', | 43 content => template('rietveld/settings.py.erb'), |
| 40 } | 44 } |
| 41 | 45 |
| 42 exec { "install_rietveld": | 46 exec {'install_rietveld': |
| 43 command => "make all", | 47 command => "make all", |
|
Felix Dahlke
2014/02/07 15:27:36
"all" is not necessary
christian
2014/02/07 17:17:21
Actual it is,see Makefile
default:
@echo "Run 'm
Felix Dahlke
2014/02/07 20:09:45
Ah. Well that's peculiar :)
| |
| 44 cwd => "/home/rietveld/django-gae2django/examples/rietveld", | 48 cwd => "${rietveld_home}", |
| 45 user => rietveld, | 49 user => rietveld, |
| 46 require => [ | 50 require => [ |
| 47 File['/home/rietveld/django-gae2django/examples/rietveld/Makefile'], | 51 File["${rietveld_home}/Makefile"], |
|
Felix Dahlke
2014/02/07 15:27:36
Should be indented just one level deeper than the
christian
2014/02/07 17:17:21
Done.
| |
| 48 File['/home/rietveld/django-gae2django/examples/rietveld/settings.py']], | 52 File["${rietveld_home}/settings.py"]], |
| 49 onlyif => "test ! -f /home/rietveld/django-gae2django/examples/rietveld/dev. db", | 53 onlyif => "test ! -f ${$rietveld_home}/dev.db", |
| 50 path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin", | |
| 51 #refreshonly => true, | |
| 52 } | 54 } |
| 53 | 55 |
| 54 file {'/etc/init/rietveld.conf': | 56 file {'/etc/init/rietveld.conf': |
| 55 ensure => file, | 57 ensure => file, |
| 56 owner => root, | 58 owner => root, |
| 57 source => 'puppet:///modules/rietveld/rietveld.conf', | 59 source => 'puppet:///modules/rietveld/rietveld.conf', |
| 58 notify => Service['rietveld'], | 60 notify => Service['rietveld'], |
| 59 } | 61 } |
| 60 | 62 |
| 61 #work around puppets limitation towards upstart | 63 file {'/etc/init.d/rietveld': |
|
Felix Dahlke
2014/02/07 15:27:36
This is not really clear, what particular limitati
christian
2014/02/07 17:17:21
It is simple, puppet is not aware of upstart so it
Felix Dahlke
2014/02/07 20:09:45
If Puppet can't do Upstart at all, I don't think t
christian
2014/02/12 14:14:26
Done.
| |
| 62 file { '/etc/init.d/rietveld': | |
| 63 ensure => link, | 64 ensure => link, |
| 64 target => '/lib/init/upstart-job', | 65 target => '/lib/init/upstart-job', |
| 65 require => File['/etc/init/rietveld.conf'] | 66 require => [File['/etc/init/rietveld.conf'], Exec['install_rietveld']] |
|
Felix Dahlke
2014/02/07 15:27:36
Shouldn't this require Exec['install_rietveld']? N
christian
2014/02/07 17:17:21
This only makes the symlink, the service it self n
Felix Dahlke
2014/02/07 20:09:45
Well, I think /etc/init.d/rietveld logically depen
christian
2014/02/12 14:14:26
Done.
| |
| 66 } | 67 } |
| 67 | 68 |
| 68 service {'rietveld': | 69 service {'rietveld': |
| 69 ensure => running, | 70 ensure => running, |
| 70 hasstatus => false, | 71 hasstatus => false, |
| 71 require => [Package['gunicorn'], File['/etc/init.d/rietveld'], Exec['install _rietveld']] | 72 require => [Package['gunicorn'], File['/etc/init.d/rietveld']] |
| 72 } | 73 } |
| 73 | 74 |
| 74 exec { "set_superuser": | 75 exec {'set_superuser': |
| 75 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('rietveld', 'rietveld@example.org', '${admin_password}')\" | ./manage .py shell", | 76 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", |
|
Felix Dahlke
2014/02/07 15:27:36
I suppose it's fine to just have a single admin ac
christian
2014/02/07 17:17:21
I found it easier to just make this one account an
Felix Dahlke
2014/02/07 20:09:45
Ah, I see. Yeah sure, we only need to create the a
| |
| 76 cwd => "/home/rietveld/django-gae2django/examples/rietveld", | 77 cwd => "${rietveld_home}", |
| 77 require => Exec['install_rietveld'], | 78 require => Exec['install_rietveld'], |
| 78 path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin", | |
| 79 #refreshonly => true, | |
| 80 } | 79 } |
| 81 } | 80 } |
| LEFT | RIGHT |