You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7.7 KiB

NUT - Network UPS Tools




Purpose & Overview

UPS - uninterruptible power supply managment. Huge drivers support.

The main objective is to be able to shutdown properly larger amount of devices when power goes out and ups battery starts to get low.

Nut is collection of programs and drivers, mostly written in C. For webgui it uses apache webserver.

Techno Tim youtube video

As per the video I am testing this running on rpi. Here's arch on rpi setup.


Files and directory structure

└── ~/
    └── docker/
        └── rustdesk/
            ├── 🗁 rustdesk_data/
            ├── 🗋 .env
            └── 🗋 docker-compose.yml
  • rustdesk_data/ - persistent data, contains sqlite database and the keys
  • .env - a file containing environment variables for docker compose
  • docker-compose.yml - a docker compose file, telling docker how to run the containers

You only need to provide the two files.
The directory is created by docker compose on the first run.


Using S6-overlay based image.
It's a simpler, single container approach. The complexity of rustdesk's hbbs server and hbbr relay hidden.

No network section since no http traffic that would need reverse proxy, yet.
So just mapped ports on to docker host to do their thing.


    image: rustdesk/rustdesk-server-s6:1.1.7-1
    container_name: rustdesk
    hostname: rustdesk
    restart: unless-stopped
    env_file: .env
      - "21116:21116"
      - "21115:21115"
      - "21116:21116/udp"
      - "21117:21117"
      - "21118:21118"
      - "21119:21119"
      - ./rustdesk_data:/data



# KEY_PRIV=<put here content of ./rustdesk_data/id_ed25519>
# KEY_PUB=<put here content of ./rustdesk_data/>

In the .env file encryption is enabled, so that only clients that have correct public key will be allowed access to the rustdesk server.
The keys are generated on the first run of the compose and can be found in the rustdesk_data directory. Once generated they should be added to the .env file for easier migration. The public key needs to be distributed with the clients apps installation.

Port forwarding

as can be seen in the compose

  • 21115 - 21119 TCP need to be forwarded to docker host
  • 21116 is TCP and UDP

21115 is used for the NAT type test, 21116/UDP is used for the ID registration and heartbeat service, 21116/TCP is used for TCP hole punching and connection service, 21117 is used for the Relay services, and 21118 and 21119 are used to support web clients.


The installation on clients

  • Download and install the client apps from the official site.
  • Three dots > ID/Relay Server
    • ID Server:
    • Key: <content of>
  • The green dot at the bottom should be green saying "ready".


On windows one can deploy client with pre-sets by renaming the installation file to: rustdesk-host=<host-ip-or-name>,key=<public-key-string>.exe


If by chance the public key contains symbols not usable in windows filenames, down the container, delete the files id_ed25519 and, up the container and try with the new keys.

Extra info

  • You really really really want to be using domain and not your public IP when installing clients and setting ID server. That can be changed to point at a different IP any time you want. Hard set IP not.
  • Can do tcpdump -n udp port 21116 on a docker host to see heartbeat udp traffic. Seems machines report-in every ~13 seconds.
  • on windows a service named rustdesk is enabled. Disable it if the machine should be accessible only on demand, when someone first runs rustdesk manually.
    In powershell - Set-Service rustdesk -StartupType Disabled
  • One can relatively easily hardcode server url and pub key in to an executable using github actions.
    Tested it and it works. But seems you can only do workflow run of nightly build, meaning all the latest stuff added is included, which means higher chance of bugs.
    Make sure you do step "Enable upload permissions for workflows", before you run the workflow.
  • Questions about issues with selfhosting are not answered on github - #763, next to try is their discord or subreddit.
  • FAQ
  • How does rustdesk work?


Trouble shooting

If just one machine is having issues.

uninstall, plus delete:

  • C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk
  • %AppData%\RustDesk

Restart. Reinstall.
Do not use the installer you used before, download from the site latest.

Error - Failed to connect to relay server

  • I had wrong url set as RELAY in the .env
  • if url is correct I would test if port 21117 tcp forwards

Investigate port forwarding

Install netcat and tcpdump on the docker host.

  • docker compose down rustdesk container so that ports are free to use
  • start a small netcat server listening on whichever port we test
    sudo nc -u -vv -l -p 21116
    the -u means udp traffic, delete to do tcp
  • on a machine somewhere else in the world, not on the same network, try nc -u <public-ip> 21116

If you write something and press enter, it should appear on the other machine, confirming that port forwarding works.
Also useful command can be tcpdump -n udp port 21116
When port forwarding works, one should see heartbeat chatter, as machines with installed rustdesk are announcing themselves every ~13 seconds.

Manual image update:

  • docker-compose pull
  • docker-compose up -d
  • docker image prune

Backup and restore


Using borg that makes daily snapshot of the entire directory.


  • down the bookstack containers docker-compose down
  • delete the entire bookstack directory
  • from the backup copy back the bookstack directory
  • start the containers docker-compose up -d