OTRS on docker HOWTO

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Forum rules
Dont create your support topics here! No new topics with questions allowed!
Locked
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

OTRS on docker HOWTO

Post by jbaptiste »

Hi,

At the company I work at we have been running OTRS 4 on docker on production for multiple companies without issues for over a year now with more than 10k downloads on docker hub. I was planning on posting earlier about them here but, you know...life happens. Now I had some free time again I managed to finish the update to OTRS 5 so I decided to post about it here. If you aren't familiar with docker then please read about it here and install it first, along with docker-compose.

With docker everything is more easy :), to start all the components of an OTRS install you just need to use a docker-compose.yml service definition file like the following one:

Code: Select all

version: '2'
services:
  otrs:
    image: juanluisbaptiste/otrs:latest
    ports:
    - "80:80"
    links:
    - mariadb:mariadb
    - postfix:postfix
    volumes_from:
    - data
    environment:
        MYSQL_ROOT_PASSWORD: changeme
        OTRS_ROOT_PASSWORD: changeme
        OTRS_NUMBER_GENERATOR: Date
        OTRS_LANGUAGE: es
        OTRS_POSTMASTER_FETCH_TIME: 5

  mariadb:
    image: juanluisbaptiste/otrs-mariadb:latest
    expose:
    - "3306"
    volumes_from:
    - data
    environment:
        MYSQL_ROOT_PASSWORD: changeme

  postfix:
     image: juanluisbaptiste/postfix:latest
     expose:
     - "25"
     environment:
       SMTP_SERVER=smtp.yourcompany.com
       SMTP_USERNAME=otrs@yourcompany.com
       SMTP_PASSWORD=xxxxxxx
       SERVER_HOSTNAME=support.yourcompany.com

#  nginx:
#   image: juanluisbaptiste/bigbluebutton-proxy
#    ports:
#      - "80:80"
#      - "443:443"
#    volumes:
#     - /var/run/docker.sock:/tmp/docker.sock
#      - "/etc/localtime:/etc/localtime:ro"

  data:
    image: centos/mariadb:latest
    volumes:
    - /var/lib/mysql
    - "./otrs/backup:/var/otrs/backups"

    command: /bin/true
