Skip to content

Commit

Permalink
tautulli: use v2
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Nov 21, 2024
1 parent 541bd27 commit f2370c7
Show file tree
Hide file tree
Showing 119 changed files with 5,642 additions and 1,406 deletions.
2 changes: 1 addition & 1 deletion ix-dev/community/invidious/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ icon: https://media.sys.truenas.net/apps/invidious/icons/icon.svg
keywords:
- youtube
lib_version: 2.0.19
lib_version_hash: 3c564e36f7c7a7d7f6ff7f4dfe290359546e48f73497c2394e6e31bca3f9fe54
lib_version_hash: f6fa0a4ba723f6974a6388307785cf70ac2b2ddd108dc92ffff6c589bc293179
maintainers:
- email: [email protected]
name: truenas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ def set_network_mode(self, mode: str):
self._network_mode = valid_network_mode_or_raise(mode, self._render_instance.container_names())

def set_entrypoint(self, entrypoint: list[str]):
self._entrypoint = [escape_dollar(e) for e in entrypoint]
self._entrypoint = [escape_dollar(str(e)) for e in entrypoint]

def set_command(self, command: list[str]):
self._command = [escape_dollar(e) for e in command]
self._command = [escape_dollar(str(e)) for e in command]

def add_storage(self, mount_path: str, config: "IxStorage"):
self._storage.add(mount_path, config)
Expand Down
6 changes: 3 additions & 3 deletions ix-dev/community/tautulli/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ keywords:
- media
- analytics
- notifications
lib_version: 1.1.7
lib_version_hash: d05e43e25b7dc1736be6cc1efa4b9255368aa346e3e7a4350a38440f29b73186
lib_version: 2.0.20
lib_version_hash: 3779b82e7078e7f4936eefee6d4ff7133788c19397901c69d25e930afcbaa475
maintainers:
- email: [email protected]
name: truenas
Expand All @@ -34,4 +34,4 @@ sources:
- https://github.com/Tautulli/Tautulli
title: Tautulli
train: community
version: 1.0.25
version: 1.1.0
1 change: 1 addition & 0 deletions ix-dev/community/tautulli/ix_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ images:
consts:
tautulli_container_name: tautulli
perms_container_name: permissions
config_path: /config
38 changes: 38 additions & 0 deletions ix-dev/community/tautulli/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ groups:
description: Configure Network for Tautulli
- name: Storage Configuration
description: Configure Storage for Tautulli
- name: Labels Configuration
description: Configure Labels for Tautulli
- name: Resources Configuration
description: Configure Resources for Tautulli

