You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -43,7 +43,7 @@ Here you should provide a short summary of the purpose of this microservice.
43
43
44
44
We recommend using the provided Docker container.
45
45
46
-
A pre-built version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/my-microservice):
46
+
A pre-built version is available on [Docker Hub](https://hub.docker.com/repository/docker/ghga/my-microservice):
47
47
```bash
48
48
docker pull ghga/my-microservice:0.1.0
49
49
```
@@ -54,11 +54,11 @@ Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
54
54
docker build -t ghga/my-microservice:0.1.0 .
55
55
```
56
56
57
-
For production-ready deployment, we recommend using Kubernetes, however,
58
-
for simple use cases, you could execute the service using docker
57
+
For production-ready deployment, we recommend using Kubernetes.
58
+
However for simple use cases, you could execute the service using docker
59
59
on a single server:
60
60
```bash
61
-
# The entrypoint is preconfigured:
61
+
# The entrypoint is pre-configured:
62
62
docker run -p 8080:8080 ghga/my-microservice:0.1.0 --help
63
63
```
64
64
@@ -77,184 +77,125 @@ my_microservice --help
77
77
78
78
The service requires the following configuration parameters:
79
79
- <aid="properties/log_level"></a>**`log_level`***(string)*: The minimum log level to capture. Must be one of: "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", or "TRACE". Default: `"INFO"`.
80
-
81
80
- <aid="properties/service_name"></a>**`service_name`***(string)*: Short name of this service. Default: `"my_microservice"`.
82
-
83
81
- <aid="properties/service_instance_id"></a>**`service_instance_id`***(string, required)*: A string that uniquely identifies this instance across all instances of this service. This is included in log messages.
84
82
85
-
86
83
Examples:
87
-
88
84
```json
89
85
"germany-bw-instance-001"
90
86
```
91
87
92
-
93
88
- <aid="properties/log_format"></a>**`log_format`**: If set, will replace JSON formatting with the specified string format. If not set, has no effect. In addition to the standard attributes, the following can also be specified: timestamp, service, instance, level, correlation_id, and details. Default: `null`.
- <aid="properties/log_traceback"></a>**`log_traceback`***(boolean)*: Whether to include exception tracebacks in log messages. Default: `true`.
115
-
116
103
- <aid="properties/host"></a>**`host`***(string)*: IP of the host. Default: `"127.0.0.1"`.
117
-
118
104
- <aid="properties/port"></a>**`port`***(integer)*: Port to expose the server on the specified host. Default: `8080`.
119
-
120
105
- <aid="properties/auto_reload"></a>**`auto_reload`***(boolean)*: A development feature. Set to `True` to automatically reload the server upon code changes. Default: `false`.
121
-
122
106
- <aid="properties/workers"></a>**`workers`***(integer)*: Number of workers processes to run. Default: `1`.
123
-
124
107
- <aid="properties/api_root_path"></a>**`api_root_path`***(string)*: Root path at which the API is reachable. This is relative to the specified host and port. Default: `""`.
125
-
126
108
- <aid="properties/openapi_url"></a>**`openapi_url`***(string)*: Path to get the openapi specification in JSON format. This is relative to the specified host and port. Default: `"/openapi.json"`.
127
-
128
109
- <aid="properties/docs_url"></a>**`docs_url`***(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`.
129
-
130
110
- <aid="properties/cors_allowed_origins"></a>**`cors_allowed_origins`**: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin. Default: `null`.
- <aid="properties/cors_allow_credentials"></a>**`cors_allow_credentials`**: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified. Default: `null`.
- <aid="properties/cors_allowed_methods"></a>**`cors_allowed_methods`**: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods. Default: `null`.
- <aid="properties/cors_allowed_headers"></a>**`cors_allowed_headers`**: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all request headers. The Accept, Accept-Language, Content-Language, Content-Type and some are always allowed for CORS requests. Default: `null`.
- <aid="properties/cors_exposed_headers"></a>**`cors_exposed_headers`**: A list of HTTP response headers that should be exposed for cross-origin responses. Defaults to []. Note that you can NOT use ['*'] to expose all response headers. The Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified and Pragma headers are always exposed for CORS responses. Default: `null`.
- <aid="properties/generate_correlation_id"></a>**`generate_correlation_id`***(boolean)*: A flag, which, if False, will result in an error when inbound requests don't possess a correlation ID. If True, requests without a correlation ID will be assigned a newly generated ID in the correlation ID middleware function. Default: `true`.
227
173
228
-
229
174
Examples:
230
-
231
175
```json
232
176
true
233
177
```
234
178
235
-
236
179
```json
237
180
false
238
181
```
239
182
240
-
241
183
- <aid="properties/language"></a>**`language`***(string)*: The language. Must be one of: "Greek", "Croatian", "French", or "German". Default: `"Croatian"`.
242
184
243
-
244
185
### Usage:
245
186
246
-
A template YAML for configuring the service can be found at
187
+
A template YAML file for configuring the service can be found at
247
188
[`./example_config.yaml`](./example_config.yaml).
248
189
Please adapt it, rename it to `.my_microservice.yaml`, and place it in one of the following locations:
249
190
- in the current working directory where you execute the service (on Linux: `./.my_microservice.yaml`)
250
191
- in your home directory (on Linux: `~/.my_microservice.yaml`)
251
192
252
-
The config yaml will be automatically parsed by the service.
193
+
The config YAML file will be automatically parsed by the service.
253
194
254
195
**Important: If you are using containers, the locations refer to paths within the container.**
255
196
256
197
All parameters mentioned in the [`./example_config.yaml`](./example_config.yaml)
257
-
could also be set using environment variables or file secrets.
198
+
can also be set using environment variables or file secrets.
258
199
259
200
For naming the environment variables, just prefix the parameter name with `my_microservice_`,
260
201
e.g. for the `host` set an environment variable named `my_microservice_host`
@@ -296,12 +237,12 @@ This will give you a full-fledged, pre-configured development environment includ
296
237
- a pre-configured debugger
297
238
- automatic license-header insertion
298
239
299
-
Moreover, inside the devcontainer, a command `dev_install` is available for convenience.
240
+
Inside the devcontainer, a command `dev_install` is available for convenience.
300
241
It installs the service with all development dependencies, and it installs pre-commit.
301
242
302
243
The installation is performed automatically when you build the devcontainer. However,
303
244
if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the
304
-
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), please run it again.
245
+
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), run it again.
0 commit comments