Setting Up Shelly Device Without Cloud or Location Permissions

I use a Shelly Plug M Gen3 to monitor my homeserver’s power consumption with a custom Prometheus exporter. After a router restart, the device disappeared from the network. I tried the official Shelly Cloud app to re-onboard it, but the app demanded location permissions, wanted to upload my WiFi password to Shelly’s cloud, and still failed to add the device. Frustrated, I figured out the offline setup process. This works for initial setup or after a factory reset (hold the button for 10 seconds within 60 seconds of power-up). ...

June 10, 2026 · 2 min · Veerendra K

PromQL rate() vs increase()

I keep mixing up rate() and increase() in PromQL, so this is a short note for future reference. Both functions are normally used with counters: metrics that only go up, except when the process restarts and the counter resets. The quick difference: rate() answers: how fast is it increasing? increase() answers: how much did it increase? rate() rate() gives the average per-second increase over a time range. rate(http_requests_total[5m]) If the counter moved from around 280 to 700, the increase is 420. In this example the sampled time difference is 270 seconds, so: ...

June 8, 2026 · 2 min · Veerendra K

User Namespace Isolation in Docker

There is a cool feature in docker called userns-remap, discovered while doing my RaspberryPi home server project; 15#issuecomment-1296311979, I can just enable userns-remap and docker does all remapping of uid and gid inside docker container to a non-root user on the host. https://docs.docker.com/engine/security/userns-remap/ How to enable *It is better to reinstall docker and remove all existing docker volumes Add below /etc/docker/daemon.json { "userns-remap": "default" } Restart the docker daemon $ sudo systemctl restart docker Ansible automation here In-Action # Run the Nginx container $ docker run -it -d nginx # Inside, the process thinks it is running as root! veerendra@atom:~$ docker exec -it nginx whoami root # But outside(on host namespace), the process running it as non-root user veerendra@atom:~$ ps aux | grep nginx 165536 350093 0.0 0.0 6320 4688 ? Ss 03:21 0:00 nginx: master process nginx -g daemon off; 165637 350208 0.0 0.0 6788 4288 ? S 03:21 0:01 nginx: worker process 165637 350209 0.0 0.0 6784 4284 ? S 03:21 0:00 nginx: worker process 165637 350210 0.0 0.0 6784 4284 ? S 03:21 0:01 nginx: worker process 165637 350212 0.0 0.0 6784 4284 ? S 03:21 0:01 nginx: worker process veerend+ 937492 0.0 0.0 6420 1844 pts/0 S+ 16:22 0:00 grep --color=auto nginx As you can see I have not specified any user while deploying the container, but the user inside the container is isolated i.e remapped to a non-root user(uid:165637, gid:165637) on the host ...

November 11, 2022 · 2 min · Veerendra K