Expand Down Expand Up @@ -313,6 +315,42 @@ questions:
description: The domain to use for the SMB share.
schema:
type: string
- variable: labels
label: ""
group: Labels Configuration
schema:
type: list
default: []
items:
- variable: label
label: Label
schema:
type: dict
attrs:
- variable: key
label: Key
schema:
type: string
required: true
- variable: value
label: Value
schema:
type: string
required: true
- variable: containers
label: Containers
description: Containers where the label should be applied
schema:
type: list
items:
- variable: container
label: Container
schema:
type: string
required: true
enum:
- value: tautulli
description: tautulli
- variable: resources
label: ""
group: Resources Configuration
Expand Down
98 changes: 26 additions & 72 deletions ix-dev/community/tautulli/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,33 @@
{# Stores storage items that contains info for volumes, vol mounts, perms dirs and perms mounts #}
{% set storage_items = namespace(items=[]) %}
{# Stores the top level volumes #}
{% set volumes = namespace(items={}) %}
{# Stores the container volume mounts #}
{% set volume_mounts = namespace(items=[]) %}
{# Stores the perms container volume mounts #}
{% set perms_mounts = namespace(items=[]) %}
{# Stores the perms container dirs #}
{% set perms_dirs = namespace(items=[]) %}
{% set tpl = ix_lib.base.render.Render(values) %}

{% do storage_items.items.append(ix_lib.base.storage.storage_item(data=dict(values.storage.config, **{"mount_path": "/config"}),
values=values, perm_opts={"mount_path": "/mnt/tautulli/config", "mode": "check", "uid": values.run_as.user, "gid": values.run_as.group}
)) %}
{% do storage_items.items.append(ix_lib.base.storage.storage_item(data={"type":"anonymous", "mount_path": "/tmp"})) %}
{% set c1 = tpl.add_container(values.consts.tautulli_container_name, "image") %}
{% set perm_container = tpl.deps.perms(values.consts.perms_container_name) %}

{% for store in values.storage.additional_storage %}
{% do storage_items.items.append(ix_lib.base.storage.storage_item(data=store, values=values,
perm_opts={"mount_path": "/mnt/tautulli/dir_%s"|format(loop.index0), "mode": "check", "uid": values.run_as.user, "gid": values.run_as.group}
)) %}
{% endfor %}
{% set perms_config = {"uid": values.run_as.user, "gid": values.run_as.group, "mode": "check"} %}
{% do c1.set_user(values.run_as.user, values.run_as.group) %}
{% do c1.healthcheck.set_test("curl", {"port": values.network.web_port, "path": "/status"}) %}
{% do c1.set_entrypoint(["python", "Tautulli.py"]) %}
{% do c1.set_command([
"--config", "%s/config.ini" | format(values.consts.config_path),
"--datadir", values.consts.config_path,
"--port", values.network.web_port
]) %}
{% do c1.environment.add_user_envs(values.tautulli.additional_envs) %}
{% do c1.ports.add_port(values.network.web_port, values.network.web_port) %}

{# Add each item to the above lists #}
{% for item in storage_items.items %}
{% if item.vol and volumes.items.update(item.vol) %}{% endif %}
{% if item.vol_mount and volume_mounts.items.append(item.vol_mount) %}{% endif %}
{% if item.perms_item and (perms_dirs.items.append(item.perms_item.perm_dir), perms_mounts.items.append(item.perms_item.vol_mount)) %}{% endif %}
{% endfor %}
{% do c1.add_storage(values.consts.config_path, values.storage.config) %}
{% do perm_container.add_or_skip_action("config", values.storage.config, perms_config) %}

{# Containers #}
services:
{{ values.consts.tautulli_container_name }}:
user: {{ "%d:%d" | format(values.run_as.user, values.run_as.group) }}
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
entrypoint:
- python
- Tautulli.py
command:
- --config
- /config/config.ini
- --datadir
- /config
- --port
- "{{ values.network.web_port }}"
deploy:
resources: {{ ix_lib.base.resources.resources(values.resources) | tojson }}
devices: {{ ix_lib.base.resources.get_devices(values.resources) | tojson }}
{% if perms_dirs.items %}
depends_on:
{{ values.consts.perms_container_name }}:
condition: service_completed_successfully
{% endif %}
{% if values.network.host_network %}
network_mode: host
{% endif %}
cap_drop: {{ ix_lib.base.security.get_caps().drop | tojson }}
security_opt: {{ ix_lib.base.security.get_sec_opts() | tojson }}
{% if values.network.dns_opts %}
dns_opt: {{ ix_lib.base.network.dns_opts(values.network.dns_opts) | tojson }}
{% endif %}
{% set test = ix_lib.base.healthchecks.curl_test(port=values.network.web_port, path="/status") %}
healthcheck: {{ ix_lib.base.healthchecks.check_health(test) | tojson }}
environment: {{ ix_lib.base.environment.envs(app={}, user=values.tautulli.additional_envs,values=values) | tojson }}
{% if not values.network.host_network %}
ports:
- {{ ix_lib.base.ports.get_port(port={"target": values.network.web_port, "published": values.network.web_port}) | tojson }}
{% endif %}
volumes: {{ volume_mounts.items | tojson }}
{% if perms_dirs.items %}
{{ values.consts.perms_container_name }}: {{ ix_lib.base.permissions.perms_container(items=perms_dirs.items, volumes=perms_mounts.items) | tojson }}
{% endif %}
{% for store in values.storage.additional_storage %}
{% do c1.add_storage(store.mount_path, store) %}
{% do perm_container.add_or_skip_action(store.mount_path, store, perms_config) %}
{% endfor %}

{% if volumes.items %}
volumes: {{ volumes.items | tojson }}
{% if perm_container.has_actions() %}
{% do perm_container.activate() %}
{% do c1.depends.add_dependency(values.consts.perms_container_name, "service_completed_successfully") %}
{% endif %}

x-portals: {{ ix_lib.base.metadata.get_portals([{"port": values.network.web_port}]) | tojson }}
x-notes: {{ ix_lib.base.metadata.get_notes("Tautulli") | tojson }}
{% do tpl.portals.add_portal({"port": values.network.web_port}) %}

{{ tpl.render() | tojson }}

This file was deleted.

Loading

0 comments on commit f2370c7

Please sign in to comment.