From d119395338b73e345a142682722938679faf5b70 Mon Sep 17 00:00:00 2001 From: Yadd Date: Sun, 9 Jun 2024 07:55:43 +0400 Subject: [PATCH] Add Docker doc --- README.md | 69 ++++++++++++++++++++++++++++++++++++++- packages/logger/README.md | 12 +++---- server.mjs | 2 +- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4f99ec3d..9815b38f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Twake server repository +# Twake-Chat server repository This is a multi-packages repository. See [packages](./packages) directory. @@ -27,6 +27,73 @@ REST API Endpoints documentation is available on https://linagora.github.io/ToM- [Matrix specification](https://spec.matrix.org/latest/server-server-api/#server-discovery) * [@twake/retry-promise](packages/retry-promise): simple module extending javascript Promise with retry strategy +## Twake-Chat docker + +This repository provides a docker image. Here are the environment variables: + +* Required: + * `BASE_URL`: Public URL + * Database: + * `DATABASE_ENGINE` _(`pg` or `sqlite`)_ + * `DATABASE_HOST` _(path for `sqlite`)_ + * `DATABASE_NAME` + * `DATABASE_USER` + * `DATABASE_PASSWORD` + * `DATABASE_SSL` + * `OIDC_ISSUER`: URL of SSO server + * LDAP service: + * `LDAP_BASE` + * `LDAP_FILTER` + * `LDAP_USER` + * `LDAP_PASSWORD` + * `LDAP_URI` + * Matrix server: + * `SERVER_NAME` _(same value than in Matrix's homeserver.yaml)_ + * `MATRIX_SERVER` _(real Matrix server)_ + * `TEMPLATE_DIR` _(default: `node_modules/@twake/server/templates`)_ +* Recommended: + * `ADDITIONAL_FEATURES`: set true to have all search features; false for a public instance + * Cron service: + * `CRON_SERVICE` _(default: true)_: enable cron tasks + * `UPDATE_USERS_CRON` _(default: `*/15 * * * *`)_ + * `UPDATE_FEDERATED_IDENTITY_HASHES_CRON` _(default: `3 3 * * *`)_ + * Logs: + * `LOG_TRANSPORTS`: set to `Console` + * `TRUSTED_PROXIES`: IP list of server allowed to set `X-Frowarded-For` header + * Rate limits _(see [express-rate-limit](https://www.npmjs.com/package/express-rate-limit))_: + * `RATE_LIMITING_WINDOW` + * `RATE_LIMITING_NB_REQUESTS` +* Optional: + * `FEDERATED_IDENTITY_SERVICES`: list of federated identity services + * Use a CrowdSec service: + * `CROWDSEC_URI` + * `CROWDSEC_KEY` + * Add Jitsi into metadata: + * `JITSI_BASE_URL` + * `JITSI_JWT_ALGORITHM` + * `JITSI_JWT_ISSUER` + * `JITSI_SECRET` + * `JITSI_PREFERRED_DOMAIN` + * `JITSI_USE_JWT` + * Matrix database _(for automatic channels)_: + * `MATRIX_DATABASE_ENGINE` + * `MATRIX_DATABASE_HOST` + * `MATRIX_DATABASE_NAME` + * `MATRIX_DATABASE_PASSWORD` + * `MATRIX_DATABASE_SSL` + * `MATRIX_DATABASE_USER` + * Opensearch features: + * `OPENSEARCH_CA_CERT_PATH` + * `OPENSEARCH_HOST` + * `OPENSEARCH_IS_ACTIVATED` + * `OPENSEARCH_MAX_RETRIES` + * `OPENSEARCH_NUMBER_OF_SHARDS` + * `OPENSEARCH_NUMBER_OF_REPLICAS` + * `OPENSEARCH_PASSWORD` + * `OPENSEARCH_SSL` + * `OPENSEARCH_USER` + * `OPENSEARCH_WAIT_FOR_ACTIVE_SHARDS` + ## Copyright and license Copyright (c) 2023-present Linagora diff --git a/packages/logger/README.md b/packages/logger/README.md index 5c351be1..ec34fe67 100644 --- a/packages/logger/README.md +++ b/packages/logger/README.md @@ -9,9 +9,9 @@ Logger is based on [winston library](https://github.com/winstonjs/winston). This ### Environment variables Three environment variables are available: -* LOG_TRANSPORTS: selects the "interface" to display logs. It must be equal to "Console" or "File" or event both "Console,File" -* LOG_LEVEL: selects the level of logs that should be displayed (available values from the most restrictive to the less restrictive: "error", "warn", "info", "http", "verbose", "debug", "silly") -* LOG_FILE: enables to specify the path to the file where logs should be written if LOG_TRANSPORTS is equal or contains the value "File" +* `LOG_TRANSPORTS`: selects the "interface" to display logs. It must be equal to "Console" or "File" or event both "Console,File" +* `LOG_LEVEL`: selects the level of logs that should be displayed (available values from the most restrictive to the less restrictive: "error", "warn", "info", "http", "verbose", "debug", "silly") +* `LOG_FILE`: enables to specify the path to the file where logs should be written if `LOG_TRANSPORTS` is equal or contains the value "File" ``` LOG_TRANSPORTS=File @@ -23,9 +23,9 @@ LOG_FILE=etc/twake/winston.log All winston's [core configuration properties](https://github.com/winstonjs/winston#logging) except `format` and `levels` can be set in a JSON configuration file. The property `transports` is set through the field `log_transports` which is detailed in the following part. There are three more available properties: -* default_meta: javascript object containing metadata that should be displayed in the log message -* exception_handlers: array containing transports which specify where uncaughtException events should be displayed (see [winston documention](https://github.com/winstonjs/winston#exceptions)) -* rejection_handlers: array containing transports which specify where uncaughtRejection events should be displayed (see [winston documention](https://github.com/winstonjs/winston#rejections)) +* `default_meta`: javascript object containing metadata that should be displayed in the log message +* `exception_handlers`: array containing transports which specify where uncaughtException events should be displayed (see [winston documention](https://github.com/winstonjs/winston#exceptions)) +* `rejection_handlers`: array containing transports which specify where uncaughtRejection events should be displayed (see [winston documention](https://github.com/winstonjs/winston#rejections)) These properties should be the value of a `logging` field diff --git a/server.mjs b/server.mjs index 9d765ac3..c41ccc03 100644 --- a/server.mjs +++ b/server.mjs @@ -19,7 +19,7 @@ const appServerConf = { let conf = { ...appServerConf, additional_features: process.env.ADDITIONAL_FEATURES || false, - cron_service: process.env.CRON_SERVICE || true, + cron_service: process.env.CRON_SERVICE ?? true, database_engine: process.env.DATABASE_ENGINE, database_host: process.env.DATABASE_HOST, database_name: process.env.DATABASE_NAME,