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: Remove small dependency Created Feb. 12, 2014, 4:44 p.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
« no previous file with comments | « modules/rietveld/files/rietveld.conf ('k') | modules/rietveld/templates/settings.py.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/rietveld/manifests/init.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/rietveld/manifests/init.pp
@@ -0,0 +1,80 @@
+class rietveld($domain) inherits private::rietveld {
+
+ include nginx
+ $django_home = '/home/rietveld/django-gae2django'
+ $rietveld_home = "${django_home}/examples/rietveld"
+
+ Exec {
+ path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
+ }
+
+ 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':
+ command => "hg clone https://code.google.com/p/django-gae2django/ ${django_home}/",
+ require => Package['mercurial'],
+ user => rietveld,
+ onlyif => "test ! -d ${django_home}",
+ }
+
+ file {"${rietveld_home}/Makefile":
+ ensure => file,
+ owner => rietveld,
+ require => Exec['get_rietveld'],
+ source => 'puppet:///modules/rietveld/Makefile',
+ }
+
+ file {"${rietveld_home}/settings.py":
+ ensure => file,
+ owner => rietveld,
+ require => Exec['get_rietveld'],
+ content => template('rietveld/settings.py.erb'),
+ }
+
+ exec {'install_rietveld':
+ command => "make all",
+ cwd => "${rietveld_home}",
+ user => rietveld,
+ require => [
+ File["${rietveld_home}/Makefile"],
+ File["${rietveld_home}/settings.py"]],
+ onlyif => "test ! -f ${$rietveld_home}/dev.db",
+ }
+
+ file {'/etc/init/rietveld.conf':
+ ensure => file,
+ owner => root,
+ source => 'puppet:///modules/rietveld/rietveld.conf',
+ notify => Service['rietveld'],
+ }
+
+ file {'/etc/init.d/rietveld':
+ ensure => link,
+ target => '/lib/init/upstart-job',
+ require => [File['/etc/init/rietveld.conf'], Exec['install_rietveld']]
+ }
+
+ service {'rietveld':
+ ensure => running,
+ hasstatus => false,
+ require => [Package['gunicorn'], File['/etc/init.d/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('admin', 'admins@adblockplus.org', '${admin_password}')\" | ./manage.py shell",
+ cwd => "${rietveld_home}",
+ require => Exec['install_rietveld'],
+ }
+}
« no previous file with comments | « modules/rietveld/files/rietveld.conf ('k') | modules/rietveld/templates/settings.py.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld