Iterapp.toml

The iterapp.toml file is the single point of entry-file containing the necessary features that your app will need to live in the Iterapp-universe. This needs to be in your repository's root-directory. When Iterapp discovers that your app has a file like this, it will use it to setup the application.

Note

An empty file is a perfectly valid configuration, if you can use everything as default.

Features

Here is an overview over everything you can put in iterapp.toml, with defaults.

# Change to deploy multiple applings. See the appling-docs.
applings=[]
# Which environment to auto-deploy. Set to `none` to disable auto-deploy. (will still build and you
# can deploy from slack or manually)
default_environment="test"
# Which port is the app listening
port = 3000
# How many instances of your app to run in prod (default is 2)
replicas = 2
# How many instances of your app to run in test/snap (default is 1)
replicas_test = 1
readiness_path = "/health"

# Liveness probes. You probably only want this if your app suddenly stops to a halt without crashing
# See https://play.sindre.me/kubernetes-liveness
liveness_path = "/liveness"
# If you use liveness, it can be a good idea to have a separate http server (in the same process) for that
# one. If you have that, you can specify the port here.
liveness_port = 3001


domains=[]
# See Bruk ditt eget domene
from_to_www_redirect = false
# See Bruk ditt eget domene
dns01_for_acme = false

[env.common]
# Port is set to the value of port.
PORT="3000"

[env.prod]
# Default is empty
ENV_NAME="ENV_VALUE"

[env.test]
# Default is empty
ENV_NAME="ENV_VALUE"

[build_secrets]
# Default is empty. Generate secrets on https://apps.iterapp.no/encrypt_secret
"my-secret" = { encrypted = "FSXRT02ouBlR4edBprBiUxgP1ii5_nWLwYQycy0OP1wK0z51ZeclZSIRCEtSAwp3nrqBGh9ckemqb9MYrnAdi6_NxQOoyji1dtZn1qNWQUuf6" }

[postgres]
# Just adding the postgres-header is enough to add postgres and get a database
# But remember that following entries need to be a section with properties and not just properties,
# otherwise Iterapp will think the properties belong to [postgres]-section

[redis_lfu_cache]
# Deploy a redis instance configured as a lfu cache as part of the app. See `redis`.
enabled = true

[cloud_sql_postgres_instances]
# See the doc for `postgres` for how to use this.
5432="iterate-vake:europe-west1:vake-cloud-sql"

[ingress]
# Set to `true` to disable access logs
disable_access_log = false

# Max size of bodies. Default is "1m" (I think). See
# http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
proxy_max_body_size="8m"

# Whether to disable the ingress for this app or appling.
disable = false

# Whether to allow large headers in responses.
# Possible values are "normal", "large" and "huge".
response_max_header_size = "large"

# Iterapp is able to set domains for other environments than prod. This is proably not
# needed, but might be needed for CORS-reasons when you are serving the frontend
# elsewhere
[domains_env]
test = ["test-api.ting.no"]

# Create a cronjob
[cronjobs.update-thing]
    schedule="0 * * * *"
    path="/api/v1/run_scheduled_task"

    # The default method is GET, but will be changed to POST in a future version.
    # Valid methods are GET, POST, DELETE, HEAD.
    method = "GET"

    [cronjobs.update-thing.headers]
        Authorization = "Bearer asdf123"

[nats]
# Just adding the nats header is enough. You'll get a nats account. See more under `nats` in the menu

# You can specify requests for cpu and memory, overriding the defaults
# (25m cpu + 100Mi memory). This is an advanced feature, but might be required
# for apps using lots of memory or cpu.
#
# NOTE: This is _not_ the max amount of CPU/memory the pods can use. This is a
# note to kubernetes saying how large your pods are, and are used for calculating
# how many nodes we need in the cluster. The scheduler uses this information
# to decide which node to place the Pod on.
#
# Note: This is _per pod/replica_.
#
# See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# Note that we don't set limits for any pods
[requests]
cpu = "25m"
memory = "100Mi"

Overriding values

Sometimes your app will need to override values, for example you would like to have a database in production and a database for all other environments. To make this work you would add the production database properties to be under [env.prod] and test database under [env.common]. The [env.prod] overrides properties defined in [env.common] when the app runs in production.

Default Environment Variables

Iterapp sets the following environment variables for all running apps.

Environment variableDescription
PORTThe port the app should listen on for HTTP. Same as port in iterapp.toml (default 3000)
HOPS_BUILD_NUMBERThe build number for the build that build the dockerimage that is running
HOPS_DEPLOYMENT_IDThe deployment id for the current deployment
HOPS_ENVThe environment the app is running in. I.e. prod, test, snap3.
HOPS_GIT_SHAThe GIT SHA hash used for building

In addition apps with a database has environment-variables used to connect to that. See postgres.