UNPKG

10.4 kBMarkdownView Raw
1# Contents
2
3- [The QEWD-Up Configuration File](#the-qewd-up-configuration-file)
4- [Using QEWD-Up Configuration Default Settings](#using-qewd-up-configuration-default-settings)
5- [Over-riding QEWD Startup Default Values](#over-riding-qewd-startup-default-values)
6 - [Native Monolith](#native-monolith)
7 - [Docker Monolith](#docker-monolith)
8 - [Docker MicroServices](#docker-microservices)
9 - [QEWD Startup Properties](#qewd-startup-properties)
10- [Specifying Your MicroService Instances](#specifying-your-microservice-instances)
11
12# The QEWD-Up Configuration File
13
14The overall physical configuration of a QEWD-Up system is defined in the */configuration/config.json* file.
15
16The *config.json* file **MUST** contain only a single object, specified using valid JSON syntax (eg property names must be double quoted, as must string values).
17
18Amongst other things, the *config.json* file tells QEWD:
19
20- to use the QEWD-Up extension/abstraction;
21- the startup configuration of each QEWD instance in your system, eg:
22 - the type of Global Storage database that will be integrated as persistent JavaScript Object storage
23 - the maximum number of QEWD Worker processes that each QEWD instance can use
24- the physical locations of any QEWD MicroService instances, in terms of their IP addresses/domain names and listening TCP/IP ports.
25
26# Using QEWD-Up Configuration Default Settings
27
28QEWD-Up will use sensible default values for any unspecified properties, so your *config.json* file can usually be fairly simple, and just specify any deviations you want from the defaults.
29
30Indeed, in the case of a Native Monolithic application, you can run QEWD-Up without any *config.json* file at all, in which case QEWD-Up will use all of its default settings.
31
32In the case of Docker Monolith or Docker MicroService QEWD-Up systems, as a minimum you must have a *config.json* file that contains:
33
34 {
35 "qewd_up": true
36 }
37
38
39QEWD-Up will apply the following defaults:
40
41- YottaDB (currently v1.22) will be assumed to be the available Global Storage database;
42- QEWD will listen on port 8080 (which should be mapped to an external port if using the Docker version)
43- the maximum Worker pool size will be 2
44- the name of the QEWD instance (as displayed by the *qewd-monitor* application will be *QEWD Server*
45- the *QEWD Management Password* (as used by the *qewd-monitor* application will be *keepThisSecret!*
46- QEWD will automatically add CORS response headers
47- QEWD will use Express as its externally-facing web server, along with the standard Express *body-parser* which will be configured for JSON request processing
48
49
50# Over-riding QEWD Startup Default Values
51
52The means by which you override QEWD startup settings depends on the QEWD-Up Mode you are using.
53
54## Native Monolith
55
56Your *config.json* file should include the *qewd* sub-object, within which you define your QEWD startup over-ride values. For example:
57
58
59 {
60 "qewd": {
61 "port": 3000,
62 "poolSize": 4
63 }
64 }
65
66
67The Native QEWD instance will listen on port 3000 and will use a maximum of 4 Worker processes. QEWD-Up will apply its defaults to all other settings.
68
69
70## Docker Monolith
71
72Your *config.json* file should include the *qewd* sub-object, within which you define your QEWD startup over-ride values. For example:
73
74
75 {
76 "qewd-up": true,
77 "qewd": {
78 "poolSize": 4
79 }
80 }
81
82
83The Dockerised QEWD instance will use a maximum of 4 Worker processes. QEWD-Up will apply its defaults to all other settings.
84
85
86## Docker MicroServices
87
88The overall *config.json* structure allows you to define the configuration settings for the *orchestrator* instance and for each of your MicroService instances:
89
90 {
91 "qewd-up": true,
92 "orchestrator": {
93 // Orchestrator configuration settings
94 },
95 microservices: [
96 {
97 // configuration of first MicroService instance
98 },
99 // ..etc
100 ]
101 }
102
103
104You can specify any QEWD configuration over-ride values for the *Orchestrator* instance and/or any of the MicroService instances by using the *qewd* sub-object, within which you define your QEWD startup over-ride values. For example:
105
106
107 {
108 "qewd-up": true,
109 "orchestrator": {
110 "qewd": {
111 "serverName": "Orchestrator"
112 "poolSize": 4
113 }
114 },
115 microservices: [
116 {
117 "qewd": {
118 "serverName": "MicroService 1"
119 "poolSize": 6
120 }
121 }
122 ]
123 }
124
125
126The Dockerised QEWD instance will use a maximum of 4 Worker processes. QEWD-Up will apply its defaults to all other settings.
127
128
129## QEWD Startup Properties
130
131There are many QEWD startup configuration settings available, but many are of little if any use within a QEWD-Up environment, and it is recommended that you apply as few overrides as possible, unless you really understand the inner-workings of QEWD.
132
133If you're interested, you'll see how the full range of startup configuration settings [is defined and applied in this QEWD module which starts the Master process](https://github.com/robtweed/qewd/blob/master/lib/master.js#L92).
134
135Of the available properties, it is recommended you limit your overrides to the following ones:
136
137- **managementPassword**: specifies the *QEWD Management Password* which is primarily used for logging into the *qewd-monitor* application. Default: *keepThisSecret!*
138- **serverName**: controls the QEWD instance name that is displayed in the *qewd-monitor Overview* screen. Default: *QEWD Server*
139- **port**: the TCP/IP port on which the QEWD instance will listen. Default: *8080*. This property is really only applicable to the Native Monolith mode. When using the Docker modes, you will map the QEWD listener port to an external one anyway, so you might as well use the default value for the port on which QEWD listens within the QEWD Docker Container
140- **poolSize**: the maximum number of Worker processes that QEWD will startup and run concurrently. Default: *2*
141- **database**: defines the Global Storage database that will be integrated with the QEWD instance to provide persistent JSON storage. This is done using one or two sub-properties:
142
143 - **type**: the Global Storage database type. Default: *gtm* (which, for historical reasons, is the type that is used to specify [YottaDB](https://yottadb.com/)). Other possible values include:
144
145 - *cache*: InterSystems Cache or Ensemble
146 - *iris*: InterSystems IRIS Data Platform
147 - *redis*: [Redis-based Global Storage emulation](https://github.com/robtweed/ewd-redis-globals)
148
149 - **params**: If you have specified a *type* of *redis*, *cache* or *iris*, you will need to provide the connection parameters in this sub-object. For *redis*, you may need to specify the *host* IP address and *port* (if you're running Redis on a separate server and/or using a non-default listener port). For *cache* and *iris*, you'll need to specify the manager directory *path*, *namespace*, *username* and *password*. [See this example](https://github.com/robtweed/qewd/blob/master/up/examples/cache/microservices/configuration/config.json).
150
151- **bodyParser**: use this to specify an alternative Body Parser module from the standard Express one. Alternatively, if you want to custom-configure the standard Body Parser module, you should specify set this property with a value of *body-paser*. [See here for more details](https://github.com/robtweed/qewd/blob/master/up/docs/Life_Cycle_Events.md#addmiddleware)
152
153
154# Specifying Your MicroService Instances
155
156This section is only relevant if you're using QEWD-Up's Docker MicroService mode.
157
158You don't need to do anything further to configure your Orchestrator - when you start up the Orchestrator Docker Container, it will be listening on the port you mapped in your *docker run* command for incoming REST requests.
159
160However, the Orchestrator needs to know how to make its connections to your MicroService instances. This is done using the *microservices* array within your *config.json* file. You define each MicroService using an object, the properties of which will depend on your physical networking set-up. At least one property is mandatory:
161
162- **name**: The name of your MicroService. It's up to you what you call it. The name should start with an alphabetic character and otherwise contain alphanumeric characters and/or _ (underscore) or - (hyphen) characters.
163
164If your MicroService Docker instances are not co-located on the same host, you will also need to specify:
165
166- **host**: The IP address or domain name of the system hosting the Docker container
167- **port**: The port on which the MicroService Docker container is listening
168
169See [here for further details](https://github.com/robtweed/qewd/blob/master/up/docs/MicroServices.md#separately-hosted-qewd-microservices).
170
171Optionally, as described above, you can define any QEWD startup default configuration over-rides via the *qewd* sub-object within the MicroService configuration object.
172
173For example:
174
175 {
176 "qewd-up": true,
177 "orchestrator": {
178 "qewd": {
179 "serverName": "QEWD Orchestrator"
180 }
181 }
182 "microservices": [
183 {
184 "name": "login_service",
185 "qewd": {
186 "serverName": "Login MicroService"
187 }
188 },
189 {
190 "name": "info_service",
191 "qewd": {
192 "serverName": "Info MicroService"
193 }
194 }
195 ]
196 }
197
198In this example, the Orchestrator will connect to two MicroService QEWD Docker Containers named *login_service* and *info_service* respectively, both hosted on the same host as the *Orchestrator*. See [here for further details on setting up co-hosted MicroServices](https://github.com/robtweed/qewd/blob/master/up/docs/MicroServices.md#co-hosted-qewd-microservices).
199
200**IMPORTANT**: the MicroService names that you specify in the *config.json* file **must** match those referenced within your [*routes.json*](https://github.com/robtweed/qewd/blob/master/up/docs/Routes.md) file.
201
202
203