Resources


About

Network configuration

The old laptop rocks an AMD A8 6410 @2.0GHz with 8GB DDR3 RAM and a 512GB SATAIII SSD. Software side, it runs Proxmox Virtual Environment, a hosted hypervisor on which i configured two separate containers: one for a samba share (of the entire disk) and one for a wireguard VPN (PiVPN)

The laptop is suspended most of the time, and only gets turned on when i want to use it. To accomplish this, an always-on ESP32 microcontroller in the same local networks hosts a telegram bot and is instructed to send a WakeOnLan packet to the laptop if it receives the message /boot

The ESP32 also handles more complex commands that directly interact with the server, such as starting a proxmox container/vm /start container-id or putting the server back to a suspended state /suspend. To accomplish this, commands of such type are forwarded from the ESP32 to the server through a flask API (the ESP32 basically acts as a relay node here)

Hardware

Flask API

Note that the flask API is not running as root, but can still run root commands such as poweroff and systemctl suspend, this is because i gave the user running the API the permission to only run specific root commands with specific parameters. Maximum security!

# In: /etc/sudoers.d/flask

# ...
flask ALL=NOPASSWD: \
  /usr/bin/systemctl suspend, \
  /usr/sbin/reboot, \
  /usr/sbin/poweroff, \
  /usr/sbin/pct start 201, \  # Proxmox command to start the vpn container
  /usr/sbin/pct shutdown 201  # Proxmox command to stop the vpn container
# ...

Power consumption

The power consumption of the ESP32 is negligible and the server only uses about 20W on full load, 8W idle, and 2W while suspended (i have to suspend it instead of completely turning it off otherwise the WakeOnLan procedure doesn't always work). This results in an average cost (@ 0.15 €/kWh) of 0.1 € per week. That's really low!