This yml file defines all the containers needed to run OTRS, their initial configuration state, the container startup order and their dependencies. The previous docker-compose.yml file starts the following containers for a complete OTRS system:
  • A web server container with OTRS installed and ready to use.
  • A MySQL database server container preconfigured with needed settings according to the installation instructions.
  • An SMTP Relay container.
  • A data volume container to store OTRS data files (database files, /var/*, etc).
  • A nginx proxy server container (optional).
Environment variables are used to set the initial configuration for each container. On this example, OTRS will use the Date number generator, it will check for emails each 5 minutes, use spanish by default for the web interface and setup MySQL and admin passwords. There are a bunch of variables that can be set to customize the installation, there's a complete list at the github project page, for example, to start the OTRS container from an existing backup, or how to change the web theme.

Modify the environment variables on the docker-compose.yml file as needed and start the OTRS service like this:

First, pull all container images:

Code: Select all

sudo docker-compose pull
Then, start all containers:

Code: Select all

sudo docker-compose up -d
Wait some seconds (yes, seconds) for all the containers to finish up starting up and go to the administration interface at:

http://localhost/otrs/

Now you can go ahead and start configuring and using your new dockerized OTRS install. There's more information on this blog post.

I hope this is also helpul for someone else :D
Last edited by jbaptiste on 07 May 2018, 20:48, edited 2 times in total.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: OTRS 5 on docker HOWTO

Post by RStraub »

Wow.

I'm still having some kind of love/hate for docker, but I very much appreciate your information, especially the .yml file!
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

RStraub wrote:Wow.

I'm still having some kind of love/hate for docker, but I very much appreciate your information, especially the .yml file!

I LOVE docker, it has made my life at work so much easier, but its true that it has some learning curve too. not because it is difficult to use but more that its a different way of doing things as what admins have been normally doing (baremetal and VMs) for years and it takes some time to fully understand the advantages of containers and how docker makes everything very easy to do, like bringing a complete fresh OTRS install up in a matter of seconds instead of hours/days doing it the "traditional" ways.

Test it and let me know how it goes.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
Julian0o
Znuny newbie
Posts: 55
Joined: 14 May 2014, 13:28
Znuny Version: 5.0.7

Re: OTRS 5 on docker HOWTO

Post by Julian0o »

Thanks for the Docker Image!

What about using Plugins? I use Kix4OTRS and i have no idea if it's working perfectly with you docker Installation.
OTRS 5.x & KIX4OTRS
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

Julian0o wrote:Thanks for the Docker Image!

What about using Plugins? I use Kix4OTRS and i have no idea if it's working perfectly with you docker Installation.
By plugins you mean addons ? if yes it shouldn't be too difficult to implement, I think it would be just a matter of understanding how they can be installed manually so it can be scripted on the container's startup script, and configured through an env variable. It's in my TODO list, but I really have no idea on when I will have the time to work on it. If you want to give it a try I can help you getting it done.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

jbaptiste wrote:
Julian0o wrote:Thanks for the Docker Image!

What about using Plugins? I use Kix4OTRS and i have no idea if it's working perfectly with you docker Installation.
By plugins you mean addons ? if yes it shouldn't be too difficult to implement, I think it would be just a matter of understanding how they can be installed manually so it can be scripted on the container's startup script, and configured through an env variable. It's in my TODO list, but I really have no idea on when I will have the time to work on it. If you want to give it a try I can help you getting it done.
About this, I added a new feature to automatically reinstall modules on container remove/update that have been added through the web gui. Before they got broken after an update and they needed to be manually reinstalled on the admin packages page.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

What happened to the original post ? I made a little modification and it disappeared, this was weeks ago and when I noticed it I sent a PM to one of the modedators (crythias) a couple weeks ago but no answer. I have the original post if needed.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

jbaptiste wrote:What happened to the original post ? I made a little modification and it disappeared, this was weeks ago and when I noticed it I sent a PM to one of the modedators (crythias) a couple weeks ago but no answer. I have the original post if needed.
Many thanks to the mod that restored it : )
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

Hi,

I have been working on the update to OTRS 6 (6.0.4), it's mostly ready and available on docker hub as juanluisbaptiste/otrs:6beta, I would appreciate some feedback on it.

OTRS 5 image has been updated to latest version (5.0.26), the same for OTRS 4 (4.0.28).

The only issue I have so far seems to be with sending emails through an external SMTP relay (as this project has always done), no errors when for example, sending the email from a new ticket, just a message saying that the message has been queued for sending, but no errors on any logs and emails never arrive to the SMTP relay. Probably nothing to do with the docker container but I haven't found any references to this problem on the internet.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

Everything seems to be working very well !! I will be releasing OTRS 6 image during next week and I'll be blogging about the new features too. In the mean time here's a teaser:

Image
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

Well it took me a little more to get this one out the door but here it is, the unofficial OTRS 6 images are available, you can read more about the container's new features in my blog and write your feedback here.

Old versions are still available at dockerhub, tagged with its version:
  • juanluisbaptiste/otrs:latest (latest 6.0.x version)
  • juanluisbaptiste/otrs:6.0.x
  • juanluisbaptiste/otrs:5.0.x
  • juanluisbaptiste/otrs:4.0x
Feedback welcome.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS 5 on docker HOWTO

Post by jbaptiste »

Hi,

I have added a new feature that was missing for a long time: major version upgrades. Now, by setting the env variable OTRS_UPGRADE=yes in the docker-compose file you can do major version upgrades, for example from OTRS 5.0.x to OTRS 6.0.x.

More details on this on this blog post.

This feature was also added to the otrs_5_0_x branch so updates from OTRS 4 to 5 can be performed too.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS on docker HOWTO

Post by jbaptiste »

Hi,

I have added a new feature: automated backups. Since now on automatic full backups are run daily at 6AM. Backup excecution can be controlled using the following variables:
  • OTRS_BACKUP_TIME: Sets the backup excecution time, in cron format. If set to "disable" automated backups will be disabled.
  • OTRS_BACKUP_TYPE: Sets the type of backup, it receives the same values as the OTRS backup script
  • OTRS_BACKUP_COMPRESSION: Sets the backup compression method to use, also it receives the same values as the OTRS backup script (gzip|bzip2). The default is gzip.
  • OTRS_BACKUP_ROTATION: Sets the number of days to keep the backup files. The default is 30 days.

Code: Select all

OTRS_BACKUP_TYPE=dbonly
OTRS_BACKUP_TIME="0 12,12 * * *"
OTRS_BACKUP_COMPRESSION=bzip2
This feature is available since the 6.0.15 build.

More details on how to use this feature here.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
Ballzer0
Znuny newbie
Posts: 14
Joined: 12 Nov 2018, 16:54
Znuny Version: 6.0.12
Real Name: Tommy Ballo

Re: OTRS on docker HOWTO

Post by Ballzer0 »

When you set this up, is it safe to modify files like Config.pm, in a container, or will it be removed when i update?
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS on docker HOWTO

Post by jbaptiste »

Ballzer0 wrote: 14 Jun 2019, 10:37 When you set this up, is it safe to modify files like Config.pm, in a container, or will it be removed when i update?
The container only modifies a limited set of configuration parameters that have an environment variable defined (see documentation), other configuration parameters will not be touched nor does Config.pm get recreated on boot or something like that. So does your modifications will be removed when updating ? no, they will not.

But don't forget to host-mount the /opt/otrs/Kernel directory as the container documentation says, look at the example compose file to make configuration and data persistence possible after container restarts.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS on docker HOWTO

Post by jbaptiste »

Hi all,

I have added some new features and merged a lot of PR's from the community !! let me review them really quick
  • Docker secrets support
  • SMTP settings fully configurable via environment variables
  • Some updates with the major upgrade process to make it more reliable and safe
  • Auto installation of addons at container start
  • Passwords are masked at container start
  • Added an example systemd service file to run docker-compose as a service at docker host boot.
For a more detailed description of these new features please follow this post.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS on docker HOWTO

Post by jbaptiste »

Hi,

Since my last post, appart from keeping the images updated to the latest OTRS version, there have been some small improvements added to them:
  • Switching the article storage type from database to filesystem (and viceversa) using OTRS_ARTICLE_STORAGE_TYPE environment variable, setting its value to ArticleStorageDB or ArticleStorageFS accordingly.
  • Added the environment variables OTRS_BACKUP_SCRIPT to change the included backup script to a custom one.
  • Added the environment variable OTRS_DISABLE_EMAIL_FETCH to disable postmaster email fetching. Actually this was a feature that was present before on the OTRS images and got removed when OTRS 5 was released as the method to disable email fetching had changed.
You can check the project's ChangeLog here and this blog post for more details.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
jbaptiste
Znuny advanced
Posts: 104
Joined: 01 Aug 2015, 03:45
Znuny Version: 6.0.x
Contact:

Re: OTRS on docker HOWTO

Post by jbaptiste »

Hi,

As OTRS ((Comunity Edition)) is no longer supported by xxx I have switched my OTRS docker images to Znuny LTS release. You can find more information about the switch here.
Last edited by jbaptiste on 05 Apr 2021, 01:24, edited 1 time in total.
Want to run OTRS on docker ? checkout my OTRS on docker HOWTO | Project's github page
Locked