HUB
Sign inSign up
upsd logo

crashvb/upsd

By crashvb

•Updated over 5 years ago

Contains upsd / nut-server.

Image
0

608

crashvb/upsd repository overview

⁠upsd

version) image size linting license

⁠Overview

This docker image contains NUT⁠.

⁠Adding device mappings

To expose mapped devices (such as usb, serial, etc), allow the container to communicate with the device:

---
version: "3.9"

services:
  upsd:
    device_cgroup_rules:
    - "a 188:* rmw"
    - "a 189:* rmw"
    environment:
      # name type major minor mode owner group
      UPSD_MKNOD_DEFAULT: |
        /dev/ups0,c,188,0,0660,root,dialout
        /dev/ups1,c,188,1,0660,root,dialout
        /dev/ups2,c,189,389,0660,root,dialout
    ...
    volumes:
    - /dev/bus/usb:/dev/bus/usb:rw

⁠Example Configuration

This is an example dynamic configuration with 2 UPS, and 3 users:

---
version: "3.9"

services:
  upsd:
    ...
    environment:
      UPSD_CONFD_UPS0: |
        [ups0]
        desc = "CyberPower CPS1500AVR"
        model=CPS1500AVR
        driver = powerpanel
        port = /dev/ups0
        sdorder = 0

      UPSD_CONFD_UPS1: |
        [ups1]
        desc = "CyberPower CPS1500AVR"
        model=CPS1500AVR
        driver = powerpanel
        port = /dev/ups1
        sdorder = 0

      UPSD_CONFD_UPS2: |
        [ups2]
        desc = "CyberPower OR1500LCDRM2U"
        driver = usbhid-ups
        port = auto
        vendorid = 0764
        productid = 0601
        sdorder = 0

      UPSD_USERSD_ADMIN: |
        [admin]
        password = $${ADMIN_PASSWORD}
        actions = SET
        instcmds = ALL

      UPSD_USERSD_UPSMONMASTER: |
        [upsmonmaster]
        password = $${UPSMONMASTER_PASSWORD}
        upsmon master

      UPSD_USERSD_UPSMONSLAVE: |
        [upsmonslave]
        password = $${UPSMONSLAVE_PASSWORD}
        upsmon slave
    ...

⁠Entrypoint Scripts

⁠upsd

The embedded entrypoint script is located at /etc/entrypoint.d/upsd and performs the following actions:

  1. A new upsd configuration is generated using the following environment variables:
VariableDefault ValueDescription
UPSD_CONFD_*The contents of <nut_confpath>/conf.d/*.conf. For example, UPSD_CONFD_FOO will create <nut_confpath>/conf.d/foo.conf. The contents of this directory will be used to generate <nut_confpath>/ups.conf.
UPSD_CONFD_*The contents of <nut_confpath>/conf.d/*.conf. For example, UPSD_CONFD_FOO will create <nut_confpath>/conf.d/foo.conf. The contents of this directory will be used to generate <nut_confpath>/ups.conf.
UPSD_NSS_PATH<nut_confpath>/nssThe path to the NSS database.
UPSD_USERSD_*The contents of <nut_confpath>/users.d/*.conf. For example, UPSD_USERSD_FOO will create <nut_confpath>/users.d/foo.conf. The contents of this directory will be used to generate <nut_confpath>/upsd.users.
  1. Volume permissions are normalized.

⁠Standard Configuration

⁠Container Layout
/
├─ etc/
│  ├─ entrypoint.d/
│  │  └─ upsd
│  ├─ healthcheck.d/
│  │  ├─ upsd
│  │  └─ upsdrvctl
│  └─ supervisor/
│     └─ config.d/
│        ├─ upsd.conf
│        └─ upsdrvctl.conf
├─ run/
│  └─ secrets/
│     ├─ nss_password
│     ├─ upsd.crt
│     ├─ upsd.key
│     ├─ upsdca.crt
│     └─ upsd_<user>_password
└─ usr/
   └─ local/
      └─ bin/
         ├─ nut-update-confd
         └─ nut-update-usersd
⁠Exposed Ports
  • 3493/tcp - upsd listening port.
⁠Volumes
  • /etc/nut - The upsd configuration directory.

⁠Development

Source Control⁠

Tag summary

Content type

Image

Digest

Size

84.8 MB

Last updated

over 5 years ago

docker pull crashvb/upsd