Deploying the Backend

Important

TIRA makes greate use of the internet forum tool Discourse. Before you continue, please set up a Discourse instance and install the reverse proxy plugin Disraptor.

The TIRA backend is entirely contained within the official docker image, ghcr.io/tira-io/tira-backend:latest. To see, what a deployment using this container can look like, please have a look at our demo deployment.

Configuring TIRA

TIRA can be configured using two ways (non-exclusive):

  1. Environment variables

  2. A configuration file

To kill two birds with one stone (only figuratively speaking), we refer you to the fully documented default configuration file (below). Any value of the form !ENV ${<name>:<value>} indicates that the value is read from the environment variable <name> and, if that environment variable does not exist, the default value, <value> is assigned. This means, that, to set TIRA into debug mode, for example, you have two options:

  1. The line debug: !ENV ${TIRA_DEBUG:false} tells us that, per default, the debug mode is disabled but we can enable it by setting the environment variable TIRA_DEBUG to true.

  2. Copy the default configuration, replace debug: !ENV ${TIRA_DEBUG:false} with debug: true and map the new configuration file into your container to /tira/config/tira-application-config.yml (this location can be changed using the TIRA_CONFIG environment variable).

TIRA’s default configuration
# For your convenience, we marked secrets with [SECRET]. Make sure, you change these
# values from their defaults!

##########################################################################################
# TIRA                                                                                   #
##########################################################################################
# Enables debug mode. This means more verbose output in the console and for the REST-API.
# Settings this value to true in production is a security risk!
debug: !ENV ${TIRA_DEBUG:false}

tira_root: !ENV ${TIRA_ROOT:/tira}
# The directory where logs are written to. Defaults to TIRA_ROOT/log/tira-application
# logging_dir: /mnt/ceph/tira/log/tira-application

# [SECRET]
github_token: !ENV ${TIRA_GITHUB_TOKEN}

##########################################################################################
# Database                                                                               #
##########################################################################################
database:
  # django.db.backends.mysql or django.db.backends.sqlite3
  engine: !ENV ${TIRA_DB_ENGINE:django.db.backends.sqlite3}
  # when backend is sqlite, this will be the name of the database below TIRA_ROOT/state
  name: !ENV ${TIRA_DB_NAME:tira}
  user: !ENV ${TIRA_DB_USER:tira} # ignored when using sqlite3
  password: !ENV ${TIRA_DB_PASSWORD} # ignored when using sqlite3
  host: !ENV ${TIRA_DB_HOST:tira-mariadb} # ignored when using sqlite3
  port: !ENV ${TIRA_DB_PORT:3306} # ignored when using sqlite3

##########################################################################################
# Discourse                                                                              #
##########################################################################################
discourse_api_url: !ENV ${DISCOURSE_API_URL:https://www.tira.io}

# [SECRET]
discourse_api_key: !ENV ${DISCOURSE_API_KEY:""}

##########################################################################################
# Django                                                                                 #
##########################################################################################
# A list of hostnames using which the backend may be addressed. The value "*" denotes any
# address. A value of ["tira.example.com", "example.com"] would only allow requests made
# addressing these hostnames. See
# https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts for more information.
allowed_hosts:
  - "*"

# [SECRET] See https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-SECRET_KEY
# for more information.
django_secret: !ENV ${DJANGO_SECRET:change-me!}

##########################################################################################
# Deprecated and removed soon (we hope)                                                  #
##########################################################################################
# grpc_host can be local or remote. If local, it will call localhost (i.e., for testing).
# If remote, it will call the vm-host. When developing, set this option to local,
# otherwise you might accidentally remote-control the live-vms.
grpc_host: local
host_grpc_port: 50051
application_grpc_port: 50052

Attention

Some of these configuration parameters are secrets and should stay secret. Do not use their default values for production and use Docker secrets to set them.

Endpoints

Lastly, of course, Disraptor has to be supplied with the routes for TIRA at Settings > Plugins > Disraptor. Since routes may change in the future and depending on what you want to test you maybe do no need the full set of routes arranged it is recommended to take a look at application/src/tira/urls.py. Here is an example of what can be used to have access to most of the current TIRA:

From

To

Method

/public/tira/*wildcard

http://127.0.0.1:8080/public/tira/*wildcard

GET

/task/*wildcard

http://127.0.0.1:8080/task/*wildcard

GET

/task/*wildcard

http://127.0.0.1:8080/task/*wildcard

POST

/api/*wildcard

http://127.0.0.1:8080/api/*wildcard

GET

/tira-admin

http://127.0.0.1:8080/tira-admin

GET

/tira-admin/*wildcard

http://127.0.0.1:8080/tira-admin/*wildcard

GET

/tira-admin/*wildcard

http://127.0.0.1:8080/tira-admin/*wildcard

POST

/static/*wildcard

http://127.0.0.1:8080/static/*wildcard

GET

/grpc/*wildcard

http://127.0.0.1:8080/grpc/*wildcard

GET

/grpc/*wildcard

http://127.0.0.1:8080/grpc/*wildcard

POST

/tasks

http://127.0.0.1:8080/

GET

/tira/static/*wildcard

http://127.0.0.1:8080/tira/static/*wildcard

GET

/health

http://127.0.0.1:8080/health

GET

/info

http://127.0.0.1:8080/info

GET

/v1/*wildcard

http://127.0.0.1:8080/v1/*wildcard

GET

/v1/*wildcard

http://127.0.0.1:8080/v1/*wildcard

POST

/v1/*wildcard

http://127.0.0.1:8080/v1/*wildcard

DELETE

/v1/*wildcard

http://127.0.0.1:8080/v1/*wildcard

UPDATE

Important

Routes that were added later take precedence over those added before when multiple rules match.

Hint

You may need to restart the Rails server to apply your changes.