Installation via YAML - Redis App

Hello everyone,

I’m familiar with the ways to install the app: either through the Discover Apps selection, via the Custom App menu, or through the Install via YAML menu.

I want to install the Redis app, but in the community version, the app only comes with pre-configured credentials and a configurable port, through which you can access Redis after installation.

When Redis is installed as a Custom App, nothing changes – only the port is configurable. However, Redis offers many more features that can’t be activated this way.

That’s why I’ve been trying to install Redis via YAML for the past two days, but unfortunately, without success.

I couldn’t find a working post about YAML installation in the community. So my question is: Does anyone know a working template or can the Redis YAML script be viewed? Or could someone share the necessary YAML lines for the installation here?

Thanks in advance for your help!
Best Cony

I don’t have a redis deployed as a standalone, only as part of my nextcloud stack but the relevant part of my compose file is

services:
   nextcloud-redis:
      image: redis:alpine
      container_name: nextcloud-redis
      hostname: nextcloud-redis
      volumes:
        - /mnt/Poolname/Datasetname/redis:/data
      ports:
        - 6380:6379
      networks:
          - default
      restart: unless-stopped
      command: redis-server --requirepass password # replace password with the password you want to use

Edit: fixed yaml…

1 Like

nice bro, but doesn’t this installation setup miss the reference point for where the installation image is pulled from?
This is from the Plex installation via YAML:

*plex:
networks:

  • plex_net
    image: link (URL of the Link)
    restart: always*

Where is the Redis installation image being pulled from in the installation process?

I deployed it via Portainer, and I think it pulls from dockerhub if not specified otherwise
This should also work for the custom app function in truenas

bro, that sounds nice - I try it

i edited my previous post and added that, as far as i know, the truenas gui also pulls from dockerhub if not specified otherwise. So using redis:alpine as tag should also work for the truenas gui

just did a test installation with the yaml i posted above and it deployed fine

1 Like

Bro LarsR,
you made my day! Thanks for your posts!
Cony

Bro, I used your template and only modified the app folder. The result failed. Do you have any idea what might be causing this?

FAILED: Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 515, in run
await self.future
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 562, in __run_body
rv = await self.middleware.run_in_thread(self.method, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 627, in run_in_thread
return await self.run_in_executor(io_thread_pool_executor, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 624, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/service/crud_service.py”, line 294, in nf
rv = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/decorator.py”, line 101, in wrapped
result = func(*args)
^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/crud.py”, line 130, in do_create
return self.middleware.call_sync(‘app.custom.create’, data, job)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1041, in call_sync
return methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/custom_app.py”, line 84, in create
raise e from None
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/custom_app.py”, line 74, in create
compose_action(app_name, version, ‘up’, force_recreate=True, remove_orphans=True)
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/compose_utils.py”, line 36, in compose_action
compose_action(app_name, app_version, ‘down’, remove_orphans=True)
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/compose_utils.py”, line 61, in compose_action
raise CallError(err_msg)
middlewared.service_exception.CallError: [EFAULT] Failed ‘down’ action for ‘nextcloud’ app. Please check /var/log/app_lifecycle.log for more details

Did you check that ?

First guess would always be a problem with yaml syntax - identation, Tabs instead of spaces…
Other than that: did you create the folder for the persistent volume with the correct permissions ?

i just realised that i had a mistake in the yaml i posted, i forgot the servies: part at the start. I fixed the yaml. Please try again.

Bro, I adjusted and executed your template like this:

*services:
nextcloud-redis:
image: redis:alpine
container_name: nextcloud-redis
hostname: nextcloud-redis
volumes:

  • /mnt/app-pool/redistest/redis:/data
    ports:
  • 6380:6390
    networks:
  • default
    restart: unless-stopped
    command: redis-server --requirepass test # replace password with the password you want to use

The result:
*Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 515, in run
await self.future
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 562, in __run_body
rv = await self.middleware.run_in_thread(self.method, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 627, in run_in_thread
return await self.run_in_executor(io_thread_pool_executor, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 624, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/service/crud_service.py”, line 294, in nf
rv = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/decorator.py”, line 101, in wrapped
result = func(*args)
^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/crud.py”, line 130, in do_create
return self.middleware.call_sync(‘app.custom.create’, data, job)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1041, in call_sync
return methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/custom_app.py”, line 49, in create
compose_config = validate_payload(data, ‘app_create’)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/custom_app_utils.py”, line 21, in validate_payload
verrors.check()
File “/usr/lib/python3/dist-packages/middlewared/service_exception.py”, line 72, in check
raise self
middlewared.service_exception.ValidationErrors: [EINVAL] app_create.custom_compose_config_string: Invalid YAML provided
*
I’ve been using TrueNAS for 6 years and I’m usually doing fine, but when I see this log, I’m lost. To me, it looks like the YAML still needs the user and group configuration, user ID, group ID, and I’m still not sure where the installation containers should be pulled from and with which permissions.

Can’t YAML obtain a user and group configuration, user ID, group ID, and then create the installation directory /mnt/app-pool/redistest/redis:/data itself?

No

A question for clarification: When I select an app in TrueNAS, I get a configuration page where I can enter the ID and user group. Isn’t this equivalent to a YAML file? Can’t I set the same parameters via YAML that I would otherwise enter through the configuration page? Because that’s exactly my issue—while the app installation of redis works perfectly, I want to experiment with the parameters and need to specify them in more places than the configuration page allows. Do you have an idea of how to write the YAML for this? And why is the YAML working on your system but not on mine?

there are environment variables that can be used to set user and group ids, but usually redis doesn’t need user and group ids

Edit:
And did you check the logfile from shell with

sudo cat /var/log/app_lifecycle.log 

thats the log file:
(ERROR) app_lifecycle.compose_action():56 - Failed down action for nextcloud app: validating /mnt/.ix-apps/app_configs/nextcloud/versions/1.0.0/templates/rendered/docker-compose.yaml: (root) Additional property nextcloud-redis in not allowed\n

ok, I made it. The problem was UID/GID 568! I fixed it via shell:
mkdir -p /mnt/app-pool/redis/redis
chown -R 568:568 /mnt/app-pool/redis

and the YAML installation is fine!
Thanks, Cony

1 Like