Skip to content

Commit

Permalink
Built version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowHackerHorse committed Sep 24, 2017
1 parent 4062b08 commit abd7a5a
Show file tree
Hide file tree
Showing 16 changed files with 537 additions and 0 deletions.
Binary file added pkg/hackerhorse-puppet_deluge-0.1.1.tar.gz
Binary file not shown.
18 changes: 18 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
gem 'metadata-json-lint'
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 1.0.0'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'

# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'rspec', '~> 2.0'
gem 'rake', '~> 10.0'
else
# rubocop requires ruby >= 1.9
gem 'rubocop'
end
25 changes: 25 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2017, Rainbow
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 changes: 39 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# puppet_deluge

#### Table of Contents

1. [What Does This Do?](#What-does-this-do)
2. [Requirements](#Requirements)
3. [I Can't Connect?](#I-cant-connect)
4. [Limitations - OS compatibility, etc.](#limitations)
5. [Development - Guide for contributing to the module](#contribute)

## What does this do?
This is a puppet module, written to allow you to install the Deluge torrent client
on your FreeBSD or Linux server. It makes use of ZFS (on FreeBSD), and manages your deluge user, as well as
folder locations and configs.
Please note, this supersedes the existing module hackerhorse/puppet_freebsd_deluge.
By default, remote access is turned off, but can easily be enabled (see below).

## Requirements
For FreeBSD support, this module requires you to also have installed Snonux's ZFS module, available at
https://github.com/snonux/puppet-modules
For Ubuntu, please ensure you install puppetlabs/apt

## I can't connect!
Did you edit `./files/auth` and `./files/core.conf`?
By default, Deluge does NOT allow remote connections from the desktop client.
You need to edit `core.conf` and change `"allow_remote": false,` on line 24 to
`"allow_remote": true,` to allow the daemon to talk to a remote client.
You also need to edit `./files/auth` and add your user to a new line.
See http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient#AddUsertotheauthenticationfile
for more information!

## OS Support
Currently, this module runs on:
* FreeBSD <= 10.0-RELEASE
* Ubuntu Linux 13.10 - 17.04

## Contribute
You can contribute by forking https://github.com/RainbowHackerHorse/puppet_deluge
and opening a PR.
32 changes: 32 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'

if RUBY_VERSION >= '1.9'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end

PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.relative = true
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']

desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end

desc 'Run metadata_lint, lint, validate, and spec tests.'
task :test do
[:metadata_lint, :lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end
16 changes: 16 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/checksums.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"Gemfile": "36c376f27539ded2a321b2bd432e843b",
"LICENSE": "39d0115029585fd2a07f1805f7dec8b4",
"README.md": "2423bea1c4e9da8a6853ee83a15dfd2f",
"Rakefile": "f4692851f7e9afcdb02721319e3f18b9",
"files/auth": "40852add33c21cb82f48450d1489c54f",
"files/core.conf": "f3caadd1013f98d1c87a11543cd79242",
"files/freebsd_init.sh": "ed5fc0fb227e9fa49e97a0127c2cb907",
"manifests/freebsd.pp": "9053d1607f43effc7473b1ac9eb1c53d",
"manifests/init.pp": "15ab0a5f152c957fef47d4b4783455fb",
"manifests/ubuntu.pp": "b95d910970c7f7ca187cc380d4a1bd4f",
"manifests/ubuntulegacy.pp": "2fafbcea8d0015d9c06c338a10d6f11f",
"metadata.json": "4ffa766419783b36f172c8ab04b58c17",
"spec/classes/init_spec.rb": "e75fb3ea1fbd13dd02b90f01ba1b9961",
"spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc"
}
1 change: 1 addition & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/files/auth
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localclient:PASSWORDGOESHERE:10
101 changes: 101 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/files/core.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"file": 1,
"format": 1
}{
"info_sent": 0.0,
"lsd": true,
"max_download_speed": -1.0,
"send_info": false,
"natpmp": true,
"move_completed_path": "/torrents/completed",
"peer_tos": "0x00",
"enc_in_policy": 1,
"queue_new_to_top": false,
"ignore_limits_on_local_network": true,
"rate_limit_ip_overhead": true,
"daemon_port": 58846,
"torrentfiles_location": "/torrents/files",
"max_active_limit": 1000,
"geoip_db_location": "/usr/local/share/GeoIP/GeoIP.dat",
"upnp": true,
"utpex": true,
"max_active_downloading": 200,
"max_active_seeding": 500,
"allow_remote": false,
"outgoing_ports": [
0,
0
],
"enabled_plugins": [],
"max_half_open_connections": 50,
"download_location": "/torrents/downloading",
"compact_allocation": false,
"max_upload_speed": -1.0,
"plugins_location": "/home/deluge/.config/deluge/plugins",
"max_connections_global": 1000,
"enc_prefer_rc4": true,
"cache_expiry": 60,
"dht": true,
"stop_seed_at_ratio": false,
"stop_seed_ratio": 2.0,
"max_download_speed_per_torrent": -1,
"prioritize_first_last_pieces": false,
"max_upload_speed_per_torrent": -1,
"auto_managed": true,
"enc_level": 2,
"copy_torrent_file": true,
"max_connections_per_second": 20,
"listen_ports": [
6881,
6891
],
"max_connections_per_torrent": -1,
"del_copy_torrent_file": false,
"move_completed": false,
"autoadd_enable": false,
"proxies": {
"peer": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"web_seed": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"tracker": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"dht": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
}
},
"dont_count_slow_torrents": false,
"add_paused": false,
"random_outgoing_ports": true,
"max_upload_slots_per_torrent": -1,
"new_release_check": false,
"enc_out_policy": 1,
"seed_time_ratio_limit": 7.0,
"remove_seed_at_ratio": false,
"autoadd_location": "/root",
"max_upload_slots_global": 4,
"seed_time_limit": 0,
"cache_size": 512,
"share_ratio_limit": 0,
"random_port": true,
"listen_interface": ""
}
81 changes: 81 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/files/freebsd_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/sh

# $FreeBSD: head/net-p2p/deluge-cli/files/deluged.in 340872 2014-01-24 00:14:07Z mat $
#
# PROVIDE: deluged
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# MANDATORY:
#
# deluged_enable (bool): Set to NO by default.
# Set it to YES to enable deluged.
#
# deluged_user (str): The UNPRIVILEGED user to run as
#
# OPTIONAL:
#
# deluged_flags (str): Set as needed
# See deluged(1) for more information
#
# deluged_confdir (path): Set to /home/$deluged_user/.config/deluge
# by default
#
# deluged_loglevel (str): Set to "error" by default
#
# deluged_logfile (path): Set to /var/tmp/deluged.log by default

. /etc/rc.subr

name="deluged"
rcvar=deluged_enable

command=/usr/local/bin/${name}
command_interpreter=/usr/local/bin/python2.7

pidfile=/var/run/${name}/pid

start_precmd=${name}_prestart
stop_postcmd=${name}_poststop

deluged_prestart()
{
if [ "$deluged_user" = 'asjklasdfjklasdf' ]; then
err 1 "You must set deluged_user to a real, unprivileged user"
fi

if [ ! -d "/var/run/${name}" ]; then
if [ -e "/var/run/${name}" ]; then
unlink /var/run/${name}
fi
mkdir -p /var/run/${name}
fi

chmod 0755 /var/run/${name}
chown -R $deluged_user /var/run/${name}
}

deluged_poststop()
{
[ -e "$pidfile" ] && unlink $pidfile
[ -d "${pidfile%/pid}" ] && rmdir ${pidfile%/pid}

[ -e "$deluged_logfile" -a ! -s "$deluged_logfile" ] &&
unlink $deluged_logfile
}

load_rc_config $name

: ${deluged_enable:="NO"}
: ${deluged_user:="deluge"}
: ${deluged_confdir:="/home/${deluged_user}/.config/deluge"}
: ${deluged_loglevel:="error"}
: ${deluged_logfile:="/var/tmp/${name}.log"}

required_dirs="$deluged_confdir"
command_args="-c $required_dirs -L $deluged_loglevel -l $deluged_logfile -P $pidfile"

run_rc_command "$1"
64 changes: 64 additions & 0 deletions pkg/hackerhorse-puppet_deluge-0.1.1/manifests/freebsd.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Class: puppet_deluge::freebsd
# Lightweight deluge module to install a headless deluge server
# This module contains FreeBSD specific functions
# Module written by Rainbow <rainbow@hacker.horse>
# Released under the 2-clause BSD license.
# Depends on snonux/zfs
#
class puppet_deluge::freebsd {
package { 'deluge-cli':
ensure => latest,
require => User['deluge'],
}
package { 'deluge-web':
ensure => absent,
require => User['deluge'],
}
package { 'py27-service_identity':
ensure => latest,
}
file { '/usr/local/etc/rc.d/deluged':
owner => 'root',
group => 'wheel',
mode => '0755',
source => 'puppet:///modules/freebsd_deluge_light/deluged_init.sh',
require => User['deluge'],
}
exec { 'delfirstrun':
command => '/usr/local/bin/deluged',
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
user => 'deluge',
require => User['deluge'],
before => File['/home/deluge/.config/deluge/auth'],
unless => 'test -f /home/deluge/.config/',
}
service { 'deluge':
ensure => running,
enable => true,
require => File['/usr/local/etc/rc.d/deluged'],
}
zfs::create { 'zroot/torrents':
ensure => present,
filesystem => '/torrents',
}
zfs::create { 'zroot/torrents/downloading':
ensure => present,
filesystem => '/torrents/downloading',
require => Zfs::Create['zroot/torrents'],
}
zfs::create { 'zroot/torrents/files':
ensure => present,
filesystem => '/torrents/files',
require => Zfs::Create['zroot/torrents'],
}
zfs::create { 'zroot/torrents/completed':
ensure => present,
filesystem => '/torrents/completed',
require => Zfs::Create['zroot/torrents'],
}
exec { 'zfsperms':
command => 'chown -R deluge:deluge /torrents',
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
require => [Zfs::Create['zroot/torrents'], Zfs::Create['zroot/torrents/downloading'], Zfs::Create['zroot/torrents/files'], Zfs::Create['zroot/torrents/completed']],
}
}
Loading

0 comments on commit abd7a5a

Please sign in to comment.