Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/rietveld/manifests/init.pp

Issue 5459448122310656: Add rietveld to infrastructure (Closed)
Patch Set: Created Feb. 7, 2014, 8:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/rietveld/manifests/init.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/rietveld/manifests/init.pp
@@ -0,0 +1,81 @@
+class rietveld($domain) inherits private::rietveld {
+
+ include nginx
+
+ nginx::hostconfig {$domain:
+ content => template('rietveld/site.erb'),
+ enabled => true
+ }
+
+ package {['python-django', 'make', 'patch', 'gunicorn']: ensure => present}
+
+ user {'rietveld':
+ ensure => present,
+ comment => 'User of the rietveld installation',
+ home => '/home/rietveld',
+ managehome => true
+ }
+
+ 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.
+ command => "hg clone https://code.google.com/p/django-gae2django/ /home/rietveld/django-gae2django/",
Felix Dahlke 2014/02/07 15:27:36 ' instead of ", likewise various times below. Acco
christian 2014/02/07 17:17:21 Done.
+ require => Package['mercurial'],
+ user => rietveld,
+ onlyif => "test ! -d /home/rietveld/django-gae2django",
Felix Dahlke 2014/02/07 15:27:36 This path (/home/rietveld/django-gae2django) is be
christian 2014/02/07 17:17:21 Done.
+ 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.
+ #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.
+ }
+
+ file {'/home/rietveld/django-gae2django/examples/rietveld/Makefile':
Felix Dahlke 2014/02/07 15:27:36 This path (/home/rietveld/django-gae2django/exampl
christian 2014/02/07 17:17:21 Done.
+ ensure => file,
+ owner => rietveld,
+ require => Exec['get_rietveld'],
+ source => 'puppet:///modules/rietveld/Makefile',
+ }
+
+ file {'/home/rietveld/django-gae2django/examples/rietveld/settings.py':
+ ensure => file,
+ owner => rietveld,
+ require => Exec['get_rietveld'],
+ source => 'puppet:///modules/rietveld/settings.py',
+ }
+
+ exec { "install_rietveld":
+ 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 :)
+ cwd => "/home/rietveld/django-gae2django/examples/rietveld",
+ user => rietveld,
+ require => [
+ File['/home/rietveld/django-gae2django/examples/rietveld/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.
+ File['/home/rietveld/django-gae2django/examples/rietveld/settings.py']],
+ onlyif => "test ! -f /home/rietveld/django-gae2django/examples/rietveld/dev.db",
+ path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
+ #refreshonly => true,
+ }
+
+ file {'/etc/init/rietveld.conf':
+ ensure => file,
+ owner => root,
+ source => 'puppet:///modules/rietveld/rietveld.conf',
+ notify => Service['rietveld'],
+ }
+
+ #work around puppets limitation towards upstart
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.
+ file { '/etc/init.d/rietveld':
+ ensure => link,
+ target => '/lib/init/upstart-job',
+ require => File['/etc/init/rietveld.conf']
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.
+ }
+
+ service {'rietveld':
+ ensure => running,
+ hasstatus => false,
+ require => [Package['gunicorn'], File['/etc/init.d/rietveld'], Exec['install_rietveld']]
+ }
+
+ exec { "set_superuser":
+ 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",
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
+ cwd => "/home/rietveld/django-gae2django/examples/rietveld",
+ require => Exec['install_rietveld'],
+ path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
+ #refreshonly => true,
+ }
+}

Powered by Google App Engine
This is Rietveld