Skip to content

Commit

Permalink
add ix_values to define static values and images (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k authored Jul 30, 2024
1 parent 5e0e2fe commit a368648
Show file tree
Hide file tree
Showing 36 changed files with 203 additions and 83 deletions.
21 changes: 12 additions & 9 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
words:
- CIFS
- CPUS
- cifs
- consts
- cpus
- dnsmasq
- Healtcheck
- htpasswd
- ipaddr
- isready
- Jellyfin
- jellyfin
- logsearch
- Mebibytes
- mebibytes
- minio
- nocopy
- tailscale
- tailscaled
- pihole
- radarr
- plexinc
- plexpass
- qbittorrent
- Syncthing
- radarr
- syncthing
- tailscale
- tailscaled
- tmpfs
- tracebacklimit
- truenas
Expand Down
4 changes: 2 additions & 2 deletions ix-dev/community/jellyfin/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords:
- media
- streaming
lib_version: 1.0.0
lib_version_hash: 8e293d07d49bc9e9d34ec6d9cc12526d7cfdf043092d437885eb4bdbaf4b3ae4
lib_version_hash: 1653158d96bfa65906563cc4695a15254e1227ecdaa6975eb3163c398a371aa2
maintainers:
- email: dev@ixsystems.com
name: truenas
Expand All @@ -35,4 +35,4 @@ sources:
- https://jellyfin.org/
title: Jellyfin
train: community
version: 1.0.1
version: 1.0.2
8 changes: 8 additions & 0 deletions ix-dev/community/jellyfin/ix_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
images:
image:
repository: jellyfin/jellyfin
tag: 10.9.7

consts:
jellyfin_container_name: jellyfin
perms_container_name: permissions
14 changes: 5 additions & 9 deletions ix-dev/community/jellyfin/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% from "macros/global/perms/container.yaml.jinja" import perms_container %}

{% set perms_container_name = "permissions" %}
{% set jellyfin_container_name = "jellyfin" %}
{% set jellyfin_image = "jellyfin/jellyfin:10.9.7" %}

