Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Added support to watchtower statistics #455

Merged
merged 3 commits into from Oct 28, 2022

Conversation

FauFra
Copy link
Contributor

@FauFra FauFra commented Oct 26, 2022

Added widget support for watchtower statistics.

How to use:

  • Launch watchtower with the two commands --http-api-metrics --http-api-token and bind port 8080 as described here.
 run -d \                                                            
  -v /var/run/docker.sock:/var/run/docker.sock \
 -p 8080:8080 containrrr/watchtower --http-api-metrics --http-api-token demotoken
  • Then add the widget in the services.yml file, as shown below:
 - WatchTower:
        icon: watchtower.png
        server: my-docker
        container: watchtower
        widget:
            type: watchtower
            url: http://your-ip-address:8080
            key: demotoken

Preview:
image

@shamoon
Copy link
Collaborator

shamoon commented Oct 26, 2022

Thanks for the PR, please revert changes to the language files other then en, the others are updated through the weblate platform.

Myself (or someone else) will review this asap

@FauFra
Copy link
Contributor Author

FauFra commented Oct 26, 2022

Oh, I didn't know it, thanks.

@JazzFisch
Copy link
Collaborator

Is there a way to make the labels clearer? I recognize that naming things is hard, and it might not be possible to make clearer, however without clearer labels, translators will have a harder time coming up with good translations.

@FauFra
Copy link
Contributor Author

FauFra commented Oct 26, 2022

The first statistic indicates the number of times a scan is performed by the service, while the other ones refer to the number of containers scanned, updated and failed in the last scan.

I wanted to add both types of statistics, but I recognize that this can create confusion and not clear labels.

Removing the first statistic and using scanned updated and failed as labels for the rest of the statistics, should be more clear. What do you think?

@shamoon
Copy link
Collaborator

shamoon commented Oct 26, 2022

Yea that makes sense to me. Curious, what do you link to with a watchtower widget, anything?

@FauFra
Copy link
Contributor Author

FauFra commented Oct 26, 2022

Sorry, English is not my primary language. What do you mean by your question? Which watchtower's API do I use to get the values?

@shamoon
Copy link
Collaborator

shamoon commented Oct 26, 2022

It’s not so important, just curious whether you would use this without an href, as in just to see the widget stats but no link (like in your example config above)

@FauFra
Copy link
Contributor Author

FauFra commented Oct 27, 2022

Oh, well I added also watchtower to homepage because it is easier and more immediate to check the container's statistics with it respect to portainer

Copy link
Collaborator

@shamoon shamoon left a comment

Choose a reason for hiding this comment

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

When you have a chance, please address the comments above, removing all common.json changes except for en and reworking the field names, etc. Thanks!

@FauFra
Copy link
Contributor Author

FauFra commented Oct 27, 2022

I did the changes, but before to commit I wanted to test everything inside a container. Unfortunately, I have some troubles with docker buildx build.

=> ERROR [builder 5/5] RUN <<EOF (set -xe...)                                                                                                                                                                                                                                                                                                                   38.9s
------                                                                                                                                                                                                                                                                                                                                                                 
 > [builder 5/5] RUN <<EOF (set -xe...):                                                                                                                                                                                                                                                                                                                               
#0 0.506 + npm run telemetry                                                                                                                                                                                                                                                                                                                                           
#0 0.988                                                                                                                                                                                                                                                                                                                                                               
#0 0.988 > startpage@0.1.0 telemetry
#0 0.988 > next telemetry disable
#0 0.988 
#0 1.151 Attention: Next.js now collects completely anonymous telemetry regarding usage.
#0 1.155 This information is used to shape Next.js' roadmap and prioritize features.
#0 1.155 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
#0 1.156 https://nextjs.org/telemetry
#0 1.156 
#0 1.164 Your preference has been saved to /app/cache/config.json.
#0 1.164 
#0 1.164 Status: Disabled
#0 1.164 
#0 1.164 You have opted-out of Next.js' anonymous telemetry program.
#0 1.164 No data will be collected from your machine.
#0 1.165 Learn more: https://nextjs.org/telemetry
#0 1.165 
#0 1.202 + mkdir config
#0 1.205 + echo -
#0 1.205 + NEXT_PUBLIC_BUILDTIME= NEXT_PUBLIC_VERSION= NEXT_PUBLIC_REVISION= npm run build
#0 1.677 
#0 1.677 > startpage@0.1.0 build
#0 1.677 > next build
#0 1.677 
#0 2.172 Attention: Next.js now collects completely anonymous telemetry regarding usage.
#0 2.173 This information is used to shape Next.js' roadmap and prioritize features.
#0 2.173 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
#0 2.173 https://nextjs.org/telemetry
#0 2.173 
#0 2.343 info  - Linting and checking validity of types...
#0 10.43 info  - Creating an optimized production build...
#0 10.56 info  - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
#0 11.30 info  - Using external babel configuration from /app/.babelrc
#0 37.36 info  - Compiled successfully
#0 37.37 info  - Collecting page data...
#0 38.64 
#0 38.64 > Build error occurred
#0 38.64 [Error: ENOENT: no such file or directory, copyfile '/app/node_modules/styled-jsx/style.js' -> '/app/.next/standalone/node_modules/styled-jsx/style.js'] {
#0 38.64   errno: -2,
#0 38.64   code: 'ENOENT',
#0 38.64   syscall: 'copyfile',
#0 38.64   path: '/app/node_modules/styled-jsx/style.js',
#0 38.64   dest: '/app/.next/standalone/node_modules/styled-jsx/style.js'
#0 38.64 }
------
ERROR: failed to solve: executor failed running [/bin/sh -c     set -xe
    npm run telemetry
    mkdir config && echo '-' > config/settings.yaml
    NEXT_PUBLIC_BUILDTIME=$BUILDTIME NEXT_PUBLIC_VERSION=$VERSION NEXT_PUBLIC_REVISION=$REVISION npm run build
]: exit code: 1

Docker version: 20.10.18
Docker buildx version: 0.9.1

@shamoon
Copy link
Collaborator

shamoon commented Oct 27, 2022

Yes, the build isnt working right now unfortunately, unclear issues with the arm builds. No ETA yet, but thanks for your patience. Its still easy enough to test locally but up to you

@FauFra FauFra force-pushed the main branch 2 times, most recently from c80d2a2 to 45e7226 Compare October 27, 2022 21:48
@shamoon
Copy link
Collaborator

shamoon commented Oct 28, 2022

Great, thanks for the PR

@FauFra
Copy link
Contributor Author

FauFra commented Oct 28, 2022

Thanks to you for your help!

Copy link
Contributor

github-actions bot commented Feb 6, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants