Notifications Service Configuration

Introduction

The notification service is responsible for sending emails to users informing them about events that happened. To do this, it hooks into the event system and listens for certain events that the users need to be informed about. As an example, when a user is added to a share, a notification email will be sent to the user.

  • The notifications service does not start automatically and must be started manually. For more details see the Start Infinite Scale section.

  • The reason for excluding the notifications service from autostart is, that the service will block starting up all other services if the NOTIFICATIONS_SMTP_SENDER environment variable is not set. The value can be the real or a placeholder email address for startup testing purposes.

Default Values

  • Notifications listens on port 9170 by default.

Email Notification Templates

The notifications service has embedded email text and html body templates.

Email templates can use the placeholders {{ .Greeting }}, {{ .MessageBody }} and {{ .CallToAction }} which are replaced with translations when sent, see the Translations section for more details. Though the email subject is also part of translations, it has no placeholder as it is a mandatory email component.

Depending on the email purpose, placeholders will contain different strings. An individual translatable string is available for each purpose, to be resolved via the placeholder. The embedded templates are available for all deployment scenarios.

template
  placeholders
    translated strings <-- source strings <-- purpose
final output

In addition, the notifications service supports custom templates. Custom email templates take precedence over the embedded ones. If a custom email template exists, the embedded templates are not used. To configure custom email templates, the NOTIFICATIONS_EMAIL_TEMPLATE_PATH environment variable needs to point to a base folder that will contain the email templates and follow the Templates Subfolder Hierarchy. This path must be available from all instances of the notifications service, a shared storage is recommended.

{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/text/email.text.tmpl
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/html/email.html.tmpl
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/html/img/

The source templates provided by Infinite Scale you can use and adjust are located in the following base folder email / templates with subfolders text and html.

Templates Subfolder Hierarchy

templates
│
└───html
│   │   email.html.tmpl
│   │
│   └───img
│       │   logo-mail.gif
│
└───text
    │   email.text.tmpl

Custom email templates referenced via NOTIFICATIONS_EMAIL_TEMPLATE_PATH must also be located in a subfolder templates/text and templates/html and must have the same names as the embedded templates. It is important that the names of these files and folders match the embedded ones. The templates/html subfolder contains a default HTML template provided by Infinite Scale.

When using a custom HTML template, hosted images can either be linked with standard HTML code like:

<img src="https://raw.githubusercontent.com/owncloud/core/master/core/img/logo-mail.gif" alt="logo-mail"/>

or embedded as a CID source like:

<img src="cid:logo-mail.gif" alt="logo-mail"/>

In the latter case, image files must be located in the templates/html/img subfolder. Supported embedded image types are png, jpeg, and gif. Consider that embedding images via a CID resource may not be fully supported in all email web clients.

Translations

The notifications service has embedded translations sourced via transifex to provide a basic set of translated languages. These embedded translations are available for all deployment scenarios. In addition, the service supports custom translations, though it is currently not possible to just add custom translations to embedded ones. If custom translations are configured, the embedded ones are not used. To configure custom translations, the NOTIFICATIONS_TRANSLATION_PATH environment variable needs to point to a base folder that will contain the translation files. This path must be available from all instances of the userlog service, a shared storage is recommended. Translation files must be of type .po or .mo. For each language, the filename needs to be notifications.po (or notifications.mo) and stored in a folder structure defining the language code. In general the path/name pattern for a translation file needs to be:

{NOTIFICATIONS_TRANSLATION_PATH}/{language-code}/LC_MESSAGES/notifications.po

The language code pattern is composed of language[_territory] where language is the base language and _territory is optional and defines a country.

For example, for the language de, one needs to place the corresponding translation files to

{NOTIFICATIONS_TRANSLATION_PATH}/de/LC_MESSAGES/notifications.po


For the time being, the embedded ownCloud Web frontend only supports the main language code but does not handle any territory. When strings are available in the language code language_territory, the web frontend does not see it as it only requests language. In consequence, any translations made must exist in the requested language to avoid a fallback to the default.

Translation Rules

  • If a requested language code is not available, the service tries to fall back to the base language if available. For example, if the requested language-code de_DE is not available, the service tries to fall back to translations in the de folder.

  • If the base language de is also not available, the service falls back to the system’s default English (en), which is the source of the texts provided by the code.

Default Language

The default language can be defined via the OCIS_DEFAULT_LANGUAGE environment variable. See the settings service for a detailed description.

Event Bus Configuration

The Infinite Scale event bus can be configured by a set of environment variables.

  • If you are using a binary installation as described in Minimal Bare Metal Deployment or Bare Metal with systemd, the address of the event bus OCIS_EVENTS_ENDPOINT is predefined as localhost address without the need for further configuration, but changeable on demand.

  • In case of an orchestrated installation like with Docker or Kubernetes, the event bus must be an external service for scalability like a Redis Sentinel cluster or a key-value-store NATS JetStream. Both named stores are supported and also used in Caching and Persistence. The store used is not part of the Infinite Scale installation and must be separately provided and configured.

  • Note that from a configuration point of view, caching and persistence are independent of the event bus configuration.

Note that for each global environment variable, a service-based one might be available additionally. For precedences see Environment Variable Notes. Check the configuration section below.

Without the aim of completeness, see the list of environment variables to configure the event bus:

Envvar Description

OCIS_EVENTS_ENDPOINT

The address of the event system.

OCIS_EVENTS_CLUSTER

The clusterID of the event system. Mandatory when using NATS as event system.

OCIS_EVENTS_ENABLE_TLS

Enable TLS for the connection to the events broker.

OCIS_INSECURE

Whether to verify the server TLS certificates.

OCIS_EVENTS_AUTH_USERNAME

The username to authenticate with the events broker.

OCIS_EVENTS_AUTH_PASSWORD

The password to authenticate with the events broker.

Configuration

Environment Variables

The notifications service is configured via the following environment variables. Read the Environment Variable Types documentation for important details. Column IV shows with which release the environment variable has been introduced.

  • 7.0.0

Environment variables for the notifications service
Name IV Type Default Value Description

OCIS_TRACING_ENABLED
NOTIFICATIONS_TRACING_ENABLED

pre5.0

bool

false

Activates tracing.

OCIS_TRACING_TYPE
NOTIFICATIONS_TRACING_TYPE

pre5.0

string

The type of tracing. Defaults to '', which is the same as 'jaeger'. Allowed tracing types are 'jaeger' and '' as of now.

OCIS_TRACING_ENDPOINT
NOTIFICATIONS_TRACING_ENDPOINT

pre5.0

string

The endpoint of the tracing agent.

OCIS_TRACING_COLLECTOR
NOTIFICATIONS_TRACING_COLLECTOR

pre5.0

string

The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces. Only used if the tracing endpoint is unset.

OCIS_LOG_LEVEL
NOTIFICATIONS_LOG_LEVEL

pre5.0

string

The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'.

OCIS_LOG_PRETTY
NOTIFICATIONS_LOG_PRETTY

pre5.0

bool

false

Activates pretty log output.

OCIS_LOG_COLOR
NOTIFICATIONS_LOG_COLOR

pre5.0

bool

false

Activates colorized log output.

OCIS_LOG_FILE
NOTIFICATIONS_LOG_FILE

pre5.0

string

The path to the log file. Activates logging to this file if set.

NOTIFICATIONS_DEBUG_ADDR

pre5.0

string

127.0.0.1:9174

Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed.

NOTIFICATIONS_DEBUG_TOKEN

pre5.0

string

Token to secure the metrics endpoint.

NOTIFICATIONS_DEBUG_PPROF

pre5.0

bool

false

Enables pprof, which can be used for profiling.

NOTIFICATIONS_DEBUG_ZPAGES

pre5.0

bool

false

Enables zpages, which can be used for collecting and viewing in-memory traces.

OCIS_URL
NOTIFICATIONS_WEB_UI_URL

pre5.0

string

https://localhost:9200

The public facing URL of the oCIS Web UI, used e.g. when sending notification eMails

NOTIFICATIONS_SMTP_HOST

pre5.0

string

SMTP host to connect to.

NOTIFICATIONS_SMTP_PORT

pre5.0

int

0

Port of the SMTP host to connect to.

NOTIFICATIONS_SMTP_SENDER

pre5.0

string

Sender address of emails that will be sent (e.g. 'ownCloud <noreply@example.com>'.

NOTIFICATIONS_SMTP_USERNAME

pre5.0

string

Username for the SMTP host to connect to.

NOTIFICATIONS_SMTP_PASSWORD

pre5.0

string

Password for the SMTP host to connect to.

NOTIFICATIONS_SMTP_INSECURE

pre5.0

bool

false

Allow insecure connections to the SMTP server.

NOTIFICATIONS_SMTP_AUTHENTICATION

pre5.0

string

Authentication method for the SMTP communication. Possible values are 'login', 'plain', 'crammd5', 'none' or 'auto'. If set to 'auto' or unset, the authentication method is automatically negotiated with the server.

NOTIFICATIONS_SMTP_ENCRYPTION

pre5.0

string

none

Encryption method for the SMTP communication. Possible values are 'starttls', 'ssltls' and 'none'.

OCIS_EVENTS_ENDPOINT
NOTIFICATIONS_EVENTS_ENDPOINT

pre5.0

string

127.0.0.1:9233

The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture.

OCIS_EVENTS_CLUSTER
NOTIFICATIONS_EVENTS_CLUSTER

pre5.0

string

ocis-cluster

The clusterID of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture. Mandatory when using NATS as event system.

OCIS_INSECURE
NOTIFICATIONS_EVENTS_TLS_INSECURE

pre5.0

bool

false

Whether to verify the server TLS certificates.

OCIS_EVENTS_TLS_ROOT_CA_CERTIFICATE
NOTIFICATIONS_EVENTS_TLS_ROOT_CA_CERTIFICATE

pre5.0

string

The root CA certificate used to validate the server’s TLS certificate. If provided NOTIFICATIONS_EVENTS_TLS_INSECURE will be seen as false.

OCIS_EVENTS_ENABLE_TLS
NOTIFICATIONS_EVENTS_ENABLE_TLS

pre5.0

bool

false

Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services.

OCIS_EVENTS_AUTH_USERNAME
NOTIFICATIONS_EVENTS_AUTH_USERNAME

5.0

string

The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.

OCIS_EVENTS_AUTH_PASSWORD
NOTIFICATIONS_EVENTS_AUTH_PASSWORD

5.0

string

The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.

OCIS_EMAIL_TEMPLATE_PATH
NOTIFICATIONS_EMAIL_TEMPLATE_PATH

pre5.0

string

Path to Email notification templates overriding embedded ones.

OCIS_TRANSLATION_PATH
NOTIFICATIONS_TRANSLATION_PATH

pre5.0

string

(optional) Set this to a path with custom translations to overwrite the builtin translations. Note that file and folder naming rules apply, see the documentation for more details.

OCIS_DEFAULT_LANGUAGE

5.0

string

The default language used by services and the WebUI. If not defined, English will be used as default. See the documentation for more details.

OCIS_REVA_GATEWAY

pre5.0

string

com.owncloud.api.gateway

CS3 gateway used to look up user metadata

OCIS_GRPC_CLIENT_TLS_MODE

pre5.0

string

TLS mode for grpc connection to the go-micro based grpc services. Possible values are 'off', 'insecure' and 'on'. 'off': disables transport security for the clients. 'insecure' allows using transport security, but disables certificate verification (to be used with the autogenerated self-signed certificates). 'on' enables transport security, including server certificate verification.

OCIS_GRPC_CLIENT_TLS_CACERT

pre5.0

string

Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the go-micro based grpc services.

OCIS_SERVICE_ACCOUNT_ID
NOTIFICATIONS_SERVICE_ACCOUNT_ID

5.0

string

The ID of the service account the service should use. See the 'auth-service' service description for more details.

OCIS_SERVICE_ACCOUNT_SECRET
NOTIFICATIONS_SERVICE_ACCOUNT_SECRET

5.0

string

The service account secret.

YAML Example

  • 7.0.0

# Autogenerated
# Filename: notifications-config-example.yaml

tracing:
  enabled: false
  type: ""
  endpoint: ""
  collector: ""
log:
  level: ""
  pretty: false
  color: false
  file: ""
debug:
  addr: 127.0.0.1:9174
  token: ""
  pprof: false
  zpages: false
ocis_url: https://localhost:9200
notifications:
  SMTP:
    smtp_host: ""
    smtp_port: 0
    smtp_sender: ""
    smtp_username: ""
    smtp_password: ""
    insecure: false
    smtp_authentication: ""
    smtp_encryption: none
  events:
    endpoint: 127.0.0.1:9233
    cluster: ocis-cluster
    tls_insecure: false
    tls_root_ca_certificate: ""
    enable_tls: false
    username: ""
    password: ""
  email_template_path: ""
  translation_path: ""
  default_language: ""
  reva_gateway: com.owncloud.api.gateway
  grpc_client_tls: null
grpc_client_tls:
  mode: ""
  cacert: ""
service_account:
  service_account_id: ""
  service_account_secret: ""