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

Version 0.15.4 #2096

Merged
merged 24 commits into from
Sep 1, 2024
Merged

Version 0.15.4 #2096

merged 24 commits into from
Sep 1, 2024

Conversation

manuel-rw
Copy link
Collaborator

No description provided.

ajnart and others added 10 commits May 15, 2024 21:33
* Feature: add indexers site hyperlink

* Fix: add an option taget on settings, change color to grey
* feat: add Proxmox Uptime View

* fix: Proxmox Uptime

* fix: Proxmox Uptime

* fix: add env.example, make formattedUptime a constant

* fix: Uptime

* fix: Implement dayjs

* fix: removed unused import

* fix: Uptime
Copy link
Collaborator Author

@manuel-rw manuel-rw left a comment

Choose a reason for hiding this comment

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

  • fix build before we publish

Copy link

github-actions bot commented Aug 4, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 17.22% 5620 / 32633
🔵 Statements 17.22% 5620 / 32633
🔵 Functions 6.37% 33 / 518
🔵 Branches 37.22% 134 / 360
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
next-i18next.config.js 0% 0% 0% 0% 1-49
src/components/Dashboard/Tiles/Apps/AppPing.tsx 27.32% 100% 0% 27.32% 16-57, 65-74, 77-81, 91-97, 100-143, 156-172
src/components/Dashboard/Wrappers/Category/useCategoryActions.tsx 3.42% 100% 0% 3.42% 12-321
src/components/layout/Meta/BoardHeadOverride.tsx 17.85% 100% 0% 17.85% 6-28
src/components/layout/Meta/CommonHead.tsx 0% 0% 0% 0% 1-26
src/pages/api/download.ts 0% 0% 0% 0% 1-34
src/pages/manage/boards/index.tsx 0% 0% 0% 0% 1-318
src/server/api/routers/dns-hole/router.ts 0% 0% 0% 0% 1-194
src/tools/language.ts 100% 100% 100% 100%
src/tools/server/sdk/adGuard/adGuard.ts 0% 0% 0% 0% 1-106
src/tools/server/sdk/pihole/piHole.ts 98.79% 95.23% 100% 98.79% 51
src/validations/user.ts 100% 100% 0% 100%
src/widgets/dnshole/DnsHoleControls.tsx 22.87% 100% 0% 22.87% 67-77, 79-303
src/widgets/dnshole/DnsHoleSummary.tsx 52.4% 100% 0% 52.4% 52-71, 108-118, 126-170, 173-185
src/widgets/dnshole/TimerModal.tsx 20.16% 100% 0% 20.16% 26-124
src/widgets/health-monitoring/HealthMonitoringTile.tsx 45.68% 100% 0% 45.68% 116-188, 191-232, 235-239, 242-251, 254-266, 271-278
src/widgets/health-monitoring/cluster/HealthMonitoringClusterTile.tsx 14.04% 100% 0% 14.04% 18-126, 135-178
src/widgets/indexer-manager/IndexerManagerTile.tsx 38.65% 100% 0% 38.65% 45-117
src/widgets/notebook/NotebookWidgetTile.tsx 93.75% 100% 0% 93.75% 46-48
Generated in workflow #6867

@Meierschlumpf
Copy link
Collaborator

I think the problem is the Dockerfile updates from #2011
We changed the base image there from slim to alpine and run yarn in the alpine image on line 111. As already mentioned regarding newmarr node has problems especially with alpine and node 20+

@polarathene
Copy link

I think the problem is the Dockerfile updates from #2011

There's a lot wrong with that PRs contributions. Including very concerning security risks that got through review. I would encourage addressing that promptly.

@manuel-rw
Copy link
Collaborator Author

I think the problem is the Dockerfile updates from #2011

There's a lot wrong with that PRs contributions. Including very concerning security risks that got through review. I would encourage addressing that promptly.

Hi, why don't you submit a PR then? We would be happy to review and merge.

@Meierschlumpf
Copy link
Collaborator

@manuel-rw maybe it makes the most sense to just revert all changes made with that pull request for docker, don't have the PUID / PGID feature for now and just have it after we release Newmarr. Then we can release this version with confidence and don't have to deal with code that we don't really understand.

Copy link

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

I just realized that this PR is a dev => master series of commits, rather than a typical PR 😓 (I did not notice the default branch for the project was dev, assumed a different git flow)

Hope the feedback is somewhat helpful regarding Docker at least 👍

If you do choose to go ahead and merge, at least remove the docker-cli package. But for the most part, reverting seems better, but I'd still drop the VOLUME directives.

Dockerfile Outdated
@@ -1,33 +1,106 @@
FROM node:20.2.0-slim
FROM --platform=linux/amd64 node:20.2.0-slim as compiler
Copy link

@polarathene polarathene Aug 31, 2024

Choose a reason for hiding this comment

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

--platform here forces the builder node to be AMD64. If using buildx/buildkit to build on say ARM64 host, if it's got an AMD64 node via emulation it'll still use that. Probably redundant?

If you want to build with the native platform on the build host, you can instead use --platform=${BUILDPLATFORM}, which will be like building the image without --platform at all, unless you specify other non-native build targets.

For additional clarity, this is the requested platform for the image base that the directives that follow will run on. For projects like Rust, you may have a builder stage that can use the same common native platform but build the project for other architectures (where they then get copied to a platform specific image in a separate stage) which is faster than having one platform emulated for a build if no native build nodes are configured for other architectures.

Dockerfile Outdated
RUN yarn build


FROM node:20.2.0-alpine3.18

Choose a reason for hiding this comment

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

Careful with Alpine as a base image. Ensure that you're actually getting worthwhile benefits by using it, it's often a source of troubleshooting gotchas that are not fun to debug (memory leaks, poor performance, DNS, glibc vs musl, are all known issues projects have had with Alpine).

It's typically chosen for the smaller size and attribution of that being more secure as a smaller attack surface. Just be sure you're not giving too much of a trade-off with that choice when you can get fairly competitive sized images by using alternatives when this matters.


Fedora for example can install a minimal image with dnf --installroot, although for NodeJS that is 124MB, Alpine is about half of that. For context:

  • node:slim debian image you're using in the build stage is 217 MB.
  • node:alpine is 154MB.

So Fedora is probably a win for you regardless size wise, while the --installroot approach would minimize deps (no package manager, minimal deps).

Similar to Alpine, fedora releases are a bit more frequently than Debian, but Fedora releases do get updates to packages over time too (vs Debian releases which besides age don't tend to upgrade packages much between releases beyond security fixes). Whereas your node images have the benefit of being pinned (you can pin the package with dnf too).

The Docker image support isn't that critical to the project. Since you're already familiar with Debian / apt, perhaps stay with that and optionally take advantage of the image suggestion below (Debian too) as the final stage.


That said you could try Google's debian based distroless NodeJS image too:

docker run --rm -it \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wagoodman/dive:latest gcr.io/distroless/nodejs22-debian12:latest

image

It weighs in at 143MB and as you can see above is quite minimal for internal contents. This is for a final stage image only that you COPY your build into as there is no other programs to run, nor package manager available.

For security benefits that should serve you much better and keep things fairly simple.

Dockerfile Outdated
ARG PORT=7575

# Keep free id >= 1000 for user, under node:x image by default node user uses 1000:1000

Choose a reason for hiding this comment

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

Bulk of this I commented on from the original PR, and discourage the approach taken.

There is a feature with Docker that should arrive in future for the concern with better mapping container writes to volume mounts with different UID/GID. Usually the issue for users is just inconvenience if they want to interact with the files from the host, as otherwise they could keep it in a named data volume which avoids some issues (docker cp lets you easily transfer between host and container too).

I haven't looked at the issue that motivated these changes with PUID/PGID, but I assume it's not actually breaking functionality.

Dockerfile Outdated
Comment on lines 126 to 127
RUN echo '#!/bin/bash\nnode /app/cli/cli.js "$@"' > /usr/bin/homarr
RUN chmod +x /usr/bin/homarr

Choose a reason for hiding this comment

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

Better to use an ENTRYPOINT ["/path/to/node", "/app/cli/cli.js"] instead, the "$@" is unnecessary as you get this functionality from ENTRYPOINT with the syntax shown, it will append CMD to it, or whatever a user provides as an override to CMD at runtime.

If you use the distroless image suggestion, you don't have to worry about the ENTRYPOINT, it'll point to node already, but they suggest to put the args into CMD, which may be a slight breaking change to the image if someone was providing custom args to cli.js.

Dockerfile Outdated
Comment on lines 64 to 65
VOLUME [ "/app/data/configs" ]
VOLUME [ "/data" ]

Choose a reason for hiding this comment

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

Since there was talking about reverting such changes. I do want to point out that you should avoid VOLUME directives here.

They create anonymous data volumes per container instance. Those will accumulate with each container created unless the container is disposed of (eg: docker run --rm ... instead of just docker run ...).

It is worse for Docker Compose which will be more common in usage, as destroying containers does not remove these anonymous volumes they're tied to the project and service name, thus if you did for some reason want to rely on this implicit persistence it's more difficult to reset/discard it should the need arise (docker volumes ls is really unhelpful for identifying which anonymous volume belongs to what container).

Instead it's much better to just document these locations, either in proper docs or a compose.yaml example (don't use docker-compose.yml btw, official Docker docs are aligned with compose.yaml since 2023Q3 with Compose v2 release being deemed stable).

Users that want to persist data should provide explicit config to indicate that, otherwise so long as a container is not destroyed it will persist any filesystem state it has when stopped/restarted (sometimes a source of bugs), whereas VOLUME tends to just cause more problems than benefits.

@polarathene
Copy link

Hi, why don't you submit a PR then? We would be happy to review and merge.

If I could afford the time I would, but I tend to have a habit of underestimating time it takes me. I'm presently juggling too much as-is to take on more atm.

Happy to provide review/feedback, but that's about all I can spare right now.

@ajnart
Copy link
Owner

ajnart commented Aug 31, 2024

Hi, why don't you submit a PR then? We would be happy to review and merge.

If I could afford the time I would, but I tend to have a habit of underestimating time it takes me. I'm presently juggling too much as-is to take on more atm.

Happy to provide review/feedback, but that's about all I can spare right now.

Thank you for taking the time to write a detailed feedback on this PR.
Regarding the flow, we've set master to be the one the main image is deployed from but dev as the default since it reassures users to see that there's activity on the repo 😉

@manuel-rw manuel-rw merged commit 20a84da into master Sep 1, 2024
5 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.

10 participants