Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mumble: use v2 #1055

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
mumble: use v2
  • Loading branch information
stavros-k committed Nov 28, 2024
commit f9decb48068752f7544a6da2b17725511a4dd5ed
6 changes: 3 additions & 3 deletions ix-dev/community/mumble/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ host_mounts: []
icon: https://media.sys.truenas.net/apps/mumble/icons/icon.svg
keywords:
- voice
lib_version: 1.1.7
lib_version_hash: d05e43e25b7dc1736be6cc1efa4b9255368aa346e3e7a4350a38440f29b73186
lib_version: 2.0.26
lib_version_hash: e82ef6b594774d6160be29cae52fd4f8367518498ea1cd386d7d9edc4ea8b654
maintainers:
- email: [email protected]
name: truenas
Expand All @@ -27,4 +27,4 @@ sources:
- https://www.mumble.info/
title: Mumble
train: community
version: 1.1.13
version: 1.2.0
38 changes: 38 additions & 0 deletions ix-dev/community/mumble/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ groups:
description: Configure Network for Mumble
- name: Storage Configuration
description: Configure Storage for Mumble
- name: Labels Configuration
description: Configure Labels for Mumble
- name: Resources Configuration
description: Configure Resources for Mumble

Expand Down Expand Up @@ -361,6 +363,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: mumble
description: mumble
- variable: resources
label: ""
group: Resources Configuration
Expand Down
133 changes: 40 additions & 93 deletions ix-dev/community/mumble/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,103 +1,50 @@
{# 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={"type": "anonymous", "mount_path": "/tmp"})) %}
{% do storage_items.items.append(ix_lib.base.storage.storage_item(data=dict(values.storage.data, **{"mount_path": "/data"}),
values=values, perm_opts={"mount_path": "/mnt/mumble/data", "mode": "check", "uid": values.consts.run_as_user, "gid": values.consts.run_as_group}
)) %}
{% set c1 = tpl.add_container(values.consts.mumble_container_name, "image") %}
{% set perm_container = tpl.deps.perms(values.consts.perms_container_name) %}
{% set perm_config = {"uid": values.consts.run_as_user, "gid": values.consts.run_as_group, "mode": "check"} %}

{% 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/mumble/dir_%s"|format(loop.index0), "mode": "check", "uid": values.consts.run_as_user, "gid": values.consts.run_as_group}
)) %}
{% endfor %}

{# 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.set_user(values.consts.run_as_user, values.consts.run_as_group) %}
{% if values.ci %}
{% do c1.healthcheck.set_test("tcp", {"port": values.network.server_port}) %}
{% else %}
{% do c1.healthcheck.disable() %}
{% endif %}

{% if values.network.certificate_id %}
configs:
private:
content: {{ values.ix_certificates[values.network.certificate_id].privatekey | tojson }}
public:
content: {{ values.ix_certificates[values.network.certificate_id].certificate | tojson }}
{% set cert = values.ix_certificates[values.network.certificate_id] %}
{% do c1.configs.add("private", cert.privatekey, values.consts.ssl_key_path) %}
{% do c1.configs.add("public", cert.certificate, values.consts.ssl_cert_path) %}

{% do c1.environment.add_env("MUMBLE_CONFIG_sslCert", values.consts.ssl_cert_path) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_sslKey", values.consts.ssl_key_path) %}
{% endif %}

{# Containers #}
services:
{{ values.consts.mumble_container_name }}:
user: {{ "%d:%d" | format(values.consts.run_as_user, values.consts.run_as_group) }}
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.network.certificate_id %}
configs:
- source: private
target: {{ values.consts.ssl_key_path }}
- source: public
target: {{ values.consts.ssl_cert_path }}
{% endif %}
{% 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.tcp_test(values.network.server_port) %}
healthcheck: {{ ix_lib.base.healthchecks.check_health(test) if values.ci else {"disable": true} | tojson }}
{% set app_env = {
"MUMBLE_SUPERUSER_PASSWORD": values.mumble.superuser_password,
"MUMBLE_CONFIG_serverpassword": values.mumble.server_password,
"MUMBLE_CONFIG_icesecretread": values.mumble.ice_secret_read,
"MUMBLE_CONFIG_icesecretwrite": values.mumble.ice_secret_write,
{% do c1.environment.add_env("MUMBLE_SUPERUSER_PASSWORD", values.mumble.superuser_password) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_serverpassword", values.mumble.server_password) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_icesecretread", values.mumble.ice_secret_read) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_icesecretwrite", values.mumble.ice_secret_write) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_port", values.network.server_port) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_welcometext", values.mumble.welcome_text) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_users", values.mumble.users) %}
{% do c1.environment.add_env("MUMBLE_CONFIG_ice", "tcp -h 127.0.0.1 -p %d"|format(values.network.ice_port)) %}
{% do c1.environment.add_user_envs(values.mumble.additional_envs) %}

{% do c1.ports.add_port(values.network.ice_port, values.network.ice_port) %}
{% do c1.ports.add_port(values.network.server_port, values.network.server_port) %}
{% do c1.ports.add_port(values.network.server_port, values.network.server_port, {"protocol": "udp"}) %}

{% do c1.add_storage("/data", values.storage.data) %}
{% do perm_container.add_or_skip_action("data", values.storage.data, perm_config) %}

"MUMBLE_CONFIG_port": values.network.server_port,
"MUMBLE_CONFIG_welcometext": values.mumble.welcome_text,
"MUMBLE_CONFIG_users": values.mumble.users,
"MUMBLE_CONFIG_ice": "tcp -h 127.0.0.1 -p %d"|format(values.network.ice_port),
} %}
{% if values.network.certificate_id %}
{% do app_env.update({
"MUMBLE_CONFIG_sslCert": values.consts.ssl_cert_path,
"MUMBLE_CONFIG_sslKey": values.consts.ssl_key_path,
}) %}
{% endif %}
environment: {{ ix_lib.base.environment.envs(app=app_env, user=values.mumble.additional_envs, values=values) | tojson }}
{% if not values.network.host_network %}
ports:
- {{ ix_lib.base.ports.get_port(port={"target": values.network.server_port, "published": values.network.server_port}) | tojson }}
- {{ ix_lib.base.ports.get_port(port={"target": values.network.server_port, "published": values.network.server_port, "protocol": "udp"}) | tojson }}
- {{ ix_lib.base.ports.get_port(port={"target": values.network.ice_port, "published": values.network.ice_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, perm_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([]) | tojson }}
x-notes: {{ ix_lib.base.metadata.get_notes("Mumble") | tojson }}
{{ tpl.render() | tojson }}

This file was deleted.

Loading