Skip to content

Conversation

@konradkonrad
Copy link
Contributor

@konradkonrad konradkonrad commented Apr 8, 2025

This aims to recreate the functionality from
shutter-network/shutter-keyper-deployment#10 usable with the DAppnodePackage.

Because we can not install the docker loki plugin, and everything is running in one container through supervisord, we need to resort to promtail and some extra log redirections to keep the docker logging working.

Fixes #10

@konradkonrad konradkonrad marked this pull request as draft April 8, 2025 17:48
@konradkonrad konradkonrad marked this pull request as ready for review April 10, 2025 13:20
@konradkonrad konradkonrad assigned ulope and unassigned ulope Apr 10, 2025
@konradkonrad konradkonrad requested review from ulope and removed request for ulope April 10, 2025 13:20
@konradkonrad konradkonrad marked this pull request as draft April 10, 2025 13:27
@konradkonrad
Copy link
Contributor Author

konradkonrad commented Apr 10, 2025

This is unfortunately still not ready -- env expansion in promtail configuration is still not working (on dappnode). This leads to authorization errors:

root@dappnode:~# docker logs DAppNodePackage-shutter.shutter-api-gnosis.dnp.dappnode.eth |& head -n 150
2025-04-10 13:21:14,109 INFO Set uid to user 0 succeeded
2025-04-10 13:21:14,117 INFO RPC interface 'supervisor' initialized
2025-04-10 13:21:14,117 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2025-04-10 13:21:14,117 INFO supervisord started with pid 1
2025-04-10 13:21:15,121 INFO spawned: 'configure' with pid 7
2025-04-10 13:21:15,124 INFO spawned: 'promtail' with pid 8
[INFO | configure] Configuration file already exists. Removing it...
[INFO | configure] Generating configuration files...
---
# Loki Config
# (version=3.4.3, branch=release-3.4.x, revision=e038d0fc)
global:
  file_watch_config:
    min_poll_frequency: 250ms
    max_poll_frequency: 250ms
server:
  http_listen_network: tcp
  http_listen_address: ""
 […]
  profiling_enabled: false
  enable_runtime_reload: false
client:
  url: https://logs.metrics.shutter.network/insert/loki/api/v1/push
  batchwait: 1s
  batchsize: 1048576
  basic_auth:
    username: $(PUSHGATEWAY_USERNAME)
    password: <secret>

This aims to recreate the functionality from
shutter-network/shutter-keyper-deployment#10
usable with the DAppnodePackage.

Because we can not install the docker loki plugin, and everything is running
in one container through supervisord, we need to resort to promtail and
some extra log redirections to keep the docker logging working.
@konradkonrad konradkonrad marked this pull request as ready for review April 14, 2025 12:11
@konradkonrad
Copy link
Contributor Author

This is ready now!

@konradkonrad konradkonrad requested a review from ulope April 14, 2025 12:11
Copy link

@ulope ulope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the question about rotation, LGTM.

Comment on lines 55 to 57
autostart = true
startretries = 9999 ; A large number enough to cover node updates
autorestart = true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env var interpolation should allow to make autostart and autorestart conditional on the SHUTTER_PUSH_METRICS_ENABLED variable

$SHUTTER_BIN chain --config "$SHUTTER_CHAIN_CONFIG_FILE"
if [[ SHUTTER_PUSH_LOGS_ENABLED=true ]];
then
$SHUTTER_BIN chain --config "$SHUTTER_CHAIN_CONFIG_FILE" |& rotatelogs -n 1 -e -c /tmp/chain.log 5M
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "rotation" with only one file work correctly with promtail without causing log lines to be missed?

Reading the promtail logs on logrotation suggests it might not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that documentation, but I could not fully figure out, whether it applies in this case. My assessment was that using a single file would actually work as intended, but now that I re-read your link I am not sure anymore.

Do you have another suggestion how to achieve what we need?:

  • redirect output to file AND stdout (to keep docker logging working)
  • keep the logfile from growing indefinitely

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a comment but decided to leave it like this.

@konradkonrad konradkonrad merged commit 87f5342 into main Apr 28, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable pushing logs for the Shutter API DappNode package

3 participants