aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-08 21:57:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-08 21:57:46 -0300
commit943ac80af5d2f8fded78bcb3fdac2c92b86435ce (patch)
tree227d944318072040be138f1a49befd6aa8b99b3d /manifests
parentd6964082b9719978ebe96744c7c659e701bb264d (diff)
downloadpuppet-pyroscope-943ac80af5d2f8fded78bcb3fdac2c92b86435ce.tar.gz
puppet-pyroscope-943ac80af5d2f8fded78bcb3fdac2c92b86435ce.tar.bz2
Builds pyroscope and rtorrent-ps
Diffstat (limited to 'manifests')
-rw-r--r--manifests/dependencies.pp30
-rw-r--r--manifests/init.pp98
2 files changed, 88 insertions, 40 deletions
diff --git a/manifests/dependencies.pp b/manifests/dependencies.pp
index 19bd054..fa307d8 100644
--- a/manifests/dependencies.pp
+++ b/manifests/dependencies.pp
@@ -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,
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 106e05b..232a20d 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -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"] ],
}
}