From a5bfdd990a521f4710dc1d634ec2f570c227b350 Mon Sep 17 00:00:00 2001
From: Mayr Martin <22145802+mayrmartin@users.noreply.github.com>
Date: Thu, 28 Oct 2021 12:03:36 +0200
Subject: [PATCH] doc: add documentation for frontend-logging
---
docs/environment-variables.md | 126 ++++++++++++++++++----------------
1 file changed, 68 insertions(+), 58 deletions(-)
diff --git a/docs/environment-variables.md b/docs/environment-variables.md
index 0c6894494d..ab14c9a1d6 100644
--- a/docs/environment-variables.md
+++ b/docs/environment-variables.md
@@ -15,64 +15,74 @@ In the following you can find all the environment variables used in the TruBudge
If you need a `.env-example` file as a template, use the `.env-example` file in `/scripts/operation`. This file has all values pre-filled.
-| Env Variable | Required | Default Value | Used by | Description |
-| -------------------------------- | -------- | --------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| ORGANIZATION | yes | - | bc/api | In the blockchain network, each node is represented by its organization name. This environment variable sets this organization name. It is used to create the organization stream on the blockchain and is also displayed in the frontend's top right corner. |
-| ORGANIZATION_VAULT_SECRET | yes | - | api | This is the key to en-/decrypt user data of an organization. If you want to add a new node for your organization, you want users to be able to log in on either node. Make sure that the api connected to the new node has the same organization vault secret.
**Caution:** If you want to run TruBudget in production,make sure NOT to use the default value from the `.env_example` file! |
-| API_HOST | no | | bc/prov | The IP address of one api which is connected to the node you want to connect to (The IP addresses are usually the same as for the P2P host address). |
-| API_PORT | no | 8080 | bc/prov | The port used to connect to the api. |
-| JWT_SECRET | no | [random] | api/bc | A string that is used to sign JWT which are created by the authenticate endpoint of the api |
-| P2P_HOST | no | | bc | The IP address of the blockchain node you want to connect to. |
-| P2P_PORT | no | 7447 | bc | The port on which the node you want to connect to has exposed the blockchain. |
-| PORT | no | 8080 for api, 8888 for excel | api/export | The port used to expose the API and excel-export for your installation. Example: If you run TruBudget locally and set API_PORT to `8080`, you can reach the API via `localhost:8080/api`. |
-| ROOT_SECRET | no | [random] | api | The root secret is the password for the root user. If you start with an empty blockchain, the root user is needed to add other users, approve new nodes,.. If you don't set a value via the environment variable, the API generates one randomly and prints it to the console
**Caution:** If you want to run TruBudget in production, make sure to set a secure root secret. |
-| RPC_PASSWORD | no | [hardcoded] | api/bc | Password used by the API to connect to the blockchain. The password is set by the origin node upon start. Every slave node needs to use the same RPC password in order to be able to connect to the blockchain.
**Hint:** Although the RPC_PASSWORD is not required it is highly recommended to set an own secure one |
-| RPC_PORT | no | 8000 | api/bc | The port used to expose the multichain daemon of your Trubudget blockchain installation(bc). The port used to connect to the multichain daemon(api). This will be used internally for the communication between the API and the multichain daemon. |
-| RPC_USER | no | multichainrpc | api/bc | The user used to connect to the multichain daemon. |
-| EXTERNAL_IP | no | | bc | The IP address with which the current node can be reached. Example: If you have a VM running on 52.52.52.52 and you want to start a slave node from this VM to connect to a master running on 53.53.53.53, you set the `EXTERNAL_IP` to 52.52.52.52 on this node. |
-| ACCESS_CONTROL_ALLOW_ORIGIN | no | "\*" | bc/api/excel/storage | Since the services use CORS, the domain by which it can be called needs to be set. Setting this value to `"*"` means that it can be called from any domain. Read more about this topic [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). |
-| MULTICHAIN_DIR | no | /root | bc | The path to the multichain folder where the blockchain data is persisted. For installations via `docker-compose`, this refers to the path within the docker container of the blockchain. For bare metal installations, this refers to the path on the machine the blockchain is running on. |
-| PRETTY_PRINT | no | true | api/bc | Decides whether the logs printed by the API are pretty printed or not. Pretty printed logs are easier to read while non-pretty printed logs are easier to store and use e.g. in the ELK (Elasticsearch-Logstash-Kabana) stack. |
-| SWAGGER_BASEPATH `deprecated` | no | / | api | This variable was used to choose which environment (prod or test) is used for testing the requests. The variable is deprecated now, as the Swagger documentation can be used for the prod and test environment separately. |
-| TAG | no | master | scripts | The tag defines the version of the image that is pulled from the docker hub. |
-| NODE_ENV | no | | ui/api | If set to `development` search Trubudget's external services on localhost, api will allow any string as password. If set to `production` disable Redux devtools extension. |
-| REACT_APP_VERSION | no | | ui | Injected version via `$npm_package_version` in`.env` file to ensure the version is shown in the frontend |
-| INLINE_RUNTIME_CHUNK | no | false | frontend | Scripts that are injected by React will not be injected inline but as script with src="...". Important for being able to enforce a stricter [Content Security Polify](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) |
-| REACT_APP_EMAIL_SERVICE_ENABLED | no | false | ui | When enabled, the frontend requests a email-service readiness call when entering the login screen.
If true the email section in the user-profile is enabled |
-| EMAIL_HOST | no | - | ui | IP address of the email notification service |
-| EMAIL_PORT | no | 8890 | ui | Port of the email notification service |
-| REACT_APP_EXPORT_SERVICE_ENABLED | no | false | ui | If true the frontend requests a export-service readiness call when entering the login screen and
the export button is shown at the side navbar |
-| EXPORT_HOST | no | - | ui | IP address of the excel export service |
-| EXPORT_PORT | no | 8888 | ui | Port of the excel export service |
-| DB_TYPE | no | pg | email | Type of database. A supported list can be found in the [Database Configuration section](#database-configuration) |
-| DB_NAME | no | trubudget_email_service | email | Name of the database |
-| DB_USER | no | postgres | email | User name for connected database |
-| DB_PASSWORD | no | test | email | Password for connected database |
-| DB_HOST | no | localhost | email | IP of connected database |
-| DB_PORT | no | 5432 | email | Port of connected database |
-| DB_SCHEMA | no | public | email | Schema of connected database |
-| DB_SSL | no | false | email | If true the DB connection is using the SSL protocol |
-| USER_TABLE | no | users | email | Name of the table which is created if the first email address is inserted |
-| SMTP_USER | no | testuser | email | This is forwarded to the auth prop of the nodemailer's transport-options, to authenticate with the credentials of the configured SMTP server |
-| SMTP_PASSWORD | no | test | email | IP of external SMTP-Server used to actually send notification emails |
-| SMTP_HOST | no | localhost | email | IP of external SMTP-Server used to actually send notification emails |
-| SMTP_PORT | no | 2500 | email | Port of external SMTP-Server |
-| SMTP_SSL | no | false | email | If true the external SMTP-Server connection is using the SSL protocol |
-| SQL_DEBUG | no | false | email | The SQL Debug option is forwarded to the knex configuration |
-| EMAIL_FROM | no | Trubudget Notification Service👻 | email | This is injected into the `from` field of the email notification |
-| EMAIL_SUBJECT | no | Trubudget Notificaiton | email | This is injected into the `subject` field of the email notification |
-| EMAIL_TEXT | no | You have received a notification. | email | This is injected into the `body` of the email notification |
-| LOG_LEVEL | no | info | all | Defines the log output. Supported levels are `trace`, `debug`, `info`, `warn`, `error`, `fatal` |
-| PRETTY_PRINT | no | false | email | Decides whether the logs printed by the email service are pretty printed or not. |
-| JWT_SECRET | no | - (required) | email | A secret of min length of 32 - It is used to verify the JWT_TOKEN sent by users of the email-service endpoints |
-| AUTHENTICATION | no | JWT | email | If set to none, no JWT-Token is required for all endpoints. If set JWT, a JWT token is necessary |
-| STORAGE_SERVICE_HOST | no | localhost | storage | IP address of storage service |
-| STORAGE_SERVICE_PORT | no | 8090 | storage | Port of storage service |
-| MINIO_ACCESS_KEY | no | minio | storage | Access key for Minio server |
-| MINIO_SECRET_KEY | no | minio123 | storage | Secret (Password) for Minio server |
-| MINIO_PORT | no | 9000 | storage | Port of connected Minio |
-| MINIO_HOST | no | localhost | storage | IP address of connected Minio server |
-| MINIO_BUCKET_NAME | no | trubudget | storage | Bucket name of the connected Minio server |
+| Env Variable | Required | Default Value | Used by | Description |
+| ---------------------------------- | -------- | --------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ---------------------------------------------------------------------------------------------------------------- |
+| ORGANIZATION | yes | - | bc/api | In the blockchain network, each node is represented by its organization name. This environment variable sets this organization name. It is used to create the organization stream on the blockchain and is also displayed in the frontend's top right corner. |
+| ORGANIZATION_VAULT_SECRET | yes | - | api | This is the key to en-/decrypt user data of an organization. If you want to add a new node for your organization, you want users to be able to log in on either node. Make sure that the api connected to the new node has the same organization vault secret.
**Caution:** If you want to run TruBudget in production,make sure NOT to use the default value from the `.env_example` file! |
+| API_HOST | no | | bc/prov | The IP address of one api which is connected to the node you want to connect to (The IP addresses are usually the same as for the P2P host address). |
+| API_PORT | no | 8080 | bc/prov | The port used to connect to the api. |
+| JWT_SECRET | no | [random] | api/bc | A string that is used to sign JWT which are created by the authenticate endpoint of the api |
+| P2P_HOST | no | | bc | The IP address of the blockchain node you want to connect to. |
+| P2P_PORT | no | 7447 | bc | The port on which the node you want to connect to has exposed the blockchain. |
+| PORT | no | 8080 for api, 8888 for excel | api/export | The port used to expose the API and excel-export for your installation. Example: If you run TruBudget locally and set API_PORT to `8080`, you can reach the API via `localhost:8080/api`. |
+| ROOT_SECRET | no | [random] | api | The root secret is the password for the root user. If you start with an empty blockchain, the root user is needed to add other users, approve new nodes,.. If you don't set a value via the environment variable, the API generates one randomly and prints it to the console
**Caution:** If you want to run TruBudget in production, make sure to set a secure root secret. |
+| RPC_PASSWORD | no | [hardcoded] | api/bc | Password used by the API to connect to the blockchain. The password is set by the origin node upon start. Every slave node needs to use the same RPC password in order to be able to connect to the blockchain.
**Hint:** Although the RPC_PASSWORD is not required it is highly recommended to set an own secure one |
+| RPC_PORT | no | 8000 | api/bc | The port used to expose the multichain daemon of your Trubudget blockchain installation(bc). The port used to connect to the multichain daemon(api). This will be used internally for the communication between the API and the multichain daemon. |
+| RPC_USER | no | multichainrpc | api/bc | The user used to connect to the multichain daemon. |
+| EXTERNAL_IP | no | | bc | The IP address with which the current node can be reached. Example: If you have a VM running on 52.52.52.52 and you want to start a slave node from this VM to connect to a master running on 53.53.53.53, you set the `EXTERNAL_IP` to 52.52.52.52 on this node. |
+| ACCESS_CONTROL_ALLOW_ORIGIN | no | "\*" | bc/api/excel/storage | Since the services use CORS, the domain by which it can be called needs to be set. Setting this value to `"*"` means that it can be called from any domain. Read more about this topic [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). |
+| MULTICHAIN_DIR | no | /root | bc | The path to the multichain folder where the blockchain data is persisted. For installations via `docker-compose`, this refers to the path within the docker container of the blockchain. For bare metal installations, this refers to the path on the machine the blockchain is running on. |
+| PRETTY_PRINT | no | true | api/bc | Decides whether the logs printed by the API are pretty printed or not. Pretty printed logs are easier to read while non-pretty printed logs are easier to store and use e.g. in the ELK (Elasticsearch-Logstash-Kabana) stack. |
+| SWAGGER_BASEPATH `deprecated` | no | / | api | This variable was used to choose which environment (prod or test) is used for testing the requests. The variable is deprecated now, as the Swagger documentation can be used for the prod and test environment separately. |
+| TAG | no | master | scripts | The tag defines the version of the image that is pulled from the docker hub. |
+| NODE_ENV | no | | ui/api | If set to `development` search Trubudget's external services on localhost, api will allow any string as password. If set to `production` disable Redux devtools extension. |
+| REACT_APP_VERSION | no | | ui | Injected version via `$npm_package_version` in`.env` file to ensure the version is shown in the frontend |
+| INLINE_RUNTIME_CHUNK | no | false | frontend | Scripts that are injected by React will not be injected inline but as script with src="...". Important for being able to enforce a stricter [Content Security Polify](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) |
+| REACT_APP_EMAIL_SERVICE_ENABLED | no | false | ui | When enabled, the frontend requests a email-service readiness call when entering the login screen.
If true the email section in the user-profile is enabled |
+| EMAIL_HOST | no | - | ui | IP address of the email notification service |
+| EMAIL_PORT | no | 8890 | ui | Port of the email notification service |
+| REACT_APP_EXPORT_SERVICE_ENABLED | no | false | ui | If true the frontend requests a export-service readiness call when entering the login screen and
the export button is shown at the side navbar |
+| EXPORT_HOST | no | - | ui | IP address of the excel export service |
+| EXPORT_PORT | no | 8888 | ui | Port of the excel export service |
+| REACT_APP_LOGGING | no | false | ui | When enabled, the log/erro messages on the frontend are send back to the logging-serverice |
+| REACT_APP_LOG_LEVEL | no | trace | ui | Values are: info | error | trace. When set to trace all state transitions of the ui are loged to console & sent back to the logging-service |
+| REACT_APP_LOGGING_SERVICE_HOST | no | localhost | ui | Host of the logging-service |
+| REACT_APP_LOGGING_SERVICE_PORT | no | 3000 | ui | Port on wich the logging-service is listening |
+| REACT_APP_LOGGING_SERVICE_HOST_SSL | no | false | ui | Defines wheather the frontend logger uses SSL to comunicate with the logging-service. When used in production, SSL _must_ be enabled! |
+| DB_TYPE | no | pg | email | Type of database. A supported list can be found in the [Database Configuration section](#database-configuration) |
+| DB_NAME | no | trubudget_email_service | email | Name of the database |
+| DB_USER | no | postgres | email | User name for connected database |
+| DB_PASSWORD | no | test | email | Password for connected database |
+| DB_HOST | no | localhost | email | IP of connected database |
+| DB_PORT | no | 5432 | email | Port of connected database |
+| DB_SCHEMA | no | public | email | Schema of connected database |
+| DB_SSL | no | false | email | If true the DB connection is using the SSL protocol |
+| USER_TABLE | no | users | email | Name of the table which is created if the first email address is inserted |
+| SMTP_USER | no | testuser | email | This is forwarded to the auth prop of the nodemailer's transport-options, to authenticate with the credentials of the configured SMTP server |
+| SMTP_PASSWORD | no | test | email | IP of external SMTP-Server used to actually send notification emails |
+| SMTP_HOST | no | localhost | email | IP of external SMTP-Server used to actually send notification emails |
+| SMTP_PORT | no | 2500 | email | Port of external SMTP-Server |
+| SMTP_SSL | no | false | email | If true the external SMTP-Server connection is using the SSL protocol |
+| SQL_DEBUG | no | false | email | The SQL Debug option is forwarded to the knex configuration |
+| EMAIL_FROM | no | Trubudget Notification Service👻 | email | This is injected into the `from` field of the email notification |
+| EMAIL_SUBJECT | no | Trubudget Notificaiton | email | This is injected into the `subject` field of the email notification |
+| EMAIL_TEXT | no | You have received a notification. | email | This is injected into the `body` of the email notification |
+| LOG_LEVEL | no | info | all | Defines the log output. Supported levels are `trace`, `debug`, `info`, `warn`, `error`, `fatal` |
+| PRETTY_PRINT | no | false | email | Decides whether the logs printed by the email service are pretty printed or not. |
+| JWT_SECRET | no | - (required) | email | A secret of min length of 32 - It is used to verify the JWT_TOKEN sent by users of the email-service endpoints |
+| AUTHENTICATION | no | JWT | email | If set to none, no JWT-Token is required for all endpoints. If set JWT, a JWT token is necessary |
+| STORAGE_SERVICE_HOST | no | localhost | storage | IP address of storage service |
+| STORAGE_SERVICE_PORT | no | 8090 | storage | Port of storage service |
+| MINIO_ACCESS_KEY | no | minio | storage | Access key for Minio server |
+| MINIO_SECRET_KEY | no | minio123 | storage | Secret (Password) for Minio server |
+| MINIO_PORT | no | 9000 | storage | Port of connected Minio |
+| MINIO_HOST | no | localhost | storage | IP address of connected Minio server |
+| MINIO_BUCKET_NAME | no | trubudget | storage | Bucket name of the connected Minio server |
+| LOGGER_PORT | yes | 3000 | logging | Port where the logging-service is exposed |
+| API_HOST | yes | localhost | logging | API host |
+| API_PORT | yes | 8080 | logging | API port |
+| LOG_LEVEL | yes | trace | logging | Log-level |
+| NODE_ENV | yes | production | logging | Environment |