Skip to content

Commit 0be62de

Browse files
Make docker compose logging options configurable (#636)
## Overview Introduce a new component `components/logging` that sets default logging options for all docker compose services started by `birdhouse-deploy`. This component is enabled by default. The default value is set by the `BIRDHOUSE_LOGGING_DEFAULT` environment variable. To change the default value, set the `BIRDHOUSE_LOGGING_DEFAULT` to a JSON string in the local environment file that contains a valid [docker compose logging configuration](https://docs.docker.com/reference/compose-file/services/#logging). For example, to set the default driver to "local" set the following in your local environment file: ```sh export BIRDHOUSE_LOGGING_DEFAULT='{"driver": "local"}' ``` You can also override logging options for a single service using environment variables using a variable `BIRDHOUSE_LOGGING_<service_name>` where `<service_name>` is the uppercase name of the docker compose service with hyphens replaced with underscores. For example, to set the default driver to "local" only for the `weaver-worker` service: ```sh export BIRDHOUSE_LOGGING_WEAVER_WORKER='{"driver": "local"}' ``` Logging options can can also be set directly in a component's ``docker-compose-extra.yml`` file. The order of precedence for logging options are as follows: 1. logging options specified by `BIRDHOUSE_LOGGING_<service_name>` environment variable 2. logging options set in a `docker-compose-extra.yml` file 3. logging options specified by `BIRDHOUSE_LOGGING_DEFAULT` environment variable ## Changes **Non-breaking changes** - Adds new required component **Breaking changes** - None ## Related Issue / Discussion - Initially from: #631 (comment) ## Additional Information ## CI Operations <!-- The test suite can be run using a different DACCS config with ``birdhouse_daccs_configs_branch: branch_name`` in the PR description. To globally skip the test suite regardless of the commit message use ``birdhouse_skip_ci`` set to ``true`` in the PR description. Using ``[<cmd>]`` (with the brackets) where ``<cmd> = skip ci`` in the commit message will override ``birdhouse_skip_ci`` from the PR description. Such commit command can be used to override the PR description behavior for a specific commit update. However, a commit message cannot 'force run' a PR which the description turns off the CI. To run the CI, the PR should instead be updated with a ``true`` value, and a running message can be posted in following PR comments to trigger tests once again. --> birdhouse_daccs_configs_branch: master birdhouse_skip_ci: false
2 parents 3598375 + dfd3101 commit 0be62de

File tree

68 files changed

+101
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+101
-309
lines changed

CHANGES.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,38 @@
1717

1818
## Changes
1919

20+
- Make docker compose logging options configurable
21+
22+
Introduce a new component `components/logging` that sets default logging options for all docker
23+
compose services started by `birdhouse-deploy`. This component is enabled by default.
24+
25+
The default value is set by the `BIRDHOUSE_DOCKER_LOGGING_DEFAULT` environment variable. To change the default
26+
value, set the `BIRDHOUSE_DOCKER_LOGGING_DEFAULT` to a JSON string in the local environment file that contains
27+
a valid
28+
[docker compose logging configuration](https://docs.docker.com/reference/compose-file/services/#logging).
29+
30+
For example, to set the default driver to "local" set the following in your local environment file:
31+
32+
```sh
33+
export BIRDHOUSE_DOCKER_LOGGING_DEFAULT='{"driver": "local"}'
34+
```
35+
36+
You can also override logging options for a single service using environment variables using a variable
37+
`BIRDHOUSE_DOCKER_LOGGING_<service_name>` where `<service_name>` is the uppercase name of the docker compose
38+
service with hyphens replaced with underscores. For example, to set the default driver to "local" only for the
39+
`weaver-worker` service:
40+
41+
```sh
42+
export BIRDHOUSE_DOCKER_LOGGING_WEAVER_WORKER='{"driver": "local"}'
43+
```
44+
45+
Logging options can can also be set directly in a component's ``docker-compose-extra.yml`` file.
46+
The order of precedence for logging options are as follows:
47+
48+
1. logging options specified by `BIRDHOUSE_DOCKER_LOGGING_<service_name>` environment variable
49+
2. logging options set in a `docker-compose-extra.yml` file
50+
3. logging options specified by `BIRDHOUSE_DOCKER_LOGGING_DEFAULT` environment variable
51+
2052
- Add script that automatically updates postgres databases to a later version
2153

2254
In anticipation of upgrading postgres databases in the future, this introduces a script that automatically

birdhouse/components/README.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,3 +1040,36 @@ How to Enable the Component
10401040
---------------------------
10411041
10421042
- Do not enable this component directly. It will be enabled as a dependency of other components
1043+
1044+
logging
1045+
=======
1046+
1047+
Sets default logging options for all docker compose services started by `birdhouse-deploy`.
1048+
1049+
The default value is set by the ``BIRDHOUSE_DOCKER_LOGGING_DEFAULT`` environment variable. To change the default
1050+
value, set the ``BIRDHOUSE_DOCKER_LOGGING_DEFAULT`` to a JSON string in the local environment file that contains
1051+
a valid `docker compose logging configuration`_.
1052+
1053+
For example, to set the default driver to "local" set the following in your local environment file:
1054+
1055+
.. code::shell
1056+
1057+
export BIRDHOUSE_DOCKER_LOGGING_DEFAULT='{"driver": "local"}'
1058+
1059+
You can also override logging options for a single service using environment variables using a variable
1060+
``BIRDHOUSE_DOCKER_LOGGING_<service_name>`` where ``<service_name>`` is the uppercase name of the docker compose service
1061+
with hyphens replaced with underscores. For example, to set the default driver to "local" only for the ``weaver-worker``
1062+
service:
1063+
1064+
.. code::shell
1065+
1066+
export BIRDHOUSE_DOCKER_LOGGING_WEAVER_WORKER='{"driver": "local"}'
1067+
1068+
Logging options can can also be set directly in a component's ``docker-compose-extra.yml`` file. The order of
1069+
precedence for logging options are as follows:
1070+
1071+
1. logging options specified by ``BIRDHOUSE_DOCKER_LOGGING_<service_name>`` environment variable
1072+
2. logging options set in a ``docker-compose-extra.yml`` file
1073+
3. logging options specified by ``BIRDHOUSE_DOCKER_LOGGING_DEFAULT`` environment variable
1074+
1075+
.. _docker compose logging configuration: https://docs.docker.com/reference/compose-file/services/#logging

birdhouse/components/canarie-api/docker-compose-extra.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
2-
x-logging:
3-
&default-logging
4-
driver: "json-file"
5-
options:
6-
max-size: "50m"
7-
max-file: "10"
8-
91
services:
102
canarie-api:
113
image: ${CANARIE_IMAGE}
@@ -19,7 +11,6 @@ services:
1911
CANARIE_MONITORING_EXTRA_CONF_DIR: ${CANARIE_MONITORING_EXTRA_CONF_DIR}
2012
restart: always
2113
entrypoint: /entrypoint
22-
logging: *default-logging
2314
healthcheck:
2415
test: ["CMD", "curl", "--fail", "http://localhost:2000"]
2516
interval: 60s
@@ -44,7 +35,6 @@ services:
4435
CANARIE_MONITORING_EXTRA_CONF_DIR: ${CANARIE_MONITORING_EXTRA_CONF_DIR}
4536
restart: always
4637
entrypoint: /entrypoint
47-
logging: *default-logging
4838

4939
volumes:
5040
canarie-data:

birdhouse/components/cowbird/config/canarie-api/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
canarie-api: &canarie-volumes
43
volumes:

birdhouse/components/cowbird/config/geoserver/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
cowbird:
43
environment:

birdhouse/components/cowbird/config/magpie/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
# extend Magpie permissions to grant access to Cowbird API via secured Twitcher proxy
43
magpie:

birdhouse/components/cowbird/config/proxy/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
# extend proxy with endpoint and config for Cowbird API access
43
proxy:

birdhouse/components/cowbird/docker-compose-extra.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
2-
x-logging:
3-
&default-logging
4-
driver: "json-file"
5-
options:
6-
max-size: "50m"
7-
max-file: "10"
8-
91
services:
102
cowbird:
113
image: ${COWBIRD_IMAGE_API}
@@ -43,7 +35,6 @@ services:
4335
- ./components/cowbird/config/cowbird/celeryconfig.py:/opt/local/src/cowbird/config/celeryconfig.py
4436
- "${BIRDHOUSE_DATA_PERSIST_SHARED_ROOT}:${BIRDHOUSE_DATA_PERSIST_SHARED_ROOT}"
4537
restart: always
46-
logging: *default-logging
4738
healthcheck:
4839
test: ["CMD", "wget", "-qO-", "http://0.0.0.0:7000"]
4940
interval: 60s
@@ -79,7 +70,6 @@ services:
7970
- ./components/cowbird/config/cowbird/celeryconfig.py:/opt/local/src/cowbird/config/celeryconfig.py
8071
- "${BIRDHOUSE_DATA_PERSIST_SHARED_ROOT}/${USER_WORKSPACES}:${BIRDHOUSE_DATA_PERSIST_SHARED_ROOT}/${USER_WORKSPACES}"
8172
restart: always
82-
logging: *default-logging
8373
# TODO: create a stable healthcheck for this service (`inspect ping` or `status` is not reliable)
8474

8575
# Dedicated database for Cowbird, since other 'mongodb' image does not employ the same version.
@@ -91,7 +81,6 @@ services:
9181
volumes:
9282
- ${COWBIRD_MONGODB_DATA_DIR}:/data/db
9383
restart: always
94-
logging: *default-logging
9584
healthcheck:
9685
test: ["CMD", "mongo", "--eval", "print('connected')"]
9786
interval: 60s

birdhouse/components/dggs/config/magpie/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
magpie:
43
volumes:

birdhouse/components/dggs/config/twitcher/docker-compose-extra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
services:
32
# extend twitcher with MagpieAdapter hooks employed for DGGS proxied requests
43
twitcher:

0 commit comments

Comments
 (0)