Automated, encrypted, and free (?!?) off-site backups for Proxmox using Telegram

AI Disclosure

This project is being developed with AI assistance for code review, fix bugs I can detect but cannot solve by myself effectively (i.e., without breaking something else in the process), and retrieval-augmented generation when sifting through API documentation and other technical documents. I also use AI to write tests, which I have always found rather tedious although they are extremely important, and to draft documentation or revise what I have written. For instance, I wrote the installation guide entirely by hand and subsequently used AI to check whether I had inadvertently left any IP addresses or API keys in (which I had, by the way).
So far, I have written the skeleton of the project and the basic functions and used AI to analyse my code and find ways to improve it and extend it.

The main reason why I feel that this project falls in line with the idea of learning by doing and challenging yourself is that most of the code is, for now, in Python. I have been using this language professionally for scientific computing, but took little time to learn how to do more than call APIs and some basic data transformation. One reason for my reticence is that I learnt programming and still spend most of my time coding in imperative and procedural style (think Fortran 95, C, R, and Bash). For this reason, being able to take an arbitrary piece of code and ask for it to be ‘translated’ to me in an ‘imperative’ pseudocode is very useful.

Admittedly, this approach has made development slower than either copy-pasting AI-generated code or writing sub-par code by myself would have given that whenever I receive a suggestion that I do not fully understand, I spend some time experimenting with new libraries or functions to understand what they do before actually moving forward.
Ultimately, for this project I see AI not just as a a tool I can use to build software that solves a problem in my homelab, but also an pathway to get a better understanding of how to write code and develop software outside my usual area of programming.


Proxmox Telegram Backup (PTB)

Edits
  • Edits 1-5: Fixing the embedded images' formatting;
  • Edit 6: Added a few compressible sections (including this one!).
  • Edit 7: Edited and updated the logo.

Proxmox Telegram Backup (PTB) is the rather descriptive and not very imaginative name of the project I would like to push through the finish live this Devember.

The goal is to build an open-source application that can run inside an LXC to run and store back-ups of Proxmox guests (both VMs and containers) off-site using a Telegram bot.
I also designed PTB to upload encrypted archives (I use age because I was familiar with it from earlier work in an HPC environment) and implemeted file-splitting to respect Telegram’s file-size limit,.

I came up with the idea as my homelab approximately one year into my homelab journey, when a 3-2-1 backup solution started turning from the subject of abstract plans into a concrete necessity.
But it may be best to give some background on me and my homelab before proceeding further.

A bit about me

Click if you are curious

I am a PhD researcher working in academia from Europe.

I started programming when I was quite young thanks to my father, who taught me Fortran 95. In high school, we learnt C, while nowadays my academic work and publications rely heavily on R. I also started writing some C++, whic can be easily integrated into R to speed-up heavy computations; but I never felt particularly at ease with object-oriented programming.

