Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AppFw configuration guide for extenders #3240

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
29 changes: 9 additions & 20 deletions docs/extend/extend-desktop/mvd-logutility.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

The `zlux-shared` repository provides a logging utility for use by dataservices and web content for an application plug-in.

1. [Logging Objects](#logging-objects)
1. [Logger IDs](#logger-ids)
1. [Accessing Logger Objects](#accessing-logger-objects)
1. [Logger](#logger)
1. [App Server](#app-server)
1. [Web](#web)
1. [Component Logger](#component-logger)
1. [App Server](#app-server-1)
1. [Logger API](#logger-api)
1. [Component Logger API](#component-logger-api)
1. [Log Levels](#log-levels)
1. [Logging Verbosity](#logging-verbosity)
1. [Configuring Logging Verbosity](#configuring-logging-verbosity)
1. [Server Startup Logging Configuration](#server-startup-logging-configuration)
1. [Using log message IDs](#using-log-message-ids)


## Logging objects

Expand Down Expand Up @@ -57,7 +41,6 @@ Component loggers are created from the core logger object, but when working with

See **Router Dataservice Context** in the topic [Dataservices](mvd-dataservices.md).


## Logger API

The following constants and functions are available on the central logging object.
Expand Down Expand Up @@ -105,8 +88,11 @@ An enum, `LogLevel`, exists for specifying the verbosity level of a logger. The
| FINER | 4
| TRACE | 5

**Note:** The default log level for a logger is **INFO**.
:::note

The default log level for a logger is **INFO**.

:::

## Logging verbosity

Expand All @@ -123,9 +109,10 @@ The application plug-in framework provides ways to specify what component logger

#### Server startup logging configuration

[The server configuration file](https://github.com/zowe/zlux/wiki/Configuration-for-zLUX-App-Server-&-ZSS) allows for specification of default log levels, as a top-level attribute `logLevel`, which takes key-value pairs where the key is a regex pattern for component IDs, and the value is an integer for the log levels.
[The server configuration file](mvd-server-config.md) allows for specification of default log levels, as a top-level attribute `logLevel`, which takes key-value pairs where the key is a regex pattern for component IDs, and the value is an integer for the log levels.

For example:

```
"logLevel": {
"com.rs.configjs.data.access": 2,
Expand All @@ -138,9 +125,11 @@ For example:
//"_unp.dsauth": 2
},
```

For more information about the server configuration file, see [Zowe Application Framework (zLUX) configuration](../../user-guide/mvd-configuration#configuration-file).

## Using log message IDs

To make technical support for your application easier, create IDs for common log messages and use substitution to generate them. When you use IDs, people fielding support calls can identify and solve problems more quickly. IDs are particularly helpful if your application is translated, because it avoids users having to explain problems using language that the tech support person might not understand.

To use log message IDs, take the following steps:
Expand Down Expand Up @@ -178,7 +167,7 @@ To use log message IDs, take the following steps:
```
DATE TIME:TIME:TIME.TIME <ZWED:> username INFO (org.zowe.app.name,:) A001 - Приложение создано.
```

### Message ID logging examples

Server core: https://github.com/zowe/zlux-server-framework/blob/v2.x/master/plugins/config/lib/assets/i18n/log/messages_en.json
121 changes: 68 additions & 53 deletions docs/extend/extend-desktop/mvd-server-config.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# Advanced Server Configuration

The Zowe's App Server and ZSS rely on many required or optional parameters to run, which includes setting up networking, deployment directories, plugin locations, and more.
1000TurquoisePogs marked this conversation as resolved.
Show resolved Hide resolved
These parameters can be specified in multiple ways: configuration files, CLI arguments, or environment variables.

Every configuration option and requirement is documented within the application framework [json-schema file](https://github.com/zowe/zlux/blob/v2.x/staging/schemas/zlux-config-schema.json)
## Configuration file

The servers use a YAML file for configuration. The [global schema](https://github.com/zowe/zowe-install-packaging/blob/v2.x/staging/schemas/zowe-yaml-schema.json) describes the parts of configuration that are common between servers.

The App Server specifically is configured by the `components.app-server` section of the YAML, and that section follows [this App-server schema](https://github.com/zowe/zlux-app-server/blob/v2.x/staging/schemas/app-server-config.json).

ZSS is instead configured by the `components.zss` section, following [the ZSS schema](https://github.com/zowe/zss/blob/v2.x/staging/schemas/zss-config.json).

# Configuration file
In Zowe's server configuration file, app-server parameters can be specified within `components.app-server` as shown in the component [json-schema file](https://github.com/zowe/zlux/blob/v2.x/staging/schemas/zowe-schema.json), or `components.zss` for ZSS.
The App server can additionally use CLI arguments or environment variables to override the YAML file.

## Environment variables (app-server only)

# Environment variables
CLI arguments take precedence over the configuration file, but are overridden by the CLI arguments.
The format is `ZWED_key=value`, where "ZWED_" is a prefix for any configuration object.
The key maps to a YAML object attribute, so to set the value of a nested object, such as the https configuration, you need multiple values.
The format is `ZWED_key=value`, where `WED_` is a prefix for any configuration object.

The attributes specified will be put within the `components.app-server` subsection of the Zowe configuration.

The key maps to a JSON object attribute, so to set the value of a nested object, such as the https configuration, you need multiple values.

For example:
```
node:
Expand Down Expand Up @@ -37,34 +48,32 @@ ZWED_logLevels_org____zowe____terminal____tn3270_x2e_x2a:5
```

**The key names are syntax sensitive.**
* They are case-sensitive
* All ascii characters except " are allowed in the object attribute names.
* An encoding scheme is used for many symbols because environment variables can only have names with the characters A-Z, a-z, 0-9, `_`, `.`, and `-`
* The scheme is _x followed by 2 hex numbers will be converted to the corresponding ASCII character, such as _x41 mapping to `A`
* _ is used as the object separator, so an escape sequence is used if `_` is actually needed for the key.
* Single leading and trailing _ are treated as literal `_`
* __ will be maps to literal `_`
* ___ maps to literal `-`
* ____ maps to literal `.`
* They are case-sensitive.
* All ASCII characters except `"` are allowed in the object attribute names.
* An encoding scheme is used for many symbols because environment variables can only have names with the characters `A`-`Z`, `a`-`z`, `0`-`9`, `_`, `.`, and `-`.
* The scheme is _x followed by 2 hex numbers will be converted to the corresponding ASCII character, such as _x41 mapping to `A`.
* `_` is used as the object separator, so an escape sequence is used if `_` is actually needed for the key.
* Single leading and trailing _ are treated as literal `_`.
* `__` will be maps to literal `_`
* `___` maps to literal `-`
* `____` maps to literal `.`

**The types of the values are syntax-sensitive.**
* Numbers are treated as numbers, not strings.
* false & true are treated as boolean.
* commas are for arrays. An array of length 1 has a comma at the end
* strings can have quotes, but otherwise everything that isnt an array, boolean, or number is a string
* objects are never values. They are the keys.
* `false` and `true` are treated as boolean.
* Commas are for arrays. An array of length 1 has a comma at the end.
* Strings can have quotes, but otherwise everything that is not an array, boolean, or number is a string.
* Objects are never values, they are the keys.

## Friendly names for environment variables
Some common configuration options have names that do not follow the above special syntax. These options get mapped to the special syntax when the server runs, so the same behavior can be configured in more than one way. Many of these values are listed here https://docs.zowe.org/stable/user-guide/configure-zowe-zosmf-workflow/#configure-the-zowe-instance-directory.

## CLI arguments (app-server only)

Although overridden by both environment variables and CLI arguments, for convenience the App server and ZSS read from a configuration file with a common structure. ZSS reads this directly as a startup argument, while the App Server as defined in the [zlux-server-framework](https://github.com/zowe/zlux-server-framework) repository accepts several parameters which are intended to be read from a YAML file through an implementer of the server, such the default provided in the [zlux-app-server](https://github.com/zowe/zlux-app-server) repository, namely the [lib/zluxServer.js](https://github.com/zowe/zlux-app-server/blob/v2.x/master/lib/zluxServer.js) file. This file accepts a YAML file that specifies most if not all parameters needed, but some other parameters can be provided via flags if desired.
CLI arguments take precedence over environment variable and configuration files.

The format is `--key=value` and the attributes specified will be put within the `components.app-server` subsection of the Zowe configuration.

# CLI arguments (app-server only)
CLI arguments take precedence over environment variable and configuration files.
The format is `--key=value`
The key maps to a YAML object attribute, so to set the value of a nested object, such as the https configuration, you need multiple period-separated values.

For example:
```
node:
Expand All @@ -84,23 +93,30 @@ node.https.keys="../defaults/serverConfig/server.key"
node.https.certificates="../defaults/serverConfig/server.cert"
```

**NOTE: ZSS does not support CLI arguments**
:::note

**The key name is case-sensitive.**
ZSS does not support CLI arguments.

:::

**The key names are case-sensitive.**

**The types of the values are syntax-sensitive.**
* Numbers are treated as numbers, not strings.
* false & true are treated as boolean.
* commas are for arrays. An array of length 1 has a comma at the end
* strings can have quotes, but otherwise everything that isn't an array, boolean, or number is a string
* objects are never values. They are the keys.
* `false` and `true` are treated as boolean.
* Commas are for arrays. An array of length 1 has a comma at the end.
* Strings can have quotes, but otherwise everything that is not an array, boolean, or number is a string.
* Objects are never values, they are the keys.


## Parameter Details

# Parameter Details
Below is some more detail on certain parameters than can be covered within the json-schema.

## Configuration Directories
### Configuration Directories

When running, the App Server will access the server's settings and read/modify the contents of its resource storage.

All of this data is stored within a hierarchy of a few folders, which is correspond to scopes:
- Product: The contents of this folder are not meant to be modified, but used as defaults for a product.
- Site: The contents of this folder are intended to be shared across multiple App Server instances, perhaps on a network drive.
Expand All @@ -110,50 +126,49 @@ All of this data is stored within a hierarchy of a few folders, which is corresp

These directories dictate where the [Configuration Dataservice](https://github.com/zowe/zlux/wiki/Configuration-Dataservice) will store content.

### Directories example
#### Directories example

```
"productDir":"../defaults",
"siteDir":"/home/myuser/.zowe/workspace/app-server/site",
"instanceDir":"/home/myuser/.zowe/workspace/app-server",
"groupsDir":"/home/myuser/.zowe/workspace/app-server/groups",
"usersDir":"/home/myuser/.zowe/workspace/app-server/users",

```

### App configuration

## App configuration
This section does not cover any dynamic runtime inclusion of Apps, but rather Apps defined in advance.

In the configuration file, a directory can be specified which contains JSON files which tell the server what App is to be included and where to find it on disk. The backend of these Apps use the Server's Plugin structure, so much of the server-side references to Apps use the term Plugin.

To include Apps, be sure to define the location of the Plugins directory in the configuration file, via the top-level attribute *pluginsDir*

**NOTE: In this example, the directory for these JSON files is [/defaults/plugins](https://github.com/zowe/zlux-app-server/tree/v2.x/master/defaults/plugins). Yet, in order to separate configuration files from runtime files, the App Server will initialize by copying the contents of this folder into the defined instance directory, of which the default is ~/.zowe/workspace/app-server. So, the example configuration file uses the latter directory.**
:::note

In this example, the directory for these JSON files is [/defaults/plugins](https://github.com/zowe/zlux-app-server/tree/v2.x/master/defaults/plugins). Yet, in order to separate configuration files from runtime files, the App Server will initialize by copying the contents of this folder into the defined instance directory, of which the default is ~/.zowe/workspace/app-server. So, the example configuration file uses the latter directory.

:::

#### Plug-ins directory example

### Plugins directory example
```
// All paths relative to zlux-app-server/lib
// In real installations, these values will be configured during the install.
//...
"pluginsDir":"../defaults/plugins",
```

## Logging configuration
### Logging configuration

For more information, see [Logging Utility](mvd-logutility.md).

## ZSS Configuration
When running ZSS, it will require a configuration file similar or the same as the one used for the App Server. The attributes that are needed for ZSS, at minimum, are: *productDir*, *siteDir*, *instanceDir*, *groupsDir*, *usersDir*, *pluginsDir* and **agent**. All of these attributes have the same meaning as described above for the App server, but if the App server and ZSS are not run from the same location, then these directories may be different if desired.
### ZSS Configuration

### ZSS Networking
ZSS is configured by the same Zowe YAML file used by the App server, within the `components.zss` section of the file. The [ZSS schema for components.zss be found here](https://github.com/zowe/zss/blob/v2.x/staging/schemas/zss-config.json). More information about the configuration can be found in its [README file](https://github.com/zowe/zss/#quick-run-how-to-start-zss).

The attributes that control ZSS exclusively are within the **agent** object. ZSS uses HTTPS by default, but for those who wish to use AT-TLS instead of the built-in HTTPS support, ZSS can use HTTP as well. HTTP should never be used without [AT-TLS](../../user-guide/mvd-configuration#defining-the-at-tls-rule), as this is a security risk. The values `agent.https.port`, `agent.http.port` tell ZSS which ports to bind to, but also where the app-server can find ZSS. The values `agent.host` is used to tell app-server where to find ZSS as well, though `agent.https.ipAddresses` and `agent.http.ipAddresses` tell ZSS which addresses to bind to. For addresses, at this time only the first value of that array is used, and it may either be a hostname or an ipv4 address.
#### Connecting ZSS to App Server

Example of the agent body:
```
agent:
host: localhost
https:
ipAddresses: 0.0.0.0
port: 7557

```
The App Server can connect to ZSS either directly or through the API Mediation Layer Gateway when that is running.

The connection information is stored within the object `components.app-server.agent`, which describes whether the Gateway is involved, or if not, on which host and port can ZSS be found. For more information, see the [agent section of the schema](https://github.com/zowe/zlux-app-server/blob/c22105381e129bd999c47e838b424679eba26aa6/schemas/app-server-config.json#L262)
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ module.exports = {
type: "category",
label: "Developing for Zowe Application Framework",
items: [
"extend/extend-desktop/mvd-server-config",
"extend/extend-desktop/mvd-extendingzlux",
"extend/extend-desktop/mvd-plugindefandstruct",
"extend/extend-desktop/mvd-buildingplugins",
Expand Down
Loading