Code Monkey home page Code Monkey logo

rt-docker's Introduction

Request Tracker with Docker

This is a complete setup for Request Tracker with docker and docker compose. The production setup assumes you have an external postgres database and an external SMTP server for outgoing emails. A local database server is only started in the dev configuration.

The prebuilt image is available from https://hub.docker.com/r/firefart/requesttracker. The image is rebuilt on a daily basis.

Prerequisites

  • Docker with the compose plugin
  • an external SMTP server to send emails
  • an external IMAP server to receive emails from

Instruction

To start use either ./dev.sh which builds the images locally or ./prod.sh which uses the prebuilt ones from docker hub. Before running this you also need to add the required configuration files (see Configuration).

Configuration

The following configuration files need to be present before starting:

  • RT_SiteConfig.pm : RTs main configuration file. This needs to be present in the root of the dir. See RT_SiteConfig.pm.example for an example configration and the needed paths and settings for this configuration.
  • ./msmtp/msmtp.conf : config for mstmp (outgoing email). See msmtp.conf for an example. The ./msmtp folder is also mounted to /msmtp/ in the container so you can load certificates from the config file.
  • ./nginx/certs/pub.pem : Public TLS certficate for nginx
  • ./nginx/certs/priv.pem : Private key for nginx' TLS certficate
  • crontab : Crontab file that will be run as the RT user. See contab.example for an example. Crontab output will be sent via msmtp to the MAILTO address.

Additional configs:

  • ./gpg/ : This folder should contain the gpg keyring if used in rt. Be sure to chmod the files to user 1000 with 0600 so RT will not complain.
  • ./smime/ : This folder should contain the SMIME certificate if configured in RT
  • ./nginx/startup-scripts/ : This folder should contain executable bash files that will be executed on nginx start. This can be used to modify the default nginx config to add client certificate authentication for example. There are several placeholders in the config file which can be replaced with sed to add some config directives at the right places.
  • ./shredder/ : This directory will be used by the shredder functionality https://docs.bestpractical.com/rt/latest/RT/Shredder.html so the backups are stored on the host

For output of your crontabs you can use the /cron directory so the output will be available on the host.

In the default configuration all output from RT, nginx, getmail and msmtp is available via docker logs (or docker compose -f ... logs).

Full Profile

There is also a full profile in docker compose which enables dozzle for viewing logs and pgadmin for easy db access. You can enable this profile by docker compose --profile=full .... or by setting the COMPOSE_PROFILES environment variable to full. For example export COMPOSE_PROFILES=full

Dozzle

The full profile starts dozzle which makes all logs available under /logs/ without authentication. To change the path of /logs/ you can put the environment var DOZZLE_BASE in your .env file of the project root and change the nginx config on startup using a custom startup script. If you want to enable authorization on the logs endpoint add the following lines with the values of your choice into the .env file of the project root.

DOZZLE_USERNAME=root
DOZZLE_PASSWORD=password

PGADMIN

pgadmin will be available under /pgadmin. It requires a master email and password on start so this needs to be configured. For the username put the following line in .env with the email of your choice. If you do not supply an email the default will be [email protected].

For the password create the file pgadmin_password.secret in the project root and simply put your master password in without any special syntax. This will be loaded as a docker secret.

nginx-startup-scripts

You can use nginx-startup-scripts to change the nginx config on the fly on startup without rebuilding the image. The config contains the patterns # __SERVER_REPLACE__ and # __LOCATION_REPLACE__ which can be replaced to inject common patterns in the config.

Here is an example of adding client certificate authentication to the main nginx config:

#!/bin/sh

set -e

echo "adding client certificate check"
client_dn="CN=root,OU=Dep,O=Org,C=AT"
client_serial="126F4828EA098B11"
sed -i 's/# __SERVER_REPLACE__/ssl_verify_client on;\nssl_verify_depth 5;\nssl_client_certificate \/certs\/chain.pem;\nif ($ssl_client_verify != SUCCESS) { return 407; }\nif ($ssl_client_s_dn != "'"$client_dn"'") { return 408; }\nif ($ssl_client_serial !~ "'"$client_serial"'") { return 409; }/' /etc/nginx/conf.d/default.conf
echo "finished"

Create Certificate

This certificate will be used by nginx. If you want another certificate just place it in the folder.

openssl req -x509 -newkey rsa:4096 -keyout ./nginx/certs/priv.pem -out ./nginx/certs/pub.pem -days 3650 -nodes

Init database

This initializes a fresh database

docker compose -f docker-compose.yml run --rm rt bash -c 'cd /opt/rt5 && perl ./sbin/rt-setup-database --action init'

You might need to restart the rt service after this step as it crashes if the database is not initialized.

Hint: Add --skip-create in dev as the database is created by docker

Upgrade steps

Upgrade Database

docker compose -f docker-compose.yml run --rm rt bash -c 'cd /opt/rt5 && perl ./sbin/rt-setup-database --action upgrade --upgrade-from 4.4.4'

Fix data inconsistencies

Run multiple times with the --resolve switch until no errors occur

docker compose -f docker-compose.yml run --rm rt bash -c 'cd /opt/rt5 && perl ./sbin/rt-validator --check --resolve'

rt-docker's People

Contributors

firefart avatar dependabot[bot] avatar tomaszstrojny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.