aethernal-agent 0.1.10 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +674 -0
- data/Gemfile.lock +38 -33
- data/README.md +3 -32
- data/Vagrantfile +10 -2
- data/aethernal-agent.gemspec +4 -1
- data/bin/install-aa +121 -0
- data/bin/run-aa-for-test +1 -1
- data/exe/aa-cli +7 -0
- data/lib/aethernal_agent.rb +10 -0
- data/lib/aethernal_agent/apache/apache.rb +8 -5
- data/lib/aethernal_agent/apache/templates/aa-default.conf +2 -0
- data/lib/aethernal_agent/apache/templates/aa-user.conf.erb +2 -0
- data/lib/aethernal_agent/app.rb +82 -22
- data/lib/aethernal_agent/apt.rb +17 -6
- data/lib/aethernal_agent/cli/core.rb +11 -0
- data/lib/aethernal_agent/cli/services.rb +56 -0
- data/lib/aethernal_agent/docker/container_settings.rb +33 -0
- data/lib/aethernal_agent/docker/env.rb +33 -0
- data/lib/aethernal_agent/docker/port_binding.rb +32 -0
- data/lib/aethernal_agent/docker/volume.rb +28 -0
- data/lib/aethernal_agent/filesystem.rb +2 -1
- data/lib/aethernal_agent/loader.rb +3 -3
- data/lib/aethernal_agent/operation.rb +1 -1
- data/lib/aethernal_agent/plugins/bazarr/bazarr.rb +57 -0
- data/lib/aethernal_agent/plugins/bazarr/files/bazarr.service +16 -0
- data/lib/aethernal_agent/plugins/bazarr/manifest.yml +64 -0
- data/lib/aethernal_agent/plugins/bazarr/meta/bazarr.png +0 -0
- data/lib/aethernal_agent/plugins/bazarr/templates/bazarr.apache.conf.erb +5 -0
- data/lib/aethernal_agent/plugins/bazarr/templates/config.ini.erb +135 -0
- data/lib/aethernal_agent/plugins/cardigann/cardigann.rb +45 -0
- data/lib/aethernal_agent/plugins/cardigann/files/cardigann.service +13 -0
- data/lib/aethernal_agent/plugins/cardigann/manifest.yml +36 -0
- data/lib/aethernal_agent/plugins/cardigann/meta/cardigann.png +0 -0
- data/lib/aethernal_agent/plugins/cardigann/templates/cardigann.apache.conf.erb +6 -0
- data/lib/aethernal_agent/plugins/cardigann/templates/config.json.erb +7 -0
- data/lib/aethernal_agent/plugins/couchpotato/couchpotato.rb +45 -0
- data/lib/aethernal_agent/plugins/couchpotato/files/couchpotato.service +13 -0
- data/lib/aethernal_agent/plugins/couchpotato/manifest.yml +37 -0
- data/lib/aethernal_agent/plugins/couchpotato/meta/couchpotato.png +0 -0
- data/lib/aethernal_agent/plugins/couchpotato/templates/couchpotato.apache.conf.erb +4 -0
- data/lib/aethernal_agent/plugins/couchpotato/templates/settings.conf.erb +585 -0
- data/lib/aethernal_agent/plugins/deluge/manifest.yml +2 -2
- data/lib/aethernal_agent/plugins/deluge/templates/deluge-web.service.erb +1 -1
- data/lib/aethernal_agent/plugins/deluge/templates/deluge.apache.conf.erb +0 -1
- data/lib/aethernal_agent/plugins/deluge/templates/deluged.service.erb +1 -1
- data/lib/aethernal_agent/plugins/filebrowser/manifest.yml +1 -1
- data/lib/aethernal_agent/plugins/gitea/manifest.yml +1 -1
- data/lib/aethernal_agent/plugins/jackett/files/jackett.service +15 -0
- data/lib/aethernal_agent/plugins/jackett/jackett.rb +49 -0
- data/lib/aethernal_agent/plugins/jackett/manifest.yml +54 -0
- data/lib/aethernal_agent/plugins/jackett/meta/jackett.png +0 -0
- data/lib/aethernal_agent/plugins/jackett/templates/ServerConfig.json.erb +8 -0
- data/lib/aethernal_agent/plugins/jackett/templates/jackett.apache.conf.erb +5 -0
- data/lib/aethernal_agent/plugins/jdownloader/files/jdownloader.service +13 -0
- data/lib/aethernal_agent/plugins/jdownloader/jdownloader.rb +38 -0
- data/lib/aethernal_agent/plugins/jdownloader/manifest.yml +53 -0
- data/lib/aethernal_agent/plugins/jdownloader/meta/jdownloader.png +0 -0
- data/lib/aethernal_agent/plugins/jdownloader/templates/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json.erb +5 -0
- data/lib/aethernal_agent/plugins/medusa/files/medusa.service +13 -0
- data/lib/aethernal_agent/plugins/medusa/manifest.yml +54 -0
- data/lib/aethernal_agent/plugins/medusa/medusa.rb +47 -0
- data/lib/aethernal_agent/plugins/medusa/meta/medusa.png +0 -0
- data/lib/aethernal_agent/plugins/medusa/templates/config.ini.erb +1308 -0
- data/lib/aethernal_agent/plugins/medusa/templates/medusa.apache.conf.erb +12 -0
- data/lib/aethernal_agent/plugins/nextcloud/manifest.yml +54 -0
- data/lib/aethernal_agent/plugins/nextcloud/meta/nextcloud.png +0 -0
- data/lib/aethernal_agent/plugins/nextcloud/nextcloud.rb +44 -0
- data/lib/aethernal_agent/plugins/nextcloud/templates/nextcloud.apache.conf.erb +4 -0
- data/lib/aethernal_agent/plugins/nzbget/files/nzbget.service +13 -0
- data/lib/aethernal_agent/plugins/nzbget/manifest.yml +54 -0
- data/lib/aethernal_agent/plugins/nzbget/meta/nzbget.png +0 -0
- data/lib/aethernal_agent/plugins/nzbget/nzbget.rb +44 -0
- data/lib/aethernal_agent/plugins/nzbget/templates/nzbget.apache.conf.erb +5 -0
- data/lib/aethernal_agent/plugins/nzbget/templates/nzbget.conf.erb +1508 -0
- data/lib/aethernal_agent/plugins/olaris/manifest.yml +1 -1
- data/lib/aethernal_agent/plugins/ombi/manifest.yml +5 -2
- data/lib/aethernal_agent/plugins/ombi/ombi.rb +59 -22
- data/lib/aethernal_agent/plugins/ombi/templates/ombi.apache.conf.erb +3 -4
- data/lib/aethernal_agent/plugins/ombi/templates/ombi.service.erb +2 -2
- data/lib/aethernal_agent/plugins/plex-docker/manifest.yml +74 -0
- data/lib/aethernal_agent/plugins/plex-docker/meta/plex.png +0 -0
- data/lib/aethernal_agent/plugins/plex-docker/plex_docker.rb +39 -0
- data/lib/aethernal_agent/plugins/plex-docker/templates/Preferences.xml.erb +2 -0
- data/lib/aethernal_agent/plugins/plex-docker/templates/plex_docker.apache.conf.erb +21 -0
- data/lib/aethernal_agent/plugins/plex-docker/templates/plex_docker.service.erb +10 -0
- data/lib/aethernal_agent/plugins/plex/files/plex.service +1 -1
- data/lib/aethernal_agent/plugins/plex/manifest.yml +6 -5
- data/lib/aethernal_agent/plugins/plex/plex.rb +2 -4
- data/lib/aethernal_agent/plugins/plex/templates/Preferences.xml.erb +1 -1
- data/lib/aethernal_agent/plugins/plex/templates/plex.apache.conf.erb +21 -0
- data/lib/aethernal_agent/plugins/portainer/manifest.yml +50 -0
- data/lib/aethernal_agent/plugins/portainer/meta/portainer.png +0 -0
- data/lib/aethernal_agent/plugins/portainer/portainer.rb +38 -0
- data/lib/aethernal_agent/plugins/portainer/templates/portainer.apache.conf.erb +7 -0
- data/lib/aethernal_agent/plugins/portainer/templates/portainer.service.erb +10 -0
- data/lib/aethernal_agent/plugins/radarr/files/radarr.service +2 -2
- data/lib/aethernal_agent/plugins/radarr/manifest.yml +7 -13
- data/lib/aethernal_agent/plugins/radarr/radarr.rb +24 -18
- data/lib/aethernal_agent/plugins/radarr/templates/radarr.apache.conf.erb +3 -4
- data/lib/aethernal_agent/plugins/resilio_docker/manifest.yml +59 -0
- data/lib/aethernal_agent/plugins/resilio_docker/meta/resilio.png +0 -0
- data/lib/aethernal_agent/plugins/resilio_docker/resilio_docker.rb +29 -0
- data/lib/aethernal_agent/plugins/resilio_docker/templates/resilio_docker.apache.conf.erb +11 -0
- data/lib/aethernal_agent/plugins/resilio_docker/templates/resilio_docker.conf.erb +38 -0
- data/lib/aethernal_agent/plugins/resilio_docker/templates/resilio_docker.service.erb +10 -0
- data/lib/aethernal_agent/plugins/rutorrent/manifest.yml +84 -0
- data/lib/aethernal_agent/plugins/rutorrent/meta/rtorrent.png +0 -0
- data/lib/aethernal_agent/plugins/rutorrent/rutorrent.rb +41 -0
- data/lib/aethernal_agent/plugins/rutorrent/templates/rtorrent.rc.erb +69 -0
- data/lib/aethernal_agent/plugins/rutorrent/templates/rutorrent.apache.conf.erb +13 -0
- data/lib/aethernal_agent/plugins/rutorrent/templates/rutorrent.service.erb +10 -0
- data/lib/aethernal_agent/plugins/sabnzbd/files/sabnzbd.service +13 -0
- data/lib/aethernal_agent/plugins/sabnzbd/manifest.yml +43 -0
- data/lib/aethernal_agent/plugins/sabnzbd/meta/sabnzbd.png +0 -0
- data/lib/aethernal_agent/plugins/sabnzbd/sabnzbd.rb +47 -0
- data/lib/aethernal_agent/plugins/sabnzbd/templates/sabnzbd.apache.conf.erb +4 -0
- data/lib/aethernal_agent/plugins/sabnzbd/templates/sabnzbd.ini.erb +188 -0
- data/lib/aethernal_agent/plugins/sickchill/files/sickchill.service +13 -0
- data/lib/aethernal_agent/plugins/sickchill/manifest.yml +58 -0
- data/lib/aethernal_agent/plugins/sickchill/meta/sickchill.png +0 -0
- data/lib/aethernal_agent/plugins/sickchill/sickchill.rb +49 -0
- data/lib/aethernal_agent/plugins/sickchill/templates/config.ini.erb +1078 -0
- data/lib/aethernal_agent/plugins/sickchill/templates/sickchill.apache.conf.erb +4 -0
- data/lib/aethernal_agent/plugins/sonarr/files/sonarr.service +1 -1
- data/lib/aethernal_agent/plugins/sonarr/manifest.yml +3 -2
- data/lib/aethernal_agent/plugins/sonarr/templates/sonarr.apache.conf.erb +3 -4
- data/lib/aethernal_agent/plugins/syncthing/files/syncthing.service +18 -0
- data/lib/aethernal_agent/plugins/syncthing/manifest.yml +38 -0
- data/lib/aethernal_agent/plugins/syncthing/meta/syncthing.png +0 -0
- data/lib/aethernal_agent/plugins/syncthing/syncthing.rb +33 -0
- data/lib/aethernal_agent/plugins/syncthing/templates/config.xml.erb +56 -0
- data/lib/aethernal_agent/plugins/syncthing/templates/syncthing.apache.conf.erb +7 -0
- data/lib/aethernal_agent/plugins/tautulli/files/tautulli.service +13 -0
- data/lib/aethernal_agent/plugins/tautulli/manifest.yml +40 -0
- data/lib/aethernal_agent/plugins/tautulli/meta/tautulli.png +0 -0
- data/lib/aethernal_agent/plugins/tautulli/tautulli.rb +45 -0
- data/lib/aethernal_agent/plugins/tautulli/templates/config.ini.erb +222 -0
- data/lib/aethernal_agent/plugins/tautulli/templates/tautulli.apache.conf.erb +5 -0
- data/lib/aethernal_agent/plugins/vnc/manifest.yml +3 -2
- data/lib/aethernal_agent/systemd.rb +19 -13
- data/lib/aethernal_agent/utils.rb +85 -6
- data/lib/aethernal_agent/version.rb +1 -1
- data/lib/aethernal_agent/webserver/api.rb +1 -1
- data/lib/aethernal_agent/webserver/core.rb +1 -1
- metadata +152 -6
data/lib/aethernal_agent/apt.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
+
require 'aethernal_agent/utils'
|
2
|
+
|
1
3
|
module AethernalAgent
|
2
4
|
module Apt
|
5
|
+
def self.included klass
|
6
|
+
klass.class_eval do
|
7
|
+
include Utils
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
3
11
|
def apt_update
|
4
|
-
|
12
|
+
print_system("apt update")
|
5
13
|
end
|
6
14
|
|
7
15
|
def add_apt_ppa(name)
|
8
|
-
|
16
|
+
print_system("add-apt-repository #{name} -y")
|
9
17
|
end
|
10
18
|
|
11
19
|
def apt_package(options = {})
|
@@ -15,15 +23,18 @@ module AethernalAgent
|
|
15
23
|
packages = options[:packages]
|
16
24
|
packages = packages.join(" ") if packages.is_a?(Array)
|
17
25
|
|
26
|
+
unless wait_on_apt(180)
|
27
|
+
self.add_errors("APT could not be started because lock was in use for more than 180 seconds")
|
28
|
+
end
|
29
|
+
|
18
30
|
case action
|
19
31
|
when :install
|
20
32
|
# Do this with popen so we can catch error output as well as normal output for add_errors
|
21
|
-
|
33
|
+
print_system("DEBIAN_FRONTEND=noninteractive apt -o DPkg::Options::=--force-confdef install -qy #{packages}")
|
22
34
|
when :remove
|
23
|
-
|
24
|
-
system("DEBIAN_FRONTEND=noninteractive apt autoremove -qy")
|
35
|
+
print_system("DEBIAN_FRONTEND=noninteractive apt remove -qy #{packages}")
|
25
36
|
when :autoremove
|
26
|
-
|
37
|
+
print_system("DEBIAN_FRONTEND=noninteractive apt autoremove -qy")
|
27
38
|
end
|
28
39
|
end
|
29
40
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module AethernalAgent
|
4
|
+
module Cli
|
5
|
+
class Services < Thor
|
6
|
+
attr_accessor :user
|
7
|
+
include AethernalAgent::Utils
|
8
|
+
|
9
|
+
desc "start APP", "start the supplied application via systemd"
|
10
|
+
def start(app)
|
11
|
+
run_systemd_plain("start", app)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "stop APP", "stop the supplied application via systemd"
|
15
|
+
def stop(app)
|
16
|
+
run_systemd_plain("stop", app)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "restart APP", "restart the supplied application via systemd"
|
20
|
+
def restart(app)
|
21
|
+
run_systemd_plain("restart", app)
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "status APP", "get the status of the supplied application via systemd"
|
25
|
+
def status(app)
|
26
|
+
result = run_systemd_plain("status", app)
|
27
|
+
puts result
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "start-all", "Start all systemd managed applications"
|
31
|
+
def start_all
|
32
|
+
puts "Starting all known services"
|
33
|
+
service_files = `ls ~/.config/systemd/user/*.service`.split("\n")
|
34
|
+
result = service_files.collect do |s|
|
35
|
+
pn = Pathname.new(s)
|
36
|
+
app_name = pn.basename
|
37
|
+
puts "Starting #{app_name}"
|
38
|
+
run_systemd_plain("start", app_name)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "list", "Lists all available user services and their status."
|
43
|
+
def list
|
44
|
+
service_files = `ls ~/.config/systemd/user/*.service`.split("\n")
|
45
|
+
result = service_files.collect do |s|
|
46
|
+
pn = Pathname.new(s)
|
47
|
+
app_name = pn.basename
|
48
|
+
status = systemd_text_for_service(app_name).split("\n")[2].strip
|
49
|
+
[app_name, status]
|
50
|
+
end
|
51
|
+
table = Terminal::Table.new :headings => ['Service', 'Status'], :rows => result
|
52
|
+
puts table
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module AethernalAgent
|
2
|
+
module Docker
|
3
|
+
class ContainerSettings
|
4
|
+
attr_accessor :env, :port_bindings, :volumes
|
5
|
+
def self.build_from_options(manifest_options, opts)
|
6
|
+
container = ContainerSettings.new
|
7
|
+
container.env = Env.create_from_options(manifest_options, opts).collect(&:to_docker)
|
8
|
+
container.port_bindings = PortBinding.create_from_options(manifest_options, opts)
|
9
|
+
container.volumes = Volume.create_from_options(manifest_options, opts).collect(&:to_docker)
|
10
|
+
return container
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_container(name, image)
|
14
|
+
AethernalAgent.logger.debug("Creating Docker container #{name} from image #{image} based on ContainerSettings")
|
15
|
+
AethernalAgent.logger.debug("Env: #{self.env}, Ports; #{self.port_bindings}, Volumes: #{self.volumes}")
|
16
|
+
|
17
|
+
::Docker::Container.create(
|
18
|
+
'name' => name,
|
19
|
+
'Env' => self.env,
|
20
|
+
'HostConfig' =>
|
21
|
+
{
|
22
|
+
'RestartPolicy' => {'Name' => 'unless-stopped'},
|
23
|
+
'PortBindings' => self.port_bindings,
|
24
|
+
'Binds' => self.volumes,
|
25
|
+
'Volumes' => {"/data" => {},"/config" => {}},
|
26
|
+
},
|
27
|
+
'Image' => image,
|
28
|
+
'Healthcheck' => {'Interval' => 120_000_000_000, 'StartPeriod' => 30_000_000_000}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module AethernalAgent
|
2
|
+
module Docker
|
3
|
+
class Env
|
4
|
+
attr_accessor :key, :value
|
5
|
+
def initialize(key, value)
|
6
|
+
self.key= key
|
7
|
+
self.value= value
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.create_from_options(manifest_options, opts)
|
11
|
+
envs = []
|
12
|
+
manifest_options.each do |k,v|
|
13
|
+
if v.present?
|
14
|
+
if v["docker"].present? && v["docker"]["env"].present?
|
15
|
+
if v["docker"].has_key?("auto_source") && ["user_id"].include?(v["docker"]["auto_source"])
|
16
|
+
# For now only allow user_id to be auto-sourced but we can add more things later
|
17
|
+
user_id = Etc.getpwnam(opts["user"]).uid
|
18
|
+
envs << Env.new(v["docker"]["env"], user_id)
|
19
|
+
else
|
20
|
+
envs << Env.new(v["docker"]["env"], opts[k])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return envs
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_docker
|
29
|
+
"#{self.key}=#{self.value}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module AethernalAgent
|
2
|
+
module Docker
|
3
|
+
class PortBinding
|
4
|
+
|
5
|
+
attr_accessor :source, :target
|
6
|
+
def initialize(source, target)
|
7
|
+
self.source = source
|
8
|
+
self.target = target
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create_from_options(manifest_options, opts)
|
12
|
+
bindings = {}
|
13
|
+
manifest_options.each do |k,v|
|
14
|
+
if v.present?
|
15
|
+
if v["docker"].present? && v["docker"]["source"].present?
|
16
|
+
if v["docker"]["source"].to_s.include?("$port")
|
17
|
+
v["docker"]["source"].gsub!("$port", opts[k].to_s)
|
18
|
+
end
|
19
|
+
bindings.merge!(PortBinding.new(v["docker"]["source"], opts[k]).to_docker)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
return bindings
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_docker
|
28
|
+
{ self.source => [{ "HostPort" => self.target.to_s}] }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module AethernalAgent
|
2
|
+
module Docker
|
3
|
+
class Volume
|
4
|
+
attr_accessor :source, :target
|
5
|
+
def initialize(source, target)
|
6
|
+
self.source = source
|
7
|
+
self.target = target
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.create_from_options(manifest_options, opts)
|
11
|
+
volumes = []
|
12
|
+
manifest_options.each do |k,v|
|
13
|
+
if v.present?
|
14
|
+
if v["docker"].present? && v["docker"]["volume"].present?
|
15
|
+
volumes << Volume.new(opts[k], v["docker"]["volume"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
return volumes
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_docker
|
24
|
+
"#{self.source}:#{self.target}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -71,7 +71,8 @@ module AethernalAgent
|
|
71
71
|
add_errors(e, path: file_path)
|
72
72
|
end
|
73
73
|
else
|
74
|
-
add_errors("File does not exist.", path: file_path)
|
74
|
+
#add_errors("File does not exist.", path: file_path)
|
75
|
+
AethernalAgent.logger.warn "File '#{file_path}' did not exist so not removing"
|
75
76
|
end
|
76
77
|
else
|
77
78
|
set_ownership(file_path, options[:owner]) if options[:owner]
|
@@ -10,17 +10,17 @@ module AethernalAgent
|
|
10
10
|
attr_accessor :loaded_manifests
|
11
11
|
|
12
12
|
def initialize
|
13
|
+
STDOUT.sync = true
|
13
14
|
self.loaded_manifests = []
|
14
15
|
self.dynamic_load
|
15
16
|
end
|
16
17
|
|
17
18
|
def ensure_server_state
|
18
|
-
apt_package(packages: ["unzip", "apache2"])
|
19
|
+
apt_package(packages: ["unzip", "apache2", "build-essential", "libsqlite3-dev", "sqlite3", "libapache2-mpm-itk"])
|
19
20
|
|
20
|
-
AethernalAgent::Apache.
|
21
|
+
AethernalAgent::Apache.ensure_default_config
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
24
|
def dynamic_load
|
25
25
|
AethernalAgent.logger.info "Checking embedded plugins"
|
26
26
|
embedded_plugins = File.expand_path(File.join(File.dirname(__FILE__), 'plugins/*/*.yml'))
|
@@ -12,7 +12,7 @@ class AethernalAgent::Operation
|
|
12
12
|
self.started_at = Time.now
|
13
13
|
|
14
14
|
begin
|
15
|
-
plugin = "AethernalAgent::#{self.plugin_name.
|
15
|
+
plugin = "AethernalAgent::#{self.plugin_name.camelcase}".constantize.new(self.options)
|
16
16
|
self.result = plugin.send(self.method, self.options)
|
17
17
|
if self.result.is_a?(Hash) && self.result.has_key?(:errors)
|
18
18
|
self.errors = self.result[:errors]
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class AethernalAgent::Bazarr < AethernalAgent::App
|
2
|
+
def initialize(options = {})
|
3
|
+
super(options)
|
4
|
+
end
|
5
|
+
|
6
|
+
def install_packages(options = {})
|
7
|
+
remove_app_user
|
8
|
+
super(options)
|
9
|
+
unzip("bazarr*.zip")
|
10
|
+
run_as('root',"mv #{app_path}/bazarr-master/* #{app_path}/")
|
11
|
+
directory(app_path('bazarr-master'), action: :delete)
|
12
|
+
file(app_path('bazarr-master.zip'), action: :delete)
|
13
|
+
directory(app_path, owner: @user)
|
14
|
+
directory(bazarr_config_path, owner: @user)
|
15
|
+
directory(bazarr_config_path('data'), owner: @user)
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove_app_user(options = {})
|
19
|
+
super(options) do |opts|
|
20
|
+
directory(app_path, action: :delete)
|
21
|
+
directory(bazarr_config_path, action: :delete)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def configure_app_user(options = {})
|
26
|
+
self.install_packages(options)
|
27
|
+
|
28
|
+
super(options) do |opts|
|
29
|
+
@vars = {
|
30
|
+
password: opts['password'],
|
31
|
+
hash: user_hash(opts),
|
32
|
+
port: opts['port'],
|
33
|
+
user: self.user}
|
34
|
+
end
|
35
|
+
|
36
|
+
run_command("cd #{app_path} && sudo pip3 install -r requirements.txt")
|
37
|
+
stop
|
38
|
+
write_template(template_path('config.ini.erb'),
|
39
|
+
bazarr_config_path('/data/config/config.ini'),
|
40
|
+
@vars,
|
41
|
+
{owner: self.user})
|
42
|
+
|
43
|
+
start
|
44
|
+
return create_return_args(@vars)
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
def user_hash(opts)
|
50
|
+
return Digest::MD5.hexdigest(opts[:password])
|
51
|
+
end
|
52
|
+
|
53
|
+
def bazarr_config_path(path ="/")
|
54
|
+
File.join(home_folder_path(".config/bazarr"), path)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Bazarr Daemon
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
UMask=0002
|
7
|
+
Restart=on-failure
|
8
|
+
RestartSec=5
|
9
|
+
Type=simple
|
10
|
+
ExecStart=/usr/bin/python3.7 %h/apps/bazarr/bazarr.py -c %h/.config/bazarr/data
|
11
|
+
KillSignal=SIGINT
|
12
|
+
TimeoutStopSec=20
|
13
|
+
SyslogIdentifier=bazarr
|
14
|
+
|
15
|
+
[Install]
|
16
|
+
WantedBy=default.target
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Bazarr
|
2
|
+
script_name: bazarr.rb
|
3
|
+
version: 0.1
|
4
|
+
required_aethernal_agent_version: ">= 0.2.0"
|
5
|
+
description: Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you
|
6
|
+
installation_type: local_install
|
7
|
+
configuration_type: multi_user
|
8
|
+
apache_configuration: bazarr.apache.conf.erb
|
9
|
+
icon:
|
10
|
+
name: bazarr.png
|
11
|
+
sha256sum: 3e8020a19cd0e752df61081b7289e43f57cc0df4e564efa479fc219b1efeaabf
|
12
|
+
plain_name: bazarr
|
13
|
+
services:
|
14
|
+
- bazarr
|
15
|
+
actions:
|
16
|
+
restart:
|
17
|
+
user:
|
18
|
+
required: true
|
19
|
+
linux_user: true
|
20
|
+
uninstall:
|
21
|
+
nothing: true
|
22
|
+
install_packages:
|
23
|
+
user:
|
24
|
+
required: true
|
25
|
+
linux_user: true
|
26
|
+
remove_app_user:
|
27
|
+
user:
|
28
|
+
required: true
|
29
|
+
linux_user: true
|
30
|
+
configure_app_user:
|
31
|
+
port:
|
32
|
+
auto_generate_port: true
|
33
|
+
min: 6900
|
34
|
+
max: 6999
|
35
|
+
ssl_port:
|
36
|
+
auto_generate_port: true
|
37
|
+
min: 7900
|
38
|
+
max: 7999
|
39
|
+
user:
|
40
|
+
required: true
|
41
|
+
linux_user: true
|
42
|
+
password:
|
43
|
+
required: false
|
44
|
+
auto_generate: true
|
45
|
+
return_values:
|
46
|
+
- password
|
47
|
+
- port
|
48
|
+
display_values:
|
49
|
+
- user
|
50
|
+
- password
|
51
|
+
estimated_size_mb: 251
|
52
|
+
package:
|
53
|
+
folder_name: bazarr
|
54
|
+
direct_download:
|
55
|
+
url: https://github.com/morpheus65535/bazarr/archive/master.zip
|
56
|
+
target_name: bazarr-master.zip
|
57
|
+
auto_extract: false
|
58
|
+
always_latest: true
|
59
|
+
apt:
|
60
|
+
"1804":
|
61
|
+
packages:
|
62
|
+
- python3.7
|
63
|
+
- python3-distutils
|
64
|
+
- python3-pip
|
Binary file
|
@@ -0,0 +1,135 @@
|
|
1
|
+
[general]
|
2
|
+
ip = 0.0.0.0
|
3
|
+
port = <%= @port %>
|
4
|
+
base_url = /bazarr/
|
5
|
+
path_mappings = [['', ''], ['', ''], ['', ''], ['', ''], ['', '']]
|
6
|
+
debug = False
|
7
|
+
branch = master
|
8
|
+
auto_update = True
|
9
|
+
single_language = False
|
10
|
+
minimum_score = 90
|
11
|
+
use_scenename = True
|
12
|
+
use_postprocessing = False
|
13
|
+
postprocessing_cmd =
|
14
|
+
use_sonarr = False
|
15
|
+
use_radarr = False
|
16
|
+
path_mappings_movie = [['', ''], ['', ''], ['', ''], ['', ''], ['', '']]
|
17
|
+
serie_default_enabled = False
|
18
|
+
serie_default_language = []
|
19
|
+
serie_default_hi = False
|
20
|
+
serie_default_forced = False
|
21
|
+
movie_default_enabled = False
|
22
|
+
movie_default_language = []
|
23
|
+
movie_default_hi = False
|
24
|
+
movie_default_forced = False
|
25
|
+
page_size = 25
|
26
|
+
minimum_score_movie = 70
|
27
|
+
use_embedded_subs = True
|
28
|
+
utf8_encode = True
|
29
|
+
ignore_pgs_subs = False
|
30
|
+
adaptive_searching = False
|
31
|
+
enabled_providers = False
|
32
|
+
throtteled_providers = {}
|
33
|
+
multithreading = True
|
34
|
+
chmod_enabled = False
|
35
|
+
chmod = 0640
|
36
|
+
subfolder = current
|
37
|
+
subfolder_custom =
|
38
|
+
update_restart = True
|
39
|
+
upgrade_subs = False
|
40
|
+
upgrade_frequency = 12
|
41
|
+
days_to_upgrade_subs = None
|
42
|
+
upgrade_manual = False
|
43
|
+
anti_captcha_provider = None
|
44
|
+
wanted_search_frequency = 3
|
45
|
+
|
46
|
+
[auth]
|
47
|
+
type = form
|
48
|
+
username = <%= @user %>
|
49
|
+
password = <%= @hash %>
|
50
|
+
apikey = <%= SecureRandom.hex(20) %>
|
51
|
+
|
52
|
+
[sonarr]
|
53
|
+
ip = 127.0.0.1
|
54
|
+
port = 8989
|
55
|
+
base_url =
|
56
|
+
ssl = False
|
57
|
+
apikey =
|
58
|
+
full_update = Daily
|
59
|
+
full_update_day = 6
|
60
|
+
full_update_hour = 4
|
61
|
+
only_monitored = False
|
62
|
+
|
63
|
+
[radarr]
|
64
|
+
ip = 127.0.0.1
|
65
|
+
port = 7878
|
66
|
+
base_url =
|
67
|
+
ssl = False
|
68
|
+
apikey =
|
69
|
+
full_update = Daily
|
70
|
+
full_update_day = 6
|
71
|
+
full_update_hour = 5
|
72
|
+
only_monitored = False
|
73
|
+
|
74
|
+
[proxy]
|
75
|
+
type = None
|
76
|
+
url =
|
77
|
+
port =
|
78
|
+
username =
|
79
|
+
password =
|
80
|
+
exclude = localhost,127.0.0.1
|
81
|
+
|
82
|
+
[opensubtitles]
|
83
|
+
username =
|
84
|
+
password =
|
85
|
+
use_tag_search = False
|
86
|
+
vip = False
|
87
|
+
ssl = False
|
88
|
+
timeout = 15
|
89
|
+
skip_wrong_fps = False
|
90
|
+
|
91
|
+
[addic7ed]
|
92
|
+
username =
|
93
|
+
password =
|
94
|
+
random_agents = True
|
95
|
+
|
96
|
+
[legendasdivx]
|
97
|
+
username =
|
98
|
+
password =
|
99
|
+
skip_wrong_fps = False
|
100
|
+
|
101
|
+
[legendastv]
|
102
|
+
username =
|
103
|
+
password =
|
104
|
+
|
105
|
+
[xsubs]
|
106
|
+
username =
|
107
|
+
password =
|
108
|
+
|
109
|
+
[assrt]
|
110
|
+
token =
|
111
|
+
|
112
|
+
[anticaptcha]
|
113
|
+
anti_captcha_key =
|
114
|
+
|
115
|
+
[deathbycaptcha]
|
116
|
+
username =
|
117
|
+
password =
|
118
|
+
|
119
|
+
[napisy24]
|
120
|
+
username =
|
121
|
+
password =
|
122
|
+
|
123
|
+
[subscene]
|
124
|
+
username =
|
125
|
+
password =
|
126
|
+
|
127
|
+
[betaseries]
|
128
|
+
token =
|
129
|
+
|
130
|
+
[analytics]
|
131
|
+
enabled = True
|
132
|
+
|
133
|
+
[titlovi]
|
134
|
+
username =
|
135
|
+
password =
|