Skip to content

Commit 6338b12

Browse files
MaghnieSBlechmann
andauthored
23 limit log files in docker compose (#24)
* feat: add global levels for log config As suggested by @SBlechmann * feat: add log config to compose file * feat: allow volume config for grafana in compose * 22 adjust context file for data interoperability use case (#26) * docs: context adjustments skamo / booster use case * docs: added MultiSensor, SensorPoint, and isPointOf * implement minimum example for building use case with multi sensor (Brick + SENSE ontologies) * feat: adapt number of logging files and add logging options for ld setup --------- Co-authored-by: Sebastian Blechmann <[email protected]> Co-authored-by: Sebastian Blechmann <[email protected]>
1 parent 30f390d commit 6338b12

File tree

8 files changed

+147
-76
lines changed

8 files changed

+147
-76
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ CrateDB requires a higher number of memory map areas.
127127
***
128128

129129
### Setup adjustments to your needs:
130-
We provide a general development setup and try to keep most of the information generic. Most of the configuration parameters of the setup can be changed either in the `.yml` files directly, which we do not recommend. We gathered most of the configuration parameters in `.env` files so the information is well-arranged and can be changed in one place.
131-
When using the single computer setup, the `.env` files can be read using a specifig flag. Unfortunately, this does not work for the multi node setup. Portainer is a tool that can help managing your cluster, see following section. When using portainer, the `.env` files can be used even in a multi node setup.
130+
We provide a general development setup and try to keep most of the information generic. Most of the configuration parameters of the setup can be changed either in the `.yml` files directly, which we do not recommend. We gathered most of the configuration parameters in `.env` files so the information is well-arranged and can be changed in one place. For example, to save storage space on the host machine of your platform, log levels can be changed from `DEBUG` to `WARN`.
131+
When using the single computer setup, the `.env` files can be read using a specific flag. Unfortunately, this does not work for the multi node setup. Portainer is a tool that can help managing your cluster, see following section. When using portainer, the `.env` files can be used even in a multi node setup.
132132

133133
In general, we suggest using portainer in any case due to its nice graphical interface that assists to manage your containerized environments.
134134

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"@context": {
3+
"brick": "https://brickschema.org/schema/brick#",
4+
"sense": "https://w3id.org/sense#",
5+
"unit": "http://qudt.org/vocab/unit/",
6+
"esim": "https://w3id.org/esim#",
7+
"mm": "https://w3id.org/mm#",
8+
"example": "https://www.example.com/",
9+
10+
11+
"AirTemperatureSensor": "brick:Air_Temperature_Sensor",
12+
"Computed": "mm:Computed",
13+
"DataPoint": "sense:DataPoint",
14+
"Measured": "mm:Measured",
15+
"MultiSensor": "sense:MultiSensor",
16+
"Location": "brick:Location",
17+
"Heater": "brick:Electric_Radiator",
18+
"Humidity": "mm:Humidity",
19+
"HumiditySensor": "brick:HumiditySensor",
20+
"MetricType": "mm:MetricType",
21+
"SensorEquipment": "brick:Sensor_Equipment",
22+
"SensorPoint": "brick:Sensor",
23+
"Setpoint": "brick:Setpoint",
24+
"Space": "brick:Space",
25+
"Temperature": "brick:Temperature",
26+
"TemperatureSensor": "brick:Temperature_Sensor",
27+
"TemperatureSetpoint": "brick:Temperature_Setpoint",
28+
"Valve": "brick:Valve",
29+
"ValvePosition": "brick:Valve_Position_Sensor",
30+
"ValveCommand": "brick:Valve_Position_Command",
31+
"WeatherStation": "brick:Weather_Station",
32+
33+
34+
"hasDataPoint": "sense:hasDataPoint",
35+
"isHostedBy": "esim:isHostedBy",
36+
"isDataPointOf": "sense:isDataPointOf",
37+
"heaterPower": "brick:Heating_Command",
38+
39+
40+
"degC": "unit:DEG_C",
41+
"percent": "unit:PERCENT"
42+
43+
44+
},
45+
"@graph": []
46+
}

general/context-files/context.jsonld

Lines changed: 0 additions & 22 deletions
This file was deleted.

ld/.env

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ IOTA_JSON_CB_HOST=orion-ld
178178
IOTA_JSON_CB_PORT=1026
179179
# Context configuration
180180
# Where to find the context file(s), if multiple files shall be used, the URLs can be comma separated
181-
IOTA_JSON_LD_CONTEXT=http://context-server:80/context.jsonld
182-
# Port for confugiration of the IoT Agent (internal port)
181+
IOTA_JSON_LD_CONTEXT=http://context-server:80/building.jsonld
182+
# Port for confugiration of the IoT Agent.
183183
IOTA_JSON_NORTH_PORT=4041
184184
# Whether to hold IoT device info in memory or in a database
185185
IOTA_JSON_REGISTRY_TYPE=mongodb
@@ -189,8 +189,6 @@ IOTA_JSON_LOG_LEVEL=DEBUG
189189
IOTA_JSON_TIMESTAMP=true
190190
# v2 for NGSIv2, LD vor NGSI-LD, and mixed if both NGSI versions are used. LD support is still experimental
191191
IOTA_JSON_CB_NGSI_VERSION=LD
192-
# The link to the context file(s). If multiple files shall be used, the URLs can be comma separated
193-
IOTA_JSON_LD_CONTEXT=http://context-server:80/context.jsonld
194192
# The tenant to use if no tenant is provided in the fiware-service or ngsild-tenant header
195193
IOTA_JSON_FALLBACK_TENANT=DEFAULT
196194
# The path to use if no path is provided in the fiware-servicepath or scope header

ld/docker-compose.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
version: "3.7"
22

3+
# Define levels for log file size limits
4+
x-logging-low: &logging-low # Used by: mongo-express-ld, mongodb-ld, quantumleap-ld, mqtt-broker-ld, grafana, portainer, context-server
5+
driver: "json-file"
6+
options:
7+
max-file: 2
8+
max-size: 5m
9+
10+
x-logging-medium: &logging-medium # Used by: orion-ld
11+
driver: "json-file"
12+
options:
13+
max-file: 2
14+
max-size: 10m
15+
16+
x-logging-high: &logging-high # Used by: cratedb-ld, iot-agent-json-ld
17+
driver: "json-file"
18+
options:
19+
max-file: 2
20+
max-size: 50m
21+
322
services:
423
orion-ld:
524
#Sometimes the newest builds fail. Hence, we fixed a stable version that
@@ -33,6 +52,7 @@ services:
3352
- ORIONLD_NOTIF_MODE=${ORIONLD_NOTIF_MODE:-persistent}
3453
- ORIONLD_MUTEX_POLICY=${ORIONLD_MUTEX_POLICY:-all}
3554
- ORIONLD_CONN_MEMORY=${ORIONLD_CONN_MEMORY:-128}
55+
logging: *logging-medium
3656

3757
mongo-db-ld:
3858
image: mongo:${MONGODB_VERSION:-5.0.24} #Check https://docs.mongodb.com/manual/release-notes/ im Zweifel 4.2
@@ -43,6 +63,7 @@ services:
4363
- fiware-ld
4464
volumes:
4565
- ${MONGODB_VOLUME_PATH:-mongo-db-ld}:${MONGO_DATA_DIR:-/data/db}
66+
logging: *logging-low
4667

4768
mongo-express-ld:
4869
image: mongo-express:${ME_VERSION:-1.0.2}
@@ -59,6 +80,7 @@ services:
5980
- ME_CONFIG_MONGODB_ENABLE_ADMIN=${ME_CONFIG_MONGODB_ENABLE_ADMIN:-true}
6081
#- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
6182
- ME_CONFIG_BASICAUTH=${ME_CONFIG_MONGODB_BASICAUTH:-false}
83+
logging: *logging-low
6284

6385

6486
iot-agent-json-ld:
@@ -81,7 +103,7 @@ services:
81103
- IOTA_LOG_LEVEL=${IOTA_JSON_LOG_LEVEL:-DEBUG}
82104
- IOTA_TIMESTAMP=${IOTA_JSON_TIMESTAMP:-true}
83105
- IOTA_CB_NGSI_VERSION=${IOTA_JSON_CB_NGSI_VERSION:-LD}
84-
- IOTA_JSON_LD_CONTEXT=${IOTA_JSON_LD_CONTEXT:-http://context-server:80/context.jsonld}
106+
- IOTA_JSON_LD_CONTEXT=${IOTA_JSON_LD_CONTEXT:-http://context-server:80/building.jsonld}
85107
# - IOTA_FALLBACK_TENANT=${IOTA_JSON_FALLBACK_TENANT:-default}
86108
# - IOTA_FALLBACK_PATH=${IOTA_JSON_FALLBACK_PATH:-/}
87109
- IOTA_AUTOCAST=${IOTA_JSON_AUTOCAST:-false}
@@ -99,6 +121,7 @@ services:
99121
- IOTA_MQTT_PROTOCOL=${IOTA_JSON_MQTT_PROTOCOL:-mqtt}
100122
- IOTA_MQTT_KEEPALIVE=${IOTA_JSON_MQTT_KEEPALIVE:-60}
101123
- IOTA_AMQP_DISABLED=${IOTA_JSON_AMQP_DISABLED:-true}
124+
logging: *logging-high
102125

103126
mqtt-broker-ld:
104127
image: eclipse-mosquitto:${MOSQUITTO_VERSION:-2.0.11}
@@ -111,6 +134,7 @@ services:
111134
- fiware-ld
112135
volumes:
113136
- ../general/mosquitto.conf:/mosquitto/config/mosquitto.conf
137+
logging: *logging-low
114138

115139
quantumleap-ld:
116140
image: orchestracities/quantumleap:${QL_VERSION:-1.0.0}
@@ -129,6 +153,7 @@ services:
129153
# - REDIS_HOST=${QL_REDIS_HOST:-redis-cache}
130154
# - REDIS_PORT=${QL_REDIS_PORT:-6379}
131155
# - CACHE_QUERIES=${QL_CACHE_QUERIES:-True}
156+
logging: *logging-low
132157

133158
crate-ld:
134159
image: crate:${CRATEDB_VERSION:-4.8.4} # Please check release notes!
@@ -144,6 +169,7 @@ services:
144169
environment:
145170
- TZ=${TIMEZONE:-Europe/Berlin}
146171
- CRATE_HEAP_SIZE=${CRATEDB_HEAP_SIZE:-1g}
172+
logging: *logging-high
147173

148174
grafana:
149175
image: grafana/grafana:${GRAFANA_VERSION:-9.3.0}
@@ -159,6 +185,7 @@ services:
159185
- TZ=${TIMEZONE:-Europe/Berlin}
160186
volumes:
161187
- "grafana:/var/lib/grafana"
188+
logging: *logging-low
162189

163190
portainer:
164191
image: portainer/portainer-ce:${PORTAINER_VERSION:-2.19.4}
@@ -174,6 +201,7 @@ services:
174201
- /var/run/docker.sock:/var/run/docker.sock
175202
- portainer_data:/data
176203
restart: always
204+
logging: *logging-low
177205

178206
context-server:
179207
image: httpd:alpine
@@ -186,6 +214,7 @@ services:
186214
volumes:
187215
- context-files:/usr/local/apache2/htdocs/
188216
restart: always
217+
logging: *logging-low
189218

190219
volumes:
191220
mongo-db-ld:

v2/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ IOTA_JSON_AMQP_DISABLED=true
212212
GRAFANA_VERSION=10.1.1
213213
# External port Grafana shall be reached at
214214
GRAFANA_PORT=3000
215+
# If no volume is used: Local file path on the node(s), e.g. something like "~/fiware/data/mongodb". Important for multi node setup.
216+
# GRAFANA_VOLUME_PATH=
217+
# Where the data is stored within the container
218+
GRAFANA_DATA_DIR=/var/lib/grafana
215219

216220
# Portainer
217221
# Portainer version

v2/docker-compose.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
version: "3.8"
22

3+
# Define levels for log file size limits
4+
x-logging-low: &logging-low # Used by: mongo-express, mongodb1, mongodb2, mongodb3, quantumleap, mqtt-broker, grafana, portainer
5+
driver: "json-file"
6+
options:
7+
max-file: 2
8+
max-size: 5m
9+
10+
x-logging-medium: &logging-medium # Used by: orion
11+
driver: "json-file"
12+
options:
13+
max-file: 2
14+
max-size: 10m
15+
16+
x-logging-high: &logging-high # Used by: cratedb, iot-agent-json
17+
driver: "json-file"
18+
options:
19+
max-file: 2
20+
max-size: 50m
21+
322
services:
423

524
orion:
@@ -27,6 +46,7 @@ services:
2746
# - ORION_TRQ_POOL_SIZE={ORION_THREADPOOL_SIZE=-2} # use only if ORION_NOTIFICATION_MODE is set to "threadpool"
2847
- ORION_MUTEX_POLICY=${ORION_REQUEST_POLICY:-all}
2948
- ORION_CONN_MEMORY=${ORION_CONNECTION_MEMORY:-128}
49+
logging: *logging-medium
3050

3151
mongo-db:
3252
image: mongo:${MONGODB_VERSION:-5.0.24}
@@ -37,6 +57,7 @@ services:
3757
- fiware
3858
volumes:
3959
- ${MONGODB_VOLUME_PATH:-mongo-db}:${MONGO_DATA_DIR:-/data/db}
60+
logging: *logging-low
4061

4162
mongo-express:
4263
image: mongo-express:${ME_VERSION:-1.0.2}
@@ -53,6 +74,7 @@ services:
5374
- ME_CONFIG_MONGODB_ENABLE_ADMIN=${ME_CONFIG_MONGODB_ENABLE_ADMIN:-true}
5475
#- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
5576
- ME_CONFIG_BASICAUTH=${ME_CONFIG_MONGODB_BASICAUTH:-false}
77+
logging: *logging-low
5678

5779
iot-agent-json:
5880
image: fiware/iotagent-json:${IOTA_JSON_VERSION:-1.19.0}
@@ -89,6 +111,7 @@ services:
89111
- IOTA_MQTT_PROTOCOL=${IOTA_JSON_MQTT_PROTOCOL:-mqtt}
90112
- IOTA_MQTT_KEEPALIVE=${IOTA_JSON_MQTT_KEEPALIVE:-60}
91113
- IOTA_AMQP_DISABLED=${IOTA_JSON_AMQP_DISABLED:-true}
114+
logging: *logging-high
92115

93116
mqtt-broker:
94117
image: eclipse-mosquitto:${MOSQUITTO_VERSION:-2.0.11}
@@ -101,6 +124,7 @@ services:
101124
- fiware
102125
volumes:
103126
- ../general/mosquitto.conf:/mosquitto/config/mosquitto.conf
127+
logging: *logging-low
104128

105129
quantumleap:
106130
image: orchestracities/quantumleap:${QL_VERSION:-1.0.0}
@@ -122,6 +146,7 @@ services:
122146
# - REDIS_HOST=${QL_REDIS_HOST:-redis-cache}
123147
# - REDIS_PORT=${QL_REDIS_PORT:-6379}
124148
# - CACHE_QUERIES=${QL_CACHE_QUERIES:-True}
149+
logging: *logging-low
125150

126151
crate:
127152
image: crate:${CRATEDB_VERSION:-4.8.4} # Please check release notes!
@@ -137,6 +162,7 @@ services:
137162
environment:
138163
- TZ=${TIMEZONE:-Europe/Berlin}
139164
- CRATE_HEAP_SIZE=${CRATEDB_HEAP_SIZE:-1g}
165+
logging: *logging-high
140166

141167
grafana:
142168
image: grafana/grafana:${GRAFANA_VERSION:-9.3.0}
@@ -151,7 +177,8 @@ services:
151177
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-worldmap-panel,grafana-simple-json-datasource
152178
- TZ=${TIMEZONE:-Europe/Berlin}
153179
volumes:
154-
- "grafana:/var/lib/grafana"
180+
- ${GRAFANA_VOLUME_PATH:-grafana}:${GRAFANA_DATA_DIR:-/var/lib/grafana}
181+
logging: *logging-low
155182

156183
portainer:
157184
image: portainer/portainer-ce:${PORTAINER_VERSION:-2.19.4}
@@ -167,6 +194,7 @@ services:
167194
volumes:
168195
- /var/run/docker.sock:/var/run/docker.sock
169196
- portainer_data:/data
197+
logging: *logging-low
170198

171199

172200

0 commit comments

Comments
 (0)