feat: MyPointVPN landing on mypointvpn.sokolab.xyz and post about Serverus

Landings get per-project themes (params.theme, params.fonts) and optional
chat/start/note/engine sections, so they don't look like clones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
protokeyandClaude Opus 5.5 committed 2026-10-13 13:22:41 +04:00
1 parent 6958d0a975
commit 672467a699
6 files changed
+538 -4

No files matched your search

@@ -0,0 +1,83 @@
---
title: "MyPointVPN: how a VPN bot learned to manage servers"
date: 2026-10-13T12:00:00+04:00
draft: false
tags:
- telegram
- vpn
- server
- ansible
- docker
summary: "It started as a portfolio bot that installs 3x-ui. Along the way I split out Serverus, a package that manages the whole server. Now the bot lives on a server it manages itself"
---
On September 23 I made the first commit to a portfolio project: a Telegram bot that installs and configures the 3x-ui panel by itself, so a person gets their own VPN without any manual fiddling. Three weeks and about 40 commits later, the VPN turned out not to be the most interesting part.
## How it looks
You rent a server with Debian 12 or 13 from any hosting provider, get an IP and a root password, and send the bot one line: `ip:password`. The bot moves ssh to a random port with key-only login, turns on a firewall, updates the system and from then on manages the server itself.
You can take the server back at any time with the "Return" button. The bot removes its access, rolls back ssh and the firewall and sends you a new root password. Your data on the server stays.
## VPN
This is what it all started for. The bot installs 3x-ui and sets up:
- a VLESS + XHTTP + Reality connection on port 443, with the Reality target picked by the bot
- an optional camouflage server: clients connect to it, it forwards traffic to the panel, and the panel's address is never exposed
- a domain with a Let's Encrypt certificate for the panel and the subscription, and without a domain a short-lived IP certificate that renews automatically
- an outbound proxy: your own or Cloudflare WARP
- encrypted DNS on the server: DNS-over-TLS, with DNS-over-HTTPS as a fallback if TLS gets blocked
The bot issues and revokes client keys and hands out subscription links for v2rayN, Hiddify, Happ and v2rayNG. Keys have no limits: no traffic cap, no expiry, no device limit. For every key you can see the traffic and when the client was last online.
Once a day the bot checks the panel, Xray and the subscription certificate and tells you if something broke or got fixed.
## Why no Cloudflare
At first the bot could work through Cloudflare, and I had to drop it. Cloudflare terminates TLS on its side and opens a new connection to the server. Reality lives right inside the client's TLS handshake, and the server has to see it untouched. Reality can't work behind Cloudflare, so I removed the support.
## Where the real work is
When I looked at the code, almost all of the bot's work came down to one thing: take a bare Debian, lock it down and then manage it by key. Roughly what I described in [initial Debian server setup](/en/blog/zero-setup-debian-server/), just without a human. 3x-ui is only one of the tasks on top of that.
So I moved the server setup code into a separate package, `serverus`. It's an ansible-based library with no Django and no Telegram and a clear programmatic API. The Telegram part also became a separate package. The Django app stayed as the glue with the business logic.
## Second scenario: a docker server
With that foundation in place, the next scenario comes together quickly. I built a docker server:
- the bot installs Docker, Caddy and automatic system updates, and Caddy issues certificates for domains
- an app is a folder with `docker-compose.yaml`, `.env` and `caddy.conf`, sent to the bot as an archive or file by file
- before applying, the bot shows a diff and per-file warnings, and warns you if a domain doesn't point to the server
- while applying, it checks the compose file, busy ports and the Caddy config, and if something is wrong it leaves the app untouched
- only the changed services are recreated
- the "Roll back" button restores the previous version of the files
- there are start, stop, restart and logs per service, login to a private docker registry and guest access to volumes for uploading data
The example in the repo is a self-hosted RustDesk server.
## One codebase, different bots
What the bot can do is decided by the interface selected in the admin panel: "MyPoint VPN", "Serverus" or both. It switches on the fly, without a restart. That's how one codebase makes different bots.
## The bot hosts itself
My favorite part. Production MyPointVPN is deployed as a Serverus app on a docker server managed by this very bot. To the bot, its own new version is just another app, like RustDesk.
## Stack
Python, Django, PostgreSQL, RabbitMQ + dramatiq (background jobs with a supervisor), ansible, a self-hosted Telegram Bot API server, Docker, Caddy, 3x-ui v3.8.5.
## Try it and talk about it
The project has its own page: **[mypointvpn.sokolab.xyz](https://mypointvpn.sokolab.xyz/en/)**.
- [The bot](https://t.me/barbarisiska_bot)
- [Code](https://git.sokolab.xyz/s0k0l/mypointvpn), with a wiki: deployment, data migration and how a Serverus app is structured
- [Issues in Redmine](https://redmine.sokolab.xyz/projects/mypointvpn)
- [Forum for questions and ideas](https://redmine.sokolab.xyz/boards/2/topics/3), with a guest login, no sign-up needed
## What's next
Serverus will most likely become a separate project. I'll write about it in a separate post, and it will get its own landing page. To be continued.
+83
View File
@@ -0,0 +1,83 @@
---
title: "MyPointVPN: как бот для VPN научился управлять серверами"
date: 2026-10-13T12:00:00+04:00
draft: false
tags:
- telegram
- vpn
- server
- ansible
- docker
summary: "Начинал с бота для портфолио, который ставит 3x-ui. По дороге выделил пакет Serverus, который управляет сервером целиком. Теперь бот живет на сервере, которым сам же и управляет"
---
23 сентября я сделал первый коммит в проект для портфолио: Телеграм-бот, который сам ставит и настраивает панель 3x-ui, чтобы у человека был свой VPN без ручной возни. Прошло три недели и около 40 коммитов, и VPN оказался не самой интересной частью.
## Как это выглядит
Вы арендуете сервер с Debian 12 или 13 у любого хостера, получаете IP и пароль root и присылаете боту одну строку `ip:пароль`. Бот переводит ssh на случайный порт со входом только по ключу, включает фаервол, обновляет систему и дальше управляет сервером сам.
Сервер можно забрать в любой момент кнопкой «Вернуть». Бот уберет свои доступы, откатит ssh и фаервол и пришлет новый пароль root. Данные на сервере останутся.
## VPN
Ради этого все и затевалось. Бот ставит 3x-ui и настраивает:
- подключение VLESS + XHTTP + Reality на 443 порту, цель для Reality бот подбирает сам
- по желанию сервер маскировки: клиенты подключаются к нему, он пересылает трафик на панель, и адрес панели нигде не светится
- домен с сертификатом Let's Encrypt для панели и подписки, а без домена короткий сертификат на IP, который продлевается автоматически
- прокси на выходе: свой или Cloudflare WARP
- шифрованный DNS на сервере: DNS-over-TLS, а если его режут, запасной DNS-over-HTTPS
Ключи клиентов бот выпускает и отзывает сам и выдает ссылки на подписку для v2rayN, Hiddify, Happ и v2rayNG. Ограничений на ключи нет: ни по трафику, ни по сроку, ни по устройствам. По каждому ключу видно трафик и когда клиент был онлайн.
Раз в сутки бот проверяет панель, Xray и сертификат подписки и пишет, если что-то сломалось или починилось.
## Почему без Cloudflare
Сначала бот умел работать через Cloudflare, и от этого пришлось отказаться. Cloudflare сам завершает TLS у себя и открывает до сервера новое соединение. А Reality живет как раз внутри TLS-рукопожатия клиента, и сервер должен увидеть его как есть. За Cloudflare Reality работать не может, так что поддержку я убрал.
## Где на самом деле работа
Когда я посмотрел на код, оказалось, что почти вся работа бота сводится к одному: взять голый Debian, закрыть его и дальше управлять им по ключу. Примерно то, что я описывал в [первичной настройке сервера](/blog/zero-setup-debian-server/), только без человека. 3x-ui лишь одна из задач поверх этого.
Поэтому код настройки серверов я выделил в отдельный пакет `serverus`. Это библиотека на ansible без Django и без Telegram с понятным программным API. Телеграм-часть тоже стала отдельным пакетом. Django-приложение осталось связующим звеном с бизнес-логикой.
## Второй сценарий: docker-сервер
Когда такая основа есть, следующий сценарий собирается быстро. Я сделал docker-сервер:
- бот ставит Docker, Caddy и автообновления системы, сертификаты для доменов выпускает Caddy
- приложение это папка с `docker-compose.yaml`, `.env` и `caddy.conf`, ее можно прислать боту архивом или по файлам
- перед применением бот показывает разницу и предупреждения по файлам, а если домен не указывает на сервер, тоже предупредит
- при применении бот проверяет compose, занятость портов и конфиг Caddy, и если что-то не так, приложение не трогает
- пересоздаются только изменившиеся сервисы
- кнопка «откатить» возвращает предыдущую версию файлов
- есть старт, стоп, рестарт и логи по сервисам, логин в приватный docker registry и гостевой доступ к volumes, чтобы залить данные
В примере к проекту лежит свой сервер RustDesk.
## Один код, разные боты
Что умеет бот, решает интерфейс, выбранный в админке: «MyPoint VPN», «Serverus» или оба сразу. Переключается на ходу, без перезапуска. Так из одного кода получаются разные боты.
## Бот держит сам себя
Моя любимая часть. Прод MyPointVPN развернут как приложение Serverus на docker-сервере, которым управляет этот же бот. Новая версия бота для него такое же приложение, как RustDesk.
## Стек
Python, Django, PostgreSQL, RabbitMQ + dramatiq (фоновые задачи с супервизором), ansible, собственный сервер Telegram Bot API, Docker, Caddy, 3x-ui v3.8.5.
## Попробовать и обсудить
У проекта есть своя страница: **[mypointvpn.sokolab.xyz](https://mypointvpn.sokolab.xyz/)**.
- [Бот](https://t.me/barbarisiska_bot)
- [Код](https://git.sokolab.xyz/s0k0l/mypointvpn), там же вики: деплой, перенос данных и как устроено приложение для Serverus
- [Задачи в Redmine](https://redmine.sokolab.xyz/projects/mypointvpn)
- [Форум для вопросов и идей](https://redmine.sokolab.xyz/boards/2/topics/3), там же гостевой вход, регистрироваться не обязательно
## Что дальше
Serverus, скорее всего, станет отдельным проектом. Расскажу о нем отдельной записью, и у него будет свой лендинг. Продолжение следует.