[#30] Rework logging in the container

Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
Roman Loginov 2024-08-16 09:08:11 +03:00
parent f0c20be1b9
commit 89ecc28f2e
5 changed files with 33 additions and 6 deletions

2
.env
View file

@ -1,3 +1,3 @@
FROSTFS_HUB_IMAGE=truecloudlab/frostfs
AIO_IMAGE=truecloudlab/frostfs-aio
AIO_VERSION=1.5.0
AIO_VERSION=1.5.1

View file

@ -9,6 +9,7 @@ VERSION ?= "$(shell git describe --tags --match "v*" 2>/dev/null || git rev-pars
# Variables for docker
AIO_IMAGE ?= "truecloudlab/frostfs-aio"
LOG_DIR ?= "/var/log"
# Variables for compose
COMPOSE_CMD_UP ?= docker-compose up -d
@ -96,3 +97,11 @@ version:
@echo $(VERSION)
@echo "frostfs-node: $(AIO_VERSION)"
@echo "neo-go: $(NEOGO_VERSION)"
# Show all logs of the FrostFS service
logs/%:
@docker exec aio cat ${LOG_DIR}/$*
# Streaming of the frostFS service logs
logs-stream/%:
@docker exec aio tail -f ${LOG_DIR}/$*

View file

@ -324,3 +324,19 @@ $ frostfs-cli -r localhost:8080 -w /config/user-wallet.json \
--cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \
--oid HByVC9A34i22BnzW3n83z9vEMxuYZoC7nNu11ZvGeCTe > new_cat.jpg
```
## Viewing logs
There are two targets for viewing logs.
You can view all the logs by replacing the desired service name:
``` sh
make logs/frostfs-node
```
You can also make a continuous stream of logs by replacing the desired service name:
``` sh
make stream-logs/frostfs-node
```

View file

@ -14,7 +14,7 @@ die() {
runBlockchain() {
stage "Starting the blockchain"
/usr/bin/neo-go node --config-path /config --privnet &
/usr/bin/neo-go node --config-path /config --privnet |& tee -a ${LOG_DIR}/neo-go &
while [[ "$(curl -s -o /dev/null -w %{http_code} localhost:30333)" != "422" ]];
do
@ -37,7 +37,7 @@ configure() {
runServices() {
stage "Running services"
/usr/bin/frostfs-ir --config /config/config-ir.yaml &
/usr/bin/frostfs-ir --config /config/config-ir.yaml |& tee -a ${LOG_DIR}/frostfs-ir &
while [[ -z "$(/usr/bin/frostfs-cli control ir healthcheck --endpoint localhost:16512 -c /config/cli-cfg-ir.yaml | grep 'Health status: READY')" ]];
do
@ -45,7 +45,7 @@ runServices() {
done
set -m
/usr/bin/frostfs-node --config /config/config-sn.yaml &
/usr/bin/frostfs-node --config /config/config-sn.yaml |& tee -a ${LOG_DIR}/frostfs-node &
while [[ -z "$(/usr/bin/frostfs-cli control healthcheck --endpoint localhost:16513 -c /config/cli-cfg-sn.yaml | grep 'Health status: READY')" ]];
do
@ -63,8 +63,8 @@ runServices() {
sleep 2
done
/usr/bin/frostfs-s3-gw --config /config/s3-gw-config.yaml &
/usr/bin/frostfs-http-gw --config /config/http-gw-config.yaml &
/usr/bin/frostfs-s3-gw --config /config/s3-gw-config.yaml |& tee -a ${LOG_DIR}/frostfs-s3-gw &
/usr/bin/frostfs-http-gw --config /config/http-gw-config.yaml |& tee -a ${LOG_DIR}/frostfs-http-gw &
}

View file

@ -15,6 +15,8 @@ services:
retries: 100
start_period: 2s
timeout: 2s
environment:
- LOG_DIR=/var/log
volumes:
- data:/data
- ./wallets:/wallets