Wednesday, November 6, 2019

Improvements on the Unofficial OTRS docker images

Since the last post about the development of my unofficial OTRS docker image, appart from having the image updated to include OTRS's latest version which currently is 6.0.23 released some days ago, there have been some small improvements that I want to talk about.


Switching the article storage type

 

The first one is that you can switch the article storage type (ticket attachments) using a new environment variable called OTRS_ARTICLE_STORAGE_TYPE. This variable can have only two values: ArticleStorageDB (OTRS default) or ArticleStorageFS. When setting OTRS_ARTICLE_STORAGE_TYPE to a value different to the currently configured, the article type will be changed to the new one and articles will be moved to the new location.

For example, if you are switching from ArticleStorageDB to ArticleStorageFS, you would set: 

    OTRS_ARTICLE_STORAGE_TYPE=ArticleStorageFS 

in your env file. When the container starts it will:
  1. Change Ticket::Article::Backend::MIMEBase::ArticleStorage sysConfig setting to the new dtorage type
  2. Run ${OTRS_ROOT}bin/otrs.Console.pl Admin::Article::StorageSwitch to export articles from the databse and put them on ${OTRS_ROOT}/var/article.
If you want to swtich back to ArticleStorageDB you only need to remove OTRS_ARTICLE_STORAGE_TYPE from your env file and restart the container, articles will be reimported into the database. Also, the directory ${OTRS_ROOT}/var/article must be mounted on the host as a volume, if not then the exported articles will be lost upon container restart, you have been warned.


Changing default backup script for cron


When enabling scheduled backups, a script to call the OTRS backup script is added to /etc/cron.d. This script loads up the environment variables set at container startup and calls /otrs_backup.sh (which is simply a wrapper to the backup script that comes included with OTRS, that makes it possible control it with env variables and creates a tarball of the backup directory).

Sometimes you need to do some pre-backup stuff before doing the backup, for example excluding old articles (ticket attachments) on the filesystem when using OTRS_ARTICLE_STORAGE_TYPE=ArticleStorageFS

So to change the script being run by cron you can set the OTRS_CRON_BACKUP_SCRIPT environment variable to point to the new script. This file must be present in the /etc/cron.d directory, you will have to create a custom image that uses this one as base and add the custom script, or mount it as a volume on the host.


Disable email fetching


This is a partial reintroduction of an old feature available on OTRS 4 images were you could change the email fetch time or disable fetching using an environment variable. Now there's a new variable called OTRS_DISABLE_EMAIL_FETCH=(yes|no) to at least disable email fetching (is no longer possible to change fetch time from command line, which was the reason for this feature to be removed after OTRS 5 images were released). This is a useful feature when doing debugging with a local OTRS install or while doing initial software configuration.


Please checkout the README file for a more in depth documentation of these new features.