{# 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 #}
Expand Down Expand Up @@ -43,9 +39,9 @@

{# Containers #}
services:
{{ jellyfin_container_name }}:
{{ values.consts.jellyfin_container_name }}:
user: {{ "%d:%d" | format(values.run_as.user, values.run_as.group) }}
image: {{ jellyfin_image }}
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
deploy:
resources: {{ ix_lib.base.resources.resources(values.resources) | tojson }}
Expand All @@ -54,7 +50,7 @@ services:
- 107
{% if perms_dirs.items %}
depends_on:
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
condition: service_completed_successfully
{% endif %}
{% if values.network.host_network %}
Expand All @@ -76,7 +72,7 @@ services:
{% endif %}
volumes: {{ volume_mounts.items | tojson }}
{% if perms_dirs.items %}
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
{{ perms_container(items=perms_dirs.items) | indent(4) }}
volumes:
{% for item in perms_mounts.items %}
Expand All @@ -89,4 +85,4 @@ volumes: {{ volumes.items | tojson }}
{% endif %}

x-portals: {{ ix_lib.base.metadata.get_portals([{"port": 8096 if values.network.host_network else values.network.web_port}]) | tojson }}
x-notes: {{ ix_lib.base.metadata.get_notes("Syncthing") | tojson }}
x-notes: {{ ix_lib.base.metadata.get_notes("Jellyfin") | tojson }}
11 changes: 11 additions & 0 deletions ix-dev/community/jellyfin/templates/library/base_v1_0_0/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ def is_number(string):
return True
except ValueError:
return False


def get_image(images={}, name=""):
if not images:
throw_error("Expected [images] to be set")
if name not in images:
throw_error(f"Expected [images.{name}] to be set")
if not images[name].get("repository") or not images[name].get("tag"):
throw_error(f"Expected [images.{name}.repository] and [images.{name}.tag] to be set")

return f"{images[name]['repository']}:{images[name]['tag']}"
4 changes: 2 additions & 2 deletions ix-dev/community/qbittorrent/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords:
- torrent
- download
lib_version: 1.0.0
lib_version_hash: 8e293d07d49bc9e9d34ec6d9cc12526d7cfdf043092d437885eb4bdbaf4b3ae4
lib_version_hash: 1653158d96bfa65906563cc4695a15254e1227ecdaa6975eb3163c398a371aa2
maintainers:
- email: dev@ixsystems.com
name: truenas
Expand All @@ -31,4 +31,4 @@ sources:
- https://www.qbittorrent.org/
title: qBittorrent
train: community
version: 1.0.1
version: 1.0.2
8 changes: 8 additions & 0 deletions ix-dev/community/qbittorrent/ix_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
images:
image:
repository: ghcr.io/onedr0p/qbittorrent
tag: 4.6.5

consts:
qbittorrent_container_name: qbittorrent
perms_container_name: permissions
12 changes: 4 additions & 8 deletions ix-dev/community/qbittorrent/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% from "macros/global/perms/container.yaml.jinja" import perms_container %}

{% set perms_container_name = "permissions" %}
{% set qbittorrent_container_name = "qbittorrent" %}
{% set qbittorrent_image = "ghcr.io/onedr0p/qbittorrent:4.6.5" %}

{# 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 #}
Expand Down Expand Up @@ -39,16 +35,16 @@

{# Containers #}
services:
{{ qbittorrent_container_name }}:
{{ values.consts.qbittorrent_container_name }}:
user: {{ "%d:%d" | format(values.run_as.user, values.run_as.group) }}
image: {{ qbittorrent_image }}
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
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:
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
condition: service_completed_successfully
{% endif %}
{% if values.network.host_network %}
Expand Down Expand Up @@ -76,7 +72,7 @@ services:
{% endif %}
volumes: {{ volume_mounts.items | tojson }}
{% if perms_dirs.items %}
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
{{ perms_container(items=perms_dirs.items) | indent(4) }}
volumes:
{% for item in perms_mounts.items %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ def is_number(string):
return True
except ValueError:
return False


def get_image(images={}, name=""):
if not images:
throw_error("Expected [images] to be set")
if name not in images:
throw_error(f"Expected [images.{name}] to be set")
if not images[name].get("repository") or not images[name].get("tag"):
throw_error(f"Expected [images.{name}.repository] and [images.{name}.tag] to be set")

return f"{images[name]['repository']}:{images[name]['tag']}"
4 changes: 2 additions & 2 deletions ix-dev/community/radarr/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords:
- media
- movies
lib_version: 1.0.0
lib_version_hash: 8e293d07d49bc9e9d34ec6d9cc12526d7cfdf043092d437885eb4bdbaf4b3ae4
lib_version_hash: 1653158d96bfa65906563cc4695a15254e1227ecdaa6975eb3163c398a371aa2
maintainers:
- email: dev@ixsystems.com
name: truenas
Expand All @@ -32,4 +32,4 @@ sources:
- https://github.com/Radarr/Radarr
title: Radarr
train: community
version: 1.0.1
version: 1.0.2
8 changes: 8 additions & 0 deletions ix-dev/community/radarr/ix_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
images:
image:
repository: ghcr.io/onedr0p/radarr
tag: 5.6.0.8846

consts:
radarr_container_name: radarr
perms_container_name: permissions
12 changes: 4 additions & 8 deletions ix-dev/community/radarr/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% from "macros/global/perms/container.yaml.jinja" import perms_container %}

{% set perms_container_name = "permissions" %}
{% set radarr_container_name = "radarr" %}
{% set radarr_image = "ghcr.io/onedr0p/radarr:5.6.0.8846" %}

{# 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 #}
Expand Down Expand Up @@ -37,16 +33,16 @@

{# Containers #}
services:
{{ radarr_container_name }}:
{{ values.consts.radarr_container_name }}:
user: {{ "%d:%d" | format(values.run_as.user, values.run_as.group) }}
image: {{ radarr_image }}
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
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:
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
condition: service_completed_successfully
{% endif %}
{% if values.network.host_network %}
Expand All @@ -68,7 +64,7 @@ services:
- {{ 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 %}
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
{{ perms_container(items=perms_dirs.items) | indent(4) }}
volumes:
{% for item in perms_mounts.items %}
Expand Down
11 changes: 11 additions & 0 deletions ix-dev/community/radarr/templates/library/base_v1_0_0/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ def is_number(string):
return True
except ValueError:
return False


def get_image(images={}, name=""):
if not images:
throw_error("Expected [images] to be set")
if name not in images:
throw_error(f"Expected [images.{name}] to be set")
if not images[name].get("repository") or not images[name].get("tag"):
throw_error(f"Expected [images.{name}.repository] and [images.{name}.tag] to be set")

return f"{images[name]['repository']}:{images[name]['tag']}"
4 changes: 2 additions & 2 deletions ix-dev/community/tailscale/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ keywords:
- vpn
- tailscale
lib_version: 1.0.0
lib_version_hash: 8e293d07d49bc9e9d34ec6d9cc12526d7cfdf043092d437885eb4bdbaf4b3ae4
lib_version_hash: 1653158d96bfa65906563cc4695a15254e1227ecdaa6975eb3163c398a371aa2
maintainers:
- email: dev@ixsystems.com
name: truenas
Expand All @@ -42,4 +42,4 @@ sources:
- https://hub.docker.com/r/tailscale/tailscale
title: Tailscale
train: community
version: 1.0.1
version: 1.0.2
8 changes: 8 additions & 0 deletions ix-dev/community/tailscale/ix_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
images:
image:
repository: tailscale/tailscale
tag: v1.66.4

consts:
tailscale_container_name: tailscale
perms_container_name: permissions
12 changes: 4 additions & 8 deletions ix-dev/community/tailscale/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% from "macros/global/perms/container.yaml.jinja" import perms_container %}

{% set perms_container_name = "permissions" %}
{% set tailscale_container_name = "tailscale" %}
{% set tailscale_image = "tailscale/tailscale:v1.66.4" %}

{# 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 #}
Expand Down Expand Up @@ -42,15 +38,15 @@
x-tas: {{ values.tailscale | tojson }}
{# Containers #}
services:
{{ tailscale_container_name }}:
image: {{ tailscale_image }}
{{ values.consts.tailscale_container_name }}:
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
deploy:
resources: {{ ix_lib.base.resources.resources(values.resources) | tojson }}
devices: {{ ix_lib.base.resources.get_devices(values.resources) | tojson }}
{% if values.tailscale.userspace and perms_dirs.items %}
depends_on:
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
condition: service_completed_successfully
{% endif %}
{% if values.network.host_network %}
Expand Down Expand Up @@ -82,7 +78,7 @@ services:
volumes: {{ volume_mounts.items | tojson }}

{% if values.tailscale.userspace and perms_dirs.items %}
{{ perms_container_name }}:
{{ values.consts.perms_container_name }}:
{{ perms_container(items=perms_dirs.items) | indent(4) }}
volumes:
{% for item in perms_mounts.items %}
Expand Down
11 changes: 11 additions & 0 deletions ix-dev/community/tailscale/templates/library/base_v1_0_0/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ def is_number(string):
return True
except ValueError:
return False


def get_image(images={}, name=""):
if not images:
throw_error("Expected [images] to be set")
if name not in images:
throw_error(f"Expected [images.{name}] to be set")
if not images[name].get("repository") or not images[name].get("tag"):
throw_error(f"Expected [images.{name}.repository] and [images.{name}.tag] to be set")

return f"{images[name]['repository']}:{images[name]['tag']}"
4 changes: 2 additions & 2 deletions ix-dev/stable/pihole/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ keywords:
- networking
- dns
lib_version: 1.0.0
lib_version_hash: 8e293d07d49bc9e9d34ec6d9cc12526d7cfdf043092d437885eb4bdbaf4b3ae4
lib_version_hash: 1653158d96bfa65906563cc4695a15254e1227ecdaa6975eb3163c398a371aa2
maintainers:
- email: dev@ixsystems.com
name: truenas
Expand All @@ -53,4 +53,4 @@ sources:
- https://github.com/truenas/charts/tree/master/charts/pihole
title: Pi-hole
train: stable
version: 1.0.1
version: 1.0.2
8 changes: 8 additions & 0 deletions ix-dev/stable/pihole/ix_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
images:
image:
repository: pihole/pihole
tag: 2024.06.0

consts:
pihole_container_name: pihole
perms_container_name: permissions
7 changes: 2 additions & 5 deletions ix-dev/stable/pihole/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{% set pihole_container_name = "pihole" %}
{% set pihole_image = "pihole/pihole:2024.06.0" %}

{# 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 #}
Expand All @@ -24,8 +21,8 @@

{# Containers #}
services:
{{ pihole_container_name }}:
image: {{ pihole_image }}
{{ values.consts.pihole_container_name }}:
image: {{ ix_lib.base.utils.get_image(images=values.images, name="image") }}
restart: unless-stopped
deploy:
resources: {{ ix_lib.base.resources.resources(values.resources) | tojson }}
Expand Down
Loading

0 comments on commit a368648

Please sign in to comment.