Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
rev: v0.15.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 2 additions & 2 deletions .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ version = "0.1.0"
description = "My-Microservice - a short description"
dependencies = [
"typer >= 0.21.1",
"ghga-service-commons[api] >= 6.1",
"ghga-service-commons[api] >= 7.0",
"ghga-event-schemas ~= 11.1",
"hexkit[akafka,s3,mongodb] >= 7.3",
"hexkit[akafka,s3,mongodb] >= 8.1",
]

[project.urls]
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ RUN apk update && \
WORKDIR /service
COPY --from=builder /service/lock/requirements.txt /service
RUN pip install --no-cache-dir --no-deps -r requirements.txt
# Binaries that are needed at runtime
RUN mkdir -p /opt/runtime-bin
RUN cp /usr/local/bin/opentelemetry-instrument /opt/runtime-bin/ 2>/dev/null || true

# RUNNER: a container to run the service
FROM base AS runner
Expand All @@ -40,9 +43,9 @@ RUN adduser -D appuser
WORKDIR /service
RUN rm -rf /usr/local/lib/python3.13
COPY --from=dep-builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
COPY --from=dep-builder /opt/runtime-bin/ /usr/local/bin/
COPY --from=builder /service/dist/ /service
RUN pip install --no-cache-dir --no-deps *.whl && \
rm *.whl
RUN pip install --no-cache-dir --no-deps *.whl && rm *.whl
# switch to non-root user
WORKDIR /home/appuser
USER appuser
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

## creating building container
# creating building container
FROM python:3.13-slim-trixie AS builder
# update and install dependencies
RUN apt-get update && apt-get upgrade -y
Expand All @@ -39,12 +39,12 @@ COPY --from=builder /service/lock/requirements.txt /service
RUN pip install --no-cache-dir --no-deps -r requirements.txt && \
rm requirements.txt
COPY --from=builder /service/dist/ /service
RUN pip install --no-cache-dir --no-deps *.whl && \
rm *.whl
RUN pip install --no-cache-dir --no-deps *.whl && rm *.whl
# switch to non-root user
WORKDIR /home/appuser
USER appuser
# set environment
ENV PYTHONUNBUFFERED=1

# Please adapt to package name:
ENTRYPOINT ["my-microservice"]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ The service requires the following configuration parameters:
- <a id="properties/port"></a>**`port`** *(integer)*: Port to expose the server on the specified host. Default: `8080`.
- <a id="properties/auto_reload"></a>**`auto_reload`** *(boolean)*: A development feature. Set to `True` to automatically reload the server upon code changes. Default: `false`.
- <a id="properties/workers"></a>**`workers`** *(integer)*: Number of workers processes to run. Default: `1`.
- <a id="properties/timeout_keep_alive"></a>**`timeout_keep_alive`** *(integer)*: The time in seconds to keep an idle connection open for subsequent requests before closing it. This value should be higher than the timeout used by any client or reverse proxy to avoid premature connection closures. Default: `90`.

Examples:
```json
5
```

```json
90
```

```json
5400
```

- <a id="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: `""`.
- <a id="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"`.
- <a id="properties/docs_url"></a>**`docs_url`** *(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`.
Expand Down
11 changes: 11 additions & 0 deletions config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@
"title": "Workers",
"type": "integer"
},
"timeout_keep_alive": {
"default": 90,
"description": "The time in seconds to keep an idle connection open for subsequent requests before closing it. This value should be higher than the timeout used by any client or reverse proxy to avoid premature connection closures.",
"examples": [
5,
90,
5400
],
"title": "Timeout Keep Alive",
"type": "integer"
},
"api_root_path": {
"default": "",
"description": "Root path at which the API is reachable. This is relative to the specified host and port.",
Expand Down
1 change: 1 addition & 0 deletions example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ openapi_url: /openapi.json
port: 8080
service_instance_id: '1'
service_name: my_microservice
timeout_keep_alive: 90
workers: 1
Loading