I acquired most of my experience in software development and maintenance while working on scientific software, primarily R packages for statistics and data analysis. Outside academia, I have also developed some mods for Pillars of Eternity (which was a good opportunity to learn some C#) and a few other games.

I started using Linux during my MA and finaally broke free from dual-booting last year. Proton was a key development in this decision, given that from 2022 or thereabout to early 2026, Windows had ben become a glorified game launcher I used to play Kingdom Come: Deliverance II and Stellaris.

My homelab

I started homelabbing in 2024, when I had the opportunity to get an HP EliteDesk 800 G1 for peanuts. My plan was to set up a DNS server for ad blocking so that my not particularly tech-savvy partner could benefit from without having to change browser or ditch official apps for privacy-friendly alternatives (ah, friction!).
Unsurprisingly, that minor intent led me down a rabbit hole.

The rabbit hole...

The 800 G1 eventually received a two-port gigabit Intel NIC and a 2.5 Gbps Intel I226-V NIC from AliExpress, an i7-4770S in place of its i5-4440 from eBay, and 24 more gigabytes of DDR3 that I managed to scrounge locally just as the ‘winter of our discontent began’ to hit the secondary market.


A photo of the 800G1 as it looked before I got my hands on it.

To be honest, I installed Proxmox for no particular reason other than it being free and the abundance of documentation and community resources.
The Proxmox Community Scripts also made it extremely easy to experiment with and install services that could be useful to my partner and family.
Today, that machine runs OPNsense on a VM with AdGuard Home as a plugin plus Vaultwarden, nginx, Traccar, Baïkal, Homer, Mealie and Reactive Resume as LXCs.

Eventually, I got a Lenovo ThinkCentre M710s from a local e-waste centre and upgraded its i3-6100 to an i7-7700T and procured another 16GB stick of DDR4 for a total of 32 GB.
This machine hosts a DietPi VM that functions as my NAS, running backups with Kopia+SnapRAID and hosting a Jellyfin media server for the films digitised from my father’s extensive collection of sci-fi VHS and DVDs.
I also got a small KeepLink 2.5 Gbps web-managed switch from AliExpress following SeveTheHome’s recommendations, and got locally a DFI-based industrial PC with an i7-4500U as a media- and game-streaming client connected to a 2012 LG television (non-smart, thankfully!).

As anyone could tell by now, I buy almost exclusively second-hand equipment, particularly because corporate policies and planned obsolescence means companies often turn perfectly good hardware into e-waste that the planet does not need and my wallet can afford.
Most of it comes from local marketplaces, although I have also acquired refurbished SAS drives and an LSI 9207-8e HBA from Bargain Hardware (almost a European equivalent to ServerPartDeals in the US).

Off-site backups vs Budget: Back to PTB

Electricity is relatively affordable where I live, and my main rig, which is almost always on, consumes considerably more power than either of my Proxmox hosts.
So, the main constraints on my homelab are space and noise, because I share a rented apartment with my partner, and, admittedly mainly, cost.

Locally, I run backups from my main rig, my work laptop, and my partner’s devices using Kopia, which runs on the M710s’s DietPi VM and stores the backups on refurb SAS drives.
For my Proxmox cluster, I was running backups and storing them locally of a slim 2.5" HDD I extracted from an old Seagate Expansion enclosure.
In other words, I had no automated off-site backup strategy for my homelab.

One obvious solution would have been to set up another NAS at my father’s house. Unfortunately, he lives in another country and has an unreliable 50 Mbps connection, which would make large data transfers particularly painful. More importantly, I could not justify the cost of purchasing enough drives to accommodate both my local and off-site storage needs as well as an additional machine.

I also looked into PBS, but its hardware recommendations made running a dedicated PBS instance less attractive for my rather modest setup, and it would not, by itself, solve the problem of storing off-site backups cheaply.

I got the idea of using Telegram because I am a relatively heavy of their messagging service, which I use to keep in touch with friends and family. Also, over the years, I have written and operated a few bots using Telegram’s hosted API.
Also, it offers essentially unlimited storage, including for private groups and channels, and accepts encrypted blobs without the server complaining about that the files could be ‘risky’ or the format being ‘unrecognised’/‘unsupported’.

Then, the idea behind PTB took shape as simple LXC (currently I am developing on Alpine Linux) that automatically backs up Proxmox guests, encrypts the data locally, splits it into multiple parts if the file is larger than Telegram’s file-size limit and uploads them to a private Telegram chat whiel also providing notifications to and accepting some management commands from the user.

Originally, I started developing PTB for my own use; however, I encountered some peculiar technical challenges that are pushing me to expand its original scope somewhat.
The most interesting of these has been the amount of unnecessary disk writes and I/O pressure that my original design generates. Admittedly, it took some external help to brainstorm possible solutions, and figuring out how to address these issues has become a as substantial a part of the learning experience as learning Python itself.
So, when I saw Wendell’s video announcing Devember, I thought it would be a good opportunity to participate more actively in the community and challenge myself to dedicate more time to this project despite the difficulties I am encountering.

What I would like to achieve during Devember

For me, success would mean having PTB become a working, documented, open-source project that other people can install and use.

Beyond that, I have a few stretch goals that would require tools I am more familiar with:

  • Developing a TUI for configuration and management.

  • Developing a web UI.

  • Eventually creating a Proxmox Community Script to deploy PTB semi-automatically in a dedicated LXC.

This last point is particularly dear to me given that the Proxmox Community Scripts have playted a big role in my homelabbing experience; so, it would be particularly rewading to finally contribute back something more than bug reports.

Update 1

I got a private GitHub repo, but I want to add at least all the basic functionalities before making it public (let’s call it a 1.0 release :slight_smile:).

Just a quick update, I got the basics for the scheduler and the Telegram bot on the self-hosted API working, the scheduler’s configuration is, for now, in YAML.

I also got an OpenRC worker to run scheduled backups through the proxmox API and record the status in a way accessible to the bot!

Also, the bot can be used to queue guests for backup when they are not on a given schedule.