[#30] Rework logging in the container #39

Merged
alexvanin merged 1 commit from r.loginov/frostfs-aio:feature/30_rework_logging_in_the_container into master 2024-09-03 10:16:02 +00:00
5 changed files with 33 additions and 6 deletions

2
.env
View file

@ -1,3 +1,3 @@
FROSTFS_HUB_IMAGE=truecloudlab/frostfs FROSTFS_HUB_IMAGE=truecloudlab/frostfs
AIO_IMAGE=truecloudlab/frostfs-aio 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 # Variables for docker
AIO_IMAGE ?= "truecloudlab/frostfs-aio" AIO_IMAGE ?= "truecloudlab/frostfs-aio"
LOG_DIR ?= "/var/log"
# Variables for compose # Variables for compose
COMPOSE_CMD_UP ?= docker-compose up -d COMPOSE_CMD_UP ?= docker-compose up -d
@ -96,3 +97,11 @@ version:
@echo $(VERSION) @echo $(VERSION)
@echo "frostfs-node: $(AIO_VERSION)" @echo "frostfs-node: $(AIO_VERSION)"
@echo "neo-go: $(NEOGO_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/%:
alexvanin marked this conversation as resolved Outdated

logs-stream seems better than stream-logs.

If the user doesn't know about this feature, they will write make log and then autocomplete will provide both available targets.

`logs-stream` seems better than `stream-logs`. If the user doesn't know about this feature, they will write `make log` and then autocomplete will provide both available targets.
@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 \ --cid GfWw35kHds7gKWmSvW7Zi4U39K7NMLK8EfXBQ5FPJA46 \
--oid HByVC9A34i22BnzW3n83z9vEMxuYZoC7nNu11ZvGeCTe > new_cat.jpg --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() { runBlockchain() {
stage "Starting the blockchain" 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 &
alexvanin marked this conversation as resolved Outdated

Please bump patch version of AIO in the .env file. We need to rebuild image that contains these changes.

Please bump patch version of AIO in the `.env` file. We need to rebuild image that contains these changes.

Do I understand correctly that the aio version needs to be rolled out 1.5.0 -> 1.5.1? If the answer is yes, then maybe it's worth correcting the version target in this case? Otherwise, at the moment, her conclusion may be a little misleading.

$ make version 
89ecc28
frostfs-node: 1.5.1
neo-go:

Firstly, it seems that the frostfs version is node 1.5.0, although this is the aio version. Secondly, neo-go does not display a version at all. It may be worth displaying either only the aio version or also the versions of all components.

Do I understand correctly that the aio `version` needs to be rolled out 1.5.0 -> 1.5.1? If the answer is yes, then maybe it's worth correcting the version target in this case? Otherwise, at the moment, her conclusion may be a little misleading. ```bash $ make version 89ecc28 frostfs-node: 1.5.1 neo-go: ``` Firstly, it seems that the frostfs version is node 1.5.0, although this is the aio version. Secondly, neo-go does not display a version at all. It may be worth displaying either only the aio version or also the versions of all components.

Do I understand correctly that the aio version needs to be rolled out 1.5.0 -> 1.5.1?

Yes.

then maybe it's worth correcting the version target in this case?

Let's try to fix it. If it is possible to use .env variables here, let's do it (avoid git describe because we don't add tags in this repo, at least now). If there are any issues with that, just make an issue.

> Do I understand correctly that the aio version needs to be rolled out 1.5.0 -> 1.5.1? Yes. > then maybe it's worth correcting the version target in this case? Let's try to fix it. If it is possible to use `.env` variables here, let's do it (avoid `git describe` because we don't add tags in this repo, at least now). If there are any issues with that, just make an issue.

Actually make an issue straight away. We define version components in docker files directly right now, we need to rework it.

Actually make an issue straight away. We define version components in docker files directly right now, we need to rework it.

Issue - #40

Issue - https://git.frostfs.info/TrueCloudLab/frostfs-aio/issues/40
while [[ "$(curl -s -o /dev/null -w %{http_code} localhost:30333)" != "422" ]]; while [[ "$(curl -s -o /dev/null -w %{http_code} localhost:30333)" != "422" ]];
do do
@ -37,7 +37,7 @@ configure() {
runServices() { runServices() {
stage "Running services" 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')" ]]; while [[ -z "$(/usr/bin/frostfs-cli control ir healthcheck --endpoint localhost:16512 -c /config/cli-cfg-ir.yaml | grep 'Health status: READY')" ]];
do do
@ -45,7 +45,7 @@ runServices() {
done done
set -m 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')" ]]; while [[ -z "$(/usr/bin/frostfs-cli control healthcheck --endpoint localhost:16513 -c /config/cli-cfg-sn.yaml | grep 'Health status: READY')" ]];
do do
@ -63,8 +63,8 @@ runServices() {
sleep 2 sleep 2
done done
/usr/bin/frostfs-s3-gw --config /config/s3-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 & /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 retries: 100
start_period: 2s start_period: 2s
timeout: 2s timeout: 2s
environment:
- LOG_DIR=/var/log
volumes: volumes:
- data:/data - data:/data
- ./wallets:/wallets - ./wallets:/wallets