Where to change agent notification templates in docker compose setup?

Infos:

  • Used Zammad version: 6.2.0
  • Used Zammad installation type: docker-compose
  • Operating system: Ubuntu 22.04
  • Browser + version:

I have to send adopted notifications to the agents, but I can’t determinate in which container the actual changes have to be done. The documentation at https://admin-docs.zammad.org/en/latest/manage/trigger/system-notifications.html doesn’t help at this point.

Does anybody know on which container i have to change the templates?

Expected behavior:

  • Zammad sending adopted agent notification

Actual behavior:

Steps to reproduce the behavior:

Hi, what I did was to create a package with the modified notifications.

You can find the source here:

A very comprehensive tutorial about how to build packages, which is also a prerequisite to use any of my code shared before is available here:

Otherwise you probably have to either add a custom yaml according to Install with Docker — Zammad System Documentation documentation and mount the custom files to the correct directory within the docker container (more info about mounting files docker - How to mount a single file in a volume - Stack Overflow) or enter the container and modify the files manually with docker exec ..., but in the second case the files will be overwritten at every update of the Zammad container.

Maybe someone in the community has a better suggestion, have you already tried the search to see if the Zammad team proposes official solutions?

Best,
Skip

2 Likes

That’s outdated. We currently are at 6.3.1, you should keep your instance up to date.

Thank you for you for your answer. In this particular case it is an single purpose application stack with 22 containers, so I’m a little cautious about updates. Our main instance of zammad is up to date :wink:

I recently ran into this myself. Skip is right about needing to do a custom mount, but to get at those files, you need to get into the right container 1st. This will get you in:

 docker exec -it zammad-docker-compose_zammad-nginx_1 /bin/bash

The challenge is then editing the appropriate files in /opt/zammad/app/views/mailer. There doesn’t appear to be a copy of emacs, vi, or pico/nano in the image, so there’s additional hackery needed to manipulate your templates. Hope this is of some help.

If you suggest doing stuff inside the container, can you at least please provide the correct way to di it (and the correct container…)?

For everyone wondering, here’s the documentation which gives you two flavors:
https://docs.zammad.org/en/latest/install/docker-compose.html#how-to-run-commands-in-the-stack

Or you can get the original files straight from the source (pun intended) :wink:

The original files are located under ticket_create or ticket_update.

Let me know if that helps

That’s a great idea, Skip, kinda where my brain was heading with this. My thought was to grab the source files to make changes and then just add a directory with them as a mount in the docker-compose.overrride that will attach them to the path that’s in the image. My bad not stating that earlier. Since the image is immutable, if I messed something up or needed to revert, I could just comment out the path in the override, bounce the container, and it saves me from having to rebuild a custom image while I fix things.

This is a much more complicated docker stack than I’m used to playing with, so I might be coloring way outside of the lines here. Since none of what I said could be accomplished without knowing where the files live, my intention in my earlier reply was to just give OP an easy way to look at the stuff inside the image to get their bearings (at least that’s how I learn).

If I make headway with this train of thought, I’ll post an update. Thanks.

TBH I have completely different approach. I’m not using default notification. Instead I’ve created few triggers, and as an action I’m sending email with message I want.

Looks like I’ve got success without major hackery, but some experimentation might still be needed. I’m running Ubuntu Server 22.04 LTS for reference so there might be some differences depending on distros.

  1. In the zammad-compose-docker directory, make sure you have a docker-compose.override.yml file. This is not the same as the similarly named docker-compose.override-local.yml file!
  2. Edit the file above to make the mailer templates accessible/editable on your host. Note that my example keeps the local storage driver for simplicity and auto-exposes the files from the image on the host after restarting the container. This keeps the override simple and more inline with the main docker-compose file.
version: '3.8'

services:
  zammad-nginx:
    volumes:
      - zammad-mailer-templates:/opt/zammad/app/views/mailer

volumes:
   zammad-mailer-templates:
      driver: local
  1. Navigate to /var/lib/docker/volumes/zammad-docker-compose_zammad-mailer-templates/_data/. Note that on my system, the owner of the new directory and everything above it is root:root by docker design and you won’t be able to traverse to it. Everything under that path is owned by the user running the container, though. There’s a few ways around this, some safe, some unsafe, but you really shouldn’t be navigating your directory structure or editing as root.
  2. From here on out, the System Notifications Documentation will work. Just make sure you have the right owner and permissions applied to any modified files. As a proof-of-concept, I did a simple touch ./testfile.txt and then navigated inside the container using my command a few posts earlier to verify it was visible.

I still suggest to make use of the .custom files since those are never overwritten by Zammad updates

https://admin-docs.zammad.org/en/latest/manage/trigger/system-notifications.html#how-can-i-customize-them

Anyhow glad that it worked out!