Added Imaginary as an optional container alongside NextCloud (#1351)

* Added imaginary as an optional container

* chore(deps): update alexta69/metube docker tag to v2025 (#1346)

Co-authored-by: bugclerk <bugclerk@ixsystems.com>

* chore(deps): update updates-patch-minor (#1345)

Co-authored-by: bugclerk <bugclerk@ixsystems.com>

* Publish new changes in catalog [skip ci]

* Update catalog changes [skip ci]

* chore(deps): update updates-patch-minor (#1352)

Co-authored-by: bugclerk <bugclerk@ixsystems.com>

* Publish new changes in catalog [skip ci]

* Update catalog changes [skip ci]

* lib-v2: handle validation of ports for both v6 and v4 (#1332)

* better handling of ipv6 and wildcard addresses

* update version

* cleanup tests

* greatly improve readability

* update hashes

* better check

* flake

* regen hashes

* PR comments

* Removed redunant line from description

* dont nuke if users already have setup imaginary manually

* fix metadata

* simplify

* use correct hash

* fix rest of the tests

* Update .gitignore

* fix rendering

* Update app.yaml

---------

Co-authored-by: truenasbot <113129203+truenasbot@users.noreply.github.com>
Co-authored-by: bugclerk <bugclerk@ixsystems.com>
Co-authored-by: sonicaj <waqarsonic1@gmail.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <s.kois@outlook.com>
This commit is contained in:
Tyson
2025-01-27 10:04:31 -07:00
committed by GitHub
parent f4df006a55
commit bb3c43bf3d
12 changed files with 124 additions and 2 deletions

View File

@@ -161,6 +161,11 @@ module.exports = {
"^postgresql-v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$",
["ghcr.io/umami-software/umami"]
),
customVersioning(
// 20250122_091948 {year}{month}{day}_{build}
"^(?<major>\\d{4})(?<minor>\\d{2})(?<patch>\\d{2})_(?<build>\\d+)$",
["nextcloud/aio-imaginary"]
),
customVersioning(
// 2024.10.22-7ca5933
"^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<build>.+)$",

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ ix-dev/**/rendered
ix-dev/test/test-lib/migrations
out.yaml
.coverage
.venv

View File

@@ -14,6 +14,8 @@ capabilities:
name: NET_BIND_SERVICE
- description: Nextcloud and Nginx are able to use raw sockets.
name: NET_RAW
- description: Imaginary is able to set nice level for it's sub-processes.
name: SYS_NICE
categories:
- productivity
description: A file sharing server that puts the control and security of your own
@@ -56,6 +58,11 @@ run_as_context:
group_name: root
uid: 0
user_name: root
- description: Imaginary runs as non-root user.
gid: 568
group_name: imaginary
uid: 568
user_name: imaginary
screenshots:
- https://media.sys.truenas.net/apps/nextcloud/screenshots/screenshot1.png
- https://media.sys.truenas.net/apps/nextcloud/screenshots/screenshot2.png
@@ -66,4 +73,4 @@ sources:
- https://github.com/truenas/charts/tree/master/charts/nextcloud
title: Nextcloud
train: stable
version: 1.5.15
version: 1.5.16

View File

@@ -14,6 +14,9 @@ images:
redis_image:
repository: bitnami/redis
tag: 7.4.2
imaginary_image:
repository: nextcloud/aio-imaginary
tag: "20250106_094420"
consts:
nextcloud_container_name: nextcloud
@@ -22,6 +25,8 @@ consts:
redis_container_name: redis
postgres_container_name: postgres
nginx_container_name: nginx
imaginary_container_name: imaginary
imaginary_port: 9000
db_name: nextcloud
ssl_key_path: /etc/nginx-certs/private.key
ssl_cert_path: /etc/nginx-certs/public.crt

View File

@@ -92,6 +92,20 @@ questions:
# eg chi-sim
max_length: 7
required: true
- variable: imaginary
label: Imaginary
description: |
Imaginary can help improve performance for generating image previews.</br>
Please see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#previews for more information.</br>
schema:
type: dict
attrs:
- variable: enabled
label: Enabled
description: Enable Imaginary
schema:
type: boolean
default: false
- variable: host
label: Host
description: |

View File

@@ -1,4 +1,4 @@
{% from "macros/nc.jinja.sh" import occ, hosts_update, trusted_domains_update %}
{% from "macros/nc.jinja.sh" import occ, hosts_update, trusted_domains_update, imaginary_url %}
{% from "macros/nc.jinja.conf" import opcache, php, limit_request_body, nginx_conf %}
{% set tpl = ix_lib.base.render.Render(values) %}
@@ -148,6 +148,13 @@
{% if not values.network.certificate_id %}
{% do nc_container.ports.add_port(values.network.web_port, 80) %}
{% endif %}
{% if values.nextcloud.imaginary.enabled %}
{% do nc_container.configs.add(
"ix-imaginary-url.sh",
imaginary_url(values.consts.imaginary_container_name, values.consts.imaginary_port),
"/docker-entrypoint-hooks.d/before-starting/ix-imaginary-url.sh", "0755",
) %}
{% endif %}
{% do nc_container.environment.add_user_envs(values.nextcloud.additional_envs) %}
@@ -176,6 +183,14 @@
{% do cron_container.environment.add_user_envs(values.nextcloud.additional_envs) %}
{% endif %}
{% if values.nextcloud.imaginary.enabled %}
{% set imaginary_container = tpl.add_container(values.consts.imaginary_container_name, "imaginary_image") %}
{% do imaginary_container.add_caps(["SYS_NICE"]) %}
{% do imaginary_container.set_user(568, 568) %}
{% do imaginary_container.depends.add_dependency(values.consts.nextcloud_container_name, "service_healthy") %}
{% do imaginary_container.healthcheck.set_test("wget", {"port": 9000, "path": "/health"}) %}
{% endif %}
{% if values.network.certificate_id %}
{% set nginx_container = tpl.add_container(values.consts.nginx_container_name, "nginx_image") %}
{% do nginx_container.deploy.resources.remove_devices() %}

View File

@@ -69,3 +69,9 @@ echo "If you see a domain that is not longer valid, you need to manually remove
set_list "trusted_domains" "${NEXTCLOUD_TRUSTED_DOMAINS}" || { echo "Failed to update trusted domains. Continuing..."; exit 0; }
{%- endmacro -%}
{% macro imaginary_url(host, port) -%}
#!/bin/bash
echo '## Configuring Imaginary...'
occ config:system:set preview_imaginary_url --value={{ "http://%s:%d"|format(host, port) }}
{%- endmacro -%}

View File

@@ -23,6 +23,8 @@ nextcloud:
php_memory_limit: 512
op_cache_memory_consumption: 128
max_execution_time: 30
imaginary:
enabled: false
cron:
enabled: true
schedule: "*/5 * * * *"

View File

@@ -21,6 +21,8 @@ nextcloud:
php_memory_limit: 512
op_cache_memory_consumption: 128
max_execution_time: 30
imaginary:
enabled: false
cron:
enabled: true
schedule: "*/5 * * * *"

View File

@@ -0,0 +1,61 @@
resources:
limits:
cpus: 2.0
memory: 4096
nextcloud:
postgres_image_selector: postgres_17_image
admin_user: admin
admin_password: password
apt_packages:
- ffmpeg
- smbclient
- ocrmypdf
tesseract_languages:
- eng
- chi-sim
imaginary:
enabled: true
host: localhost:8080
data_dir_path: /var/www/html/data
redis_password: YFtYK25GBfr!UsX5mu2Dnd5L5W
db_user: nextcloud
db_password: password
php_upload_limit: 3
php_memory_limit: 512
op_cache_memory_consumption: 128
max_execution_time: 30
cron:
enabled: true
schedule: "*/5 * * * *"
additional_envs: []
network:
web_port: 8080
certificate_id:
nginx:
proxy_timeout: 60
use_different_port: false
ix_volumes:
postgres_data: /opt/tests/mnt/postgres_data
nextcloud-data: /opt/tests/mnt/nextcloud-data
nextcloud-html: /opt/tests/mnt/nextcloud-html
storage:
is_data_in_the_same_volume: false
data:
type: ix_volume
ix_volume_config:
dataset_name: nextcloud-data
create_host_path: true
html:
type: ix_volume
ix_volume_config:
dataset_name: nextcloud-html
create_host_path: true
postgres_data:
type: ix_volume
ix_volume_config:
dataset_name: postgres_data
create_host_path: true
additional_storage: []

View File

@@ -23,6 +23,8 @@ nextcloud:
php_memory_limit: 512
op_cache_memory_consumption: 128
max_execution_time: 30
imaginary:
enabled: false
cron:
enabled: true
schedule: "*/5 * * * *"

View File

@@ -19,6 +19,8 @@ nextcloud:
php_memory_limit: 512
op_cache_memory_consumption: 128
max_execution_time: 30
imaginary:
enabled: false
cron:
enabled: true
schedule: "*/5 * * * *"