]> gitweb.fluxo.info Git - puppet-pyroscope.git/commitdiff
Builds pyroscope and rtorrent-ps
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 9 Mar 2017 00:57:46 +0000 (21:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 9 Mar 2017 00:57:46 +0000 (21:57 -0300)
README
manifests/dependencies.pp
manifests/init.pp

diff --git a/README b/README
index df1db893e37e731564e62f31225da95b3de4532f..63f78dcd9633d157eae538394fe8fd1c23147d41 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,4 @@
 Pyroscope Puppet Module
 =======================
 
-This module manages the environment needed to run pyroscope.
-
-It doesn't install pyroscope, something that can be easily achieved following
-https://code.google.com/p/pyroscope/wiki/DebianInstallFromSource
+This module manages pyroscope and rtorrent-ps.
index 19bd05491db0a20f6f1eb191f8eebc4917cd7b74..fa307d8d72015c467e2d7936a78fe25e8d5b74fc 100644 (file)
@@ -1,26 +1,34 @@
 class pyroscope::dependencies {
-  # From https://github.com/pyroscope/rtorrent-ps/blob/master/docs/DebianInstallFromSource.md#build-rtorrent-and-core-dependencies-from-source
+  # From http://pyrocore.readthedocs.io/en/latest/installation.html
+  #      https://github.com/pyroscope/rtorrent-ps/blob/master/docs/DebianInstallFromSource.md#build-rtorrent-and-core-dependencies-from-source
   package { [
-              'tmux',
-              'wget',
+              # These should be defined elsewhere
+              #'wget',
+              #'git',
+              #'locales',
+              #'tmux',
               'build-essential',
               'subversion',
-              'git',
+              'python',
+              'python-dev',
+              'python-pip',
+              'python-pkg-resources',
               'python-setuptools',
               'python-virtualenv',
-              'python-dev',
               'libsigc++-2.0-dev',
               'libssl-dev',
               'libncurses-dev',
-              'libncursesw5-dev'
-              'locales',
+              'libncursesw5-dev',
+              'libtool',
+              'libxml2-dev',
+              'libc-ares-dev',
               'libcppunit-dev',
               'autoconf',
               'automake',
-              'libtool',
-              'libxml2-dev',
-              'libxslt1-dev',
+              'pkg-config',
+              # Old dependencies
+              #'libxslt1-dev',
             ]:
-    ensure  => present,
+    ensure => present,
   }
 }
index 106e05bdb9f01bb2544f8d5157adfb0486ccb14d..232a20d96c69b88085675e22fad4855a483bb030 100644 (file)
@@ -1,14 +1,17 @@
 class pyroscope(
   $password = hiera('pyroscope::password', ''),
+  $homedir  = hiera('pyroscope::homedir',  '/var/cache/torrent'),
   $groups   = hiera('pyroscope::groups',   [ 'incoming' ]),
 ) {
   case $password {
     '': { fail("You need to define torrent user password! Please set pyroscope::password in your config") }
   }
 
+  include pyroscope::dependencies
+
   user::manage { "torrent":
     password => $password,
-    homedir  => '/var/cache/torrent',
+    homedir  => $homedir,
     ensure   => present,
     groups   => $groups,
   }
@@ -21,7 +24,7 @@ class pyroscope(
     require => [ File['/var/cache/media'], User['torrent'] ],
   }
 
-  file { '/var/cache/torrent/.profile':
+  file { "${homedir}/.profile":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
@@ -30,7 +33,7 @@ class pyroscope(
     require => User['torrent'],
   }
 
-  file { '/var/cache/torrent/.bashrc':
+  file { "${homedir}/.bashrc":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
@@ -39,7 +42,7 @@ class pyroscope(
     require => User['torrent'],
   }
 
-  file { '/var/cache/torrent/rtorrent':
+  file { "${homedir}/rtorrent":
     ensure  => directory,
     owner   => torrent,
     group   => torrent,
@@ -47,55 +50,55 @@ class pyroscope(
     require => User['torrent'],
   }
 
-  file { '/var/cache/torrent/rtorrent/done':
+  file { "${homedir}/rtorrent/done":
     ensure  => '/var/cache/media/incoming',
     owner   => torrent,
     group   => torrent,
-    require => File['/var/cache/torrent/rtorrent'],
+    require => File["${homedir}/rtorrent"],
   }
 
-  file { '/var/cache/torrent/rtorrent/seeding':
+  file { "${homedir}/rtorrent/seeding":
     ensure  => '/var/cache/media/seeding',
     owner   => torrent,
     group   => torrent,
-    require => File['/var/cache/torrent/rtorrent'],
+    require => File["${homedir}/rtorrent"],
   }
 
-  file { [ '/var/cache/torrent/rtorrent/log', '/var/cache/torrent/rtorrent/.session' ]:
+  file { [ "${homedir}/rtorrent/log", "${homedir}/rtorrent/.session" ]:
     ensure  => directory,
     owner   => torrent,
     group   => torrent,
     mode    => 0755,
-    require => File['/var/cache/torrent/rtorrent'],
+    require => File["${homedir}/rtorrent"],
   }
 
-  file { '/var/cache/torrent/rtorrent/rtorrent.rc':
+  file { "${homedir}/rtorrent/rtorrent.rc":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
     mode    => 0644,
     source  => [ 'puppet:///modules/site_pyroscope/rtorrent.rc',
                  'puppet:///modules/pyroscope/rtorrent.rc', ],
-    require => File['/var/cache/torrent/rtorrent'],
+    require => File["${homedir}/rtorrent"],
   }
 
-  file { '/var/cache/torrent/.rtorrent.rc':
-    ensure  => '/var/cache/torrent/rtorrent/rtorrent.rc',
+  file { "${homedir}/.rtorrent.rc":
+    ensure  => "${homedir}/rtorrent/rtorrent.rc",
     owner   => torrent,
     group   => torrent,
-    require => File['/var/cache/torrent/rtorrent/rtorrent.rc'],
+    require => File["${homedir}/rtorrent/rtorrent.rc"],
   }
 
-  file { '/var/cache/torrent/rtorrent/start':
+  file { "${homedir}/rtorrent/start":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
     mode    => 0755,
     source  => 'puppet:///modules/pyroscope/start.sh',
-    require => File['/var/cache/torrent/rtorrent'],
+    require => File["${homedir}/rtorrent"],
   }
 
-  file { '/var/cache/torrent/.pyroscope':
+  file { "${homedir}/.pyroscope":
     ensure  => directory,
     owner   => torrent,
     group   => torrent,
@@ -103,32 +106,32 @@ class pyroscope(
     require => User['torrent'],
   }
 
-  file { '/var/cache/torrent/.pyroscope/run':
+  file { "${homedir}/.pyroscope/run":
     ensure  => directory,
     owner   => torrent,
     group   => torrent,
     mode    => 0755,
-    require => File['/var/cache/torrent/.pyroscope'],
+    require => File["${homedir}/.pyroscope"],
   }
 
-  file { '/var/cache/torrent/.pyroscope/run/pyrotorque':
+  file { "${homedir}/.pyroscope/run/pyrotorque":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
     mode    => 0644,
-    require => File['/var/cache/torrent/.pyroscope/run'],
+    require => File["${homedir}/.pyroscope/run"],
   }
 
-  file { '/var/cache/torrent/.pyroscope/torque.ini':
+  file { "${homedir}/.pyroscope/torque.ini":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
     mode    => 0644,
     source  => 'puppet:///modules/pyroscope/torque.ini',
-    require => File['/var/cache/torrent/.pyroscope'],
+    require => File["${homedir}/.pyroscope"],
   }
 
-  file { '/var/cache/torrent/bin':
+  file { [ "${homedir}/bin", "${homedir}/lib", "${homedir}/src" ]:
     ensure  => directory,
     owner   => torrent,
     group   => torrent,
@@ -136,21 +139,58 @@ class pyroscope(
     require => User['torrent'],
   }
 
-  file { '/var/cache/torrent/bin/rtcron':
+  file { "${homedir}/bin/rtcron":
     ensure  => present,
     owner   => torrent,
     group   => torrent,
     mode    => 0755,
     source  => 'puppet:///modules/pyroscope/rtcron.sh',
-    require => File['/var/cache/torrent/bin'],
+    require => File["${homedir}/bin"],
   }
 
   cron { "rtcron":
-    command  => '/var/cache/torrent/bin/rtcron > /var/cache/torrent/rtorrent/log/rtcron.log 2>&1',
+    command  => "${homedir}/bin/rtcron > ${homedir}/rtorrent/log/rtcron.log 2>&1",
     user     => torrent,
     hour     => "*",
     minute   => "*",
     ensure   => present,
-    require  => File['/var/cache/torrent/bin/rtcron'],
+    require  => File["${homedir}/bin/rtcron"],
+  }
+
+  vcsrepo { "${homedir}/lib/pyroscope":
+    ensure   => present,
+    provider => git,
+    source   => 'https://github.com/pyroscope/pyrocore.git',
+    revision => '7da621848e24c1a0f897be8065045dd49ef9f8bb',
+    owner    => 'torrent',
+    group    => 'torrent',
+    require  => [ User['torrent'], File["${homedir}/lib"] ],
+  }
+
+  vcsrepo { "${homedir}/src/rtorrent-ps":
+    ensure   => present,
+    provider => git,
+    source   => 'https://github.com/pyroscope/rtorrent-ps.git',
+    revision => 'b51bdba86b8b6331f6281fbbcab2cae7329bcaa9',
+    owner    => 'torrent',
+    group    => 'torrent',
+    require  => [ User['torrent'], File["${homedir}/src"] ],
+  }
+
+  exec { 'pyroscope-update-to-head':
+    command => "${homedir}/lib/pyroscope/update-to-head.sh",
+    user    => torrent,
+    timeout => 0,
+    creates => "${homedir}/bin/pyroadmin",
+    require => [ Class['pyroscope::dependencies'], Vcsrepo["${homedir}/lib/pyroscope"] ],
+  }
+
+  exec { 'pyroscope-rtorrent-ps-build':
+    command => './build.sh all && ./build.sh extend',
+    cwd     => "${homedir}/src/rtorrent-ps",
+    user    => torrent,
+    timeout => 0,
+    creates => "${homedir}/bin/rtorrent",
+    require => [ Class['pyroscope::dependencies'], Vcsrepo["${homedir}/src/rtorrent-ps"] ],
   }
 }