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
3 changes: 3 additions & 0 deletions components/database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ RUN apt-get purge --yes mongodb-database-tools mongodb-org-database-tools-extra

# Run as the non-root MongoDB user by default; see README.md ("Runtime user") for overriding the UID.
USER 999

# Log less than mongod does by default; see README.md ("Logging").
CMD ["mongod", "--quiet", "--wiredTigerEngineConfigString=verbose=[]"]
16 changes: 15 additions & 1 deletion components/database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package deletes the vulnerable code outright, so it is preferred over upgrading
- **`/opt/js-yaml` and the `/js-yaml.js` symlink**, for
[GHSA-5p4m-2wfm-xmqj](https://github.com/advisories/GHSA-5p4m-2wfm-xmqj), which was never backported to the vendored
js-yaml 3.13.1 browser bundle. The entrypoint uses the bundle only for `mongod --config <file>`, a path neither the
compose file (it passes `--quiet`) nor the Helm chart (it sets no `command` or `args`) takes.
compose file nor the Helm chart (neither sets a `command` or `args`) takes.

`ncurses-bin` and `gzip` are marked essential, hence `--allow-remove-essential`; that is safe because the container
never installs packages at runtime.
Expand Down Expand Up @@ -68,6 +68,20 @@ fails the build once the base image makes the upgrade redundant. The retries mat
none, and CI builds this image in four workflows in parallel, so a single `archive.ubuntu.com` hiccup — a 503, a reset
connection, a hash sum mismatch — would abort the build with apt's exit code 100 and not reproduce.

### Logging

The `CMD` starts `mongod` with two flags that reduce its logging, because the official image starts `mongod` without
flags:

- **`--quiet`** suppresses connection events and replication activity.
- **`--wiredTigerEngineConfigString=verbose=[]`** suppresses the WiredTiger progress messages. `mongod` configures
WiredTiger with `verbose=[recovery_progress:1,checkpoint_progress:1,...]`, so WiredTiger logs several lines for every
checkpoint, which it makes every minute while data is being written, and many lines on every start-up. Info is the
lowest severity `mongod` has, so `logComponentVerbosity` can't silence these. `mongod` appends the configured string
to its own WiredTiger configuration, and the empty list replaces the generated one. WiredTiger then uses its default
level, notice, for every category, and still logs warnings and errors. Setting a category to a lower level doesn't
work, because WiredTiger rejects levels below info. Verified with `mongo:9.0.4`.

### Runtime user

The container runs as the non-root MongoDB user (UID 999) by default. Platforms that require a UID >= 1000 can override
Expand Down
1 change: 0 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ services:
cpus: '2'
database:
image: ictu/quality-time_database:${QUALITY_TIME_VERSION}
command: --quiet
environment:
- *tz
- MONGO_INITDB_ROOT_USERNAME_FILE=/run/secrets/database_username
Expand Down
2 changes: 1 addition & 1 deletion docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If your currently installed *Quality-time* version is not the penultimate versio

### Changed

- The collector, notifier, and API-server write each log message as a single line of plain text. Previously, log messages were laid out in columns and, when running in a container, wrapped to 80 columns, which made them hard to read and search. Closes [#14959](https://github.com/ICTU/quality-time/issues/14959).
- The collector, notifier, and API-server write each log message as a single line of plain text. Previously, log messages were laid out in columns and, when running in a container, wrapped to 80 columns, which made them hard to read and search. The database no longer logs the progress messages of the WiredTiger storage engine. The database image now passes the `--quiet` flag to MongoDB itself, so the database also logs less when deployed with the Helm chart. If you copied `command: --quiet` from the *Quality-time* compose file into your own compose file, you may want to remove it, as it overrides the new default. See the [deployment documentation](deployment.md#configuring-logging-optional). Closes [#14959](https://github.com/ICTU/quality-time/issues/14959).

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions docs/src/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ To configure the timezone of exported PDFs, see [configuring the timezone](#conf

## Configuring logging (optional)

The options for configuring logging are limited at the moment. The MongoDB daemon can be told to produce less logging by passing the `--quiet` flag:
The options for configuring logging are limited at the moment. To reduce its logging, the database container starts MongoDB with the `--quiet` flag, which suppresses connection events among other things, and with `--wiredTigerEngineConfigString=verbose=[]`, which suppresses the progress messages that the WiredTiger storage engine logs on start-up and every minute while data is being written. To get the default MongoDB logging, override the database command:

```yaml
database:
command: --quiet
command: mongod
```

The collector, notifier, and API-server all have log level `WARNING` as default. This can be overridden by setting an environment variable to `DEBUG`, `INFO`, `WARNING`, `ERROR` or `CRITICAL`.
Expand Down
Loading