Skip to content

Commit 11725e3

Browse files
authored
Issue #213 nut-upsd image - version 2.8.3 with ulimit (#220)
1 parent b6d9d65 commit 11725e3

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

images/nut-upsd/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LABEL org.opencontainers.image.authors="Rich Braun docker@instantlinux.net" \
77
org.label-schema.name=nut-upsd \
88
org.label-schema.vcs-ref=$VCS_REF \
99
org.label-schema.vcs-url=https://github.com/instantlinux/docker-tools
10-
ARG NUT_VERSION=2.8.2-r2
10+
ARG NUT_VERSION=2.8.3-r2
1111
ENV API_USER=upsmon \
1212
API_PASSWORD= \
1313
DESCRIPTION=UPS \
@@ -21,13 +21,16 @@ ENV API_USER=upsmon \
2121
SECRETNAME=nut-upsd-password \
2222
SERIAL= \
2323
SERVER=master \
24+
ULIMIT=2048 \
2425
USER=nut \
2526
VENDORID=
2627
HEALTHCHECK CMD upsc $NAME@localhost:3493 2>&1|grep -q stale && \
2728
killall -TERM upsmon || true
2829

29-
RUN apk add --no-cache dash && \
30-
apk add --update --no-cache nut=$NUT_VERSION \
30+
RUN echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' \
31+
>>/etc/apk/repositories && \
32+
apk add --no-cache dash && \
33+
apk add --update --no-cache nut@edge=$NUT_VERSION \
3134
busybox linux-pam \
3235
libcrypto3 libssl3 \
3336
libusb musl net-snmp-libs util-linux

images/nut-upsd/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ SDORDER | | UPS shutdown sequence, set to -1 to disable shutdown
5151
SECRETNAME | nut-upsd-password | name of secret to use for API user
5252
SERIAL | | hardware serial number of UPS
5353
SERVER | master | master or slave priority for scripts
54+
ULIMIT | 2048 | open-files ulimit
5455
USER | nut | local user
5556
VENDORID | | vendor ID for ups.conf
5657
### Notes
@@ -115,6 +116,8 @@ EOF
115116
udevadm control --reload-rules && udevadm trigger
116117
```
117118

119+
When starting up under Debian trixie, an out-of-memory error can be prevented by setting the nofile ulimit to a smaller value than system default: see [issue #1672](https://github.com/networkupstools/nut/issues/1672). The default is set here to 2048.
120+
118121
### Secrets
119122

120123
If the API user needs a password, you have two ways to specify it: pass the value itself as environment variable API_PASSWORD, or define a Docker secret as follows:

images/nut-upsd/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ chown $USER:$GROUP /dev/shm/nut
6969
echo 0 > /var/run/nut/upsd.pid && chown $USER:$GROUP /var/run/nut/upsd.pid
7070
echo 0 > /var/run/upsmon.pid
7171

72+
ulimit -n $ULIMIT
7273
/usr/sbin/upsdrvctl -u root start
7374
/usr/sbin/upsd -u $USER
7475
exec /usr/sbin/upsmon -D

0 commit comments

Comments
 (0)