<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexey</title>
    <description>The latest articles on DEV Community by Alexey (@anxi0uz).</description>
    <link>https://dev.to/anxi0uz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3931418%2Fc542fda7-5e8e-4015-9f7c-16728c480054.jpg</url>
      <title>DEV Community: Alexey</title>
      <link>https://dev.to/anxi0uz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anxi0uz"/>
    <language>en</language>
    <item>
      <title>Как я впихивал три модели в 6 ГБ видеопамяти</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Sat, 31 Oct 2026 14:11:28 +0000</pubDate>
      <link>https://dev.to/anxi0uz/kak-ia-vpikhival-tri-modieli-v-6-gb-vidieopamiati-3c6p</link>
      <guid>https://dev.to/anxi0uz/kak-ia-vpikhival-tri-modieli-v-6-gb-vidieopamiati-3c6p</guid>
      <description>&lt;p&gt;Пару дней назад мы с другом участвовали в хакатоне. Кейс — веб-сервис для видеолекций: загружаешь запись или ссылку на YouTube, получаешь расшифровку, субтитры, конспект с оглавлением и поиск по смыслу. Чтобы студент написал «где он доказывал теорему Пифагора» и попал на нужную секунду видео.&lt;/p&gt;

&lt;p&gt;На всё было три дня. Заняли пятое место.&lt;/p&gt;

&lt;p&gt;Проект называется Lectio, код &lt;a href="https://github.com/anxi0uz/lectio" rel="noopener noreferrer"&gt;на GitHub&lt;/a&gt;. Но пост не столько про хакатон. Он про одну проблему, которая съела у меня неожиданно много времени: заставить всё это работать на моём компьютере.&lt;/p&gt;

&lt;h2&gt;
  
  
  Железо
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ryzen 5 5600&lt;/li&gt;
&lt;li&gt;32 ГБ DDR4&lt;/li&gt;
&lt;li&gt;GTX 1660 Super на 6 ГБ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1660 Super вышла в 2019 году. Это Turing без тензорных ядер. Для игр нормально. Для нейросетей — скажем так, скромно.&lt;/p&gt;

&lt;p&gt;И всё должно было работать офлайн. Никаких облачных API, всё локально.&lt;/p&gt;

&lt;h2&gt;
  
  
  Три модели, одна маленькая карта
&lt;/h2&gt;

&lt;p&gt;Обработке лекции нужны три модели:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Whisper large-v3-turbo&lt;/strong&gt; (через faster-whisper) превращает речь в текст с таймкодом каждого слова.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BGE-M3&lt;/strong&gt; превращает куски расшифровки в векторы для поиска по смыслу.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen3 4B&lt;/strong&gt; (через Ollama) пишет конспект, оглавление и тест.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;По отдельности каждая влезает в 6 ГБ. Все три вместе — нет.&lt;/p&gt;

&lt;p&gt;А 6 ГБ — это на самом деле не 6 ГБ. Рабочий стол забирает 1–1,5 ГБ ещё до того, как я что-то запустил. Дискорд забирает ещё полгига. Это я узнал, когда Ollama вдруг начала гонять 8–17% модели на процессоре, а причиной оказался Дискорд в трее.&lt;/p&gt;

&lt;h2&gt;
  
  
  Первый заход
&lt;/h2&gt;

&lt;p&gt;Самый простой вариант — загрузить все модели один раз, держать в памяти и обрабатывать лекции. В 6 ГБ это не влезает, и первым по памяти упал Whisper: Ollama после вопроса в чате ещё держала модель, и места не осталось.&lt;/p&gt;

&lt;p&gt;Дальше было интереснее самого падения. Модели очень по-разному ведут себя, когда памяти не хватает.&lt;/p&gt;

&lt;p&gt;Ollama подстраивается. Если карта занята, она тихо выносит часть слоёв на процессор и продолжает работать. Медленнее, но работает.&lt;/p&gt;

&lt;p&gt;Whisper и эмбеддер не подстраиваются. Они пытаются выделить память, не могут и роняют всю задачу.&lt;/p&gt;

&lt;p&gt;Получалось, что вежливой модели доставалось всё, а строгие падали. Ровно наоборот. Значит, память надо отбирать у Ollama до того, как грузятся мои модели, а не наоборот.&lt;/p&gt;

&lt;h2&gt;
  
  
  По этапам
&lt;/h2&gt;

&lt;p&gt;Теперь воркер обрабатывает одну лекцию за раз, и на каждом этапе карта целиком принадлежит одной модели:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Попросить Ollama выгрузить модель.&lt;/li&gt;
&lt;li&gt;Загрузить Whisper, расшифровать, выгрузить Whisper.&lt;/li&gt;
&lt;li&gt;Ещё раз попросить Ollama выгрузиться — вдруг чат успел её загрузить.&lt;/li&gt;
&lt;li&gt;Загрузить BGE-M3, посчитать векторы, выгрузить BGE-M3.&lt;/li&gt;
&lt;li&gt;Теперь вся карта у Ollama, она пишет конспект.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Всё это висит на одной настройке, &lt;code&gt;RELEASE_MODELS_BETWEEN_STAGES=true&lt;/code&gt;. На карте побольше её выключаешь, и ничего не выгружается.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ollama не отпускает
&lt;/h2&gt;

&lt;p&gt;По умолчанию Ollama держит модель в памяти пять минут после последнего запроса. То есть если кто-то спросил что-то в чате по лекции, а через минуту в обработку пришла новая лекция, Whisper стартовал при занятой карте.&lt;/p&gt;

&lt;p&gt;У Ollama для этого есть ручка: запрос с &lt;code&gt;keep_alive: 0&lt;/code&gt;, и модель выгружается сразу. В OpenAI-совместимом API её нет, поэтому зову родной:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;unload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;native_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_base_url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removesuffix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/api/generate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AsyncClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;10.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;native_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;keep_alive&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HTTPError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Other OpenAI-compatible servers don't have this endpoint.
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Если LLM не Ollama, запрос просто тихо не проходит, и обработка идёт дальше.&lt;/p&gt;

&lt;h2&gt;
  
  
  Выгрузить модель сложнее, чем кажется
&lt;/h2&gt;

&lt;p&gt;Модели создаются один раз и кешируются:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@cache&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Transcriber&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;FasterWhisperTranscriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cache_clear&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;gc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;empty_cache&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Сбросили кеш, запустили сборщик мусора, попросили PyTorch отдать память. Вроде всё.&lt;/p&gt;

&lt;p&gt;Не освобождалось ничего.&lt;/p&gt;

&lt;p&gt;Проблема была в коде, который модель использовал:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;transcript&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;В момент вызова &lt;code&gt;release_transcriber()&lt;/code&gt; локальная переменная &lt;code&gt;model&lt;/code&gt; всё ещё указывает на модель. Кеш сброшен, но объект жив, сборщик мусора его не трогает, и память остаётся занятой.&lt;/p&gt;

&lt;p&gt;Исправление выглядит странно, но работает. Не держать модель в переменной вообще:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# No local reference to the model: release_* can only free memory
# once nothing else points at it.
&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;transcript&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Комментарий в коде нужен, чтобы я потом это «не почистил».&lt;/p&gt;

&lt;h2&gt;
  
  
  fp16, но правильно
&lt;/h2&gt;

&lt;p&gt;BGE-M3 в fp32 для этой карты жирновата, поэтому она работает в половинной точности. Первая версия была очевидной:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;BAAI/bge-m3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;half&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Памяти освободилось меньше, чем ожидал. Модель сначала грузилась в fp32 и только потом конвертировалась, а fp32-копия оставалась висеть в кеше CUDA-аллокатора PyTorch.&lt;/p&gt;

&lt;p&gt;Грузить надо сразу в fp16:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;embedding_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model_kwargs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dtype&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float16&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Размен, которого я не ожидал
&lt;/h2&gt;

&lt;p&gt;API нужна своя копия BGE-M3, чтобы превращать поисковые запросы в векторы. Ещё одна модель на карте.&lt;/p&gt;

&lt;p&gt;Я перенёс её на процессор, и цифры получились такие:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;поиск стал медленнее примерно на &lt;strong&gt;40 мс&lt;/strong&gt; на запрос, этого никто не заметит;&lt;/li&gt;
&lt;li&gt;Qwen3 теперь целиком помещается на видеокарту и выдаёт &lt;strong&gt;68 токенов в секунду вместо 39&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Поиск на 40 мс медленнее за почти вдвое более быструю LLM. Одна строчка в &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SEARCH_DEVICE=cpu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Мелочи
&lt;/h2&gt;

&lt;p&gt;Ещё несколько настроек дали заметную разницу:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WHISPER_COMPUTE_TYPE=int8_float16
WHISPER_BATCH_SIZE=4
LLM_MODEL=qwen3:4b-instruct
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Веса Whisper в int8 с вычислениями в fp16, маленький батч и модель на 4B вместо 8B. Для Ollama ещё включил &lt;code&gt;OLLAMA_FLASH_ATTENTION=1&lt;/code&gt; и &lt;code&gt;OLLAMA_KV_CACHE_TYPE=q8_0&lt;/code&gt; — кеш контекста становится вдвое меньше.&lt;/p&gt;

&lt;p&gt;И одна штука, в которой я так и не успел разобраться. faster-whisper работает на CTranslate2, а не на PyTorch. Но CTranslate2 находил cuBLAS и cuDNN, только если перед ним был импортирован &lt;code&gt;torch&lt;/code&gt;. Поэтому транскрайбер начинается так:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;  &lt;span class="c1"&gt;# noqa: F401
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;faster_whisper&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BatchedInferencePipeline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;WhisperModel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Импорт нигде не используется. Уберёшь его — Whisper перестаёт видеть CUDA.&lt;/p&gt;

&lt;h2&gt;
  
  
  Цифры
&lt;/h2&gt;

&lt;p&gt;Вечером перед защитой я прогнал через конвейер лекцию на 1 час 25 минут. От загрузки до «готово» ушло &lt;strong&gt;14 минут 16 секунд&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Этап&lt;/th&gt;
&lt;th&gt;Время&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Извлечение аудио (ffmpeg)&lt;/td&gt;
&lt;td&gt;7 с&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Расшифровка (Whisper)&lt;/td&gt;
&lt;td&gt;5 мин 2 с&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Индексация (BGE-M3)&lt;/td&gt;
&lt;td&gt;39 с&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Конспект (Qwen3 4B)&lt;/td&gt;
&lt;td&gt;8 мин 27 с&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Сам Whisper расшифровал 85 минут звука за 4 минуты 56 секунд. Это примерно в 17 раз быстрее реального времени, на карте без тензорных ядер.&lt;/p&gt;

&lt;p&gt;Поиск работает уже через шесть минут. Всё, что дальше, — это 4B-модель пишет конспект. Это 60% всего времени, и именно это сильнее всего ускорит карта побольше или модель посильнее.&lt;/p&gt;

&lt;h2&gt;
  
  
  Что я из этого вынес
&lt;/h2&gt;

&lt;p&gt;Я думал, сложными будут сами модели. Нет. Модели хорошие, библиотеки хорошие, и каждая нормально работает, пока она одна на карте.&lt;/p&gt;

&lt;p&gt;Сложно было делить. Какая модель вежливо отдаёт память, а какая падает. Кто держит ссылку, про которую ты забыл. Какая библиотека что кеширует и сколько держит.&lt;/p&gt;

&lt;p&gt;В документации к моделям этого нет, потому что каждая описана так, будто она единственная на твоей видеокарте.&lt;/p&gt;

&lt;p&gt;В 6 ГБ так не бывает никогда.&lt;/p&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>gpu</category>
    </item>
    <item>
      <title>How I squeezed three models into 6 GB of VRAM</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Sat, 31 Oct 2026 14:10:31 +0000</pubDate>
      <link>https://dev.to/anxi0uz/how-i-squeezed-three-models-into-6-gb-of-vram-3504</link>
      <guid>https://dev.to/anxi0uz/how-i-squeezed-three-models-into-6-gb-of-vram-3504</guid>
      <description>&lt;p&gt;A few days ago my friend and I took part in a hackathon. The case was a web service for video lectures: upload a recording or a YouTube link, get a transcript, synced subtitles, a summary with a table of contents, and search by meaning, so a student can type "where did he prove the Pythagorean theorem" and land on the right second of the video.&lt;/p&gt;

&lt;p&gt;We had three days. We took fifth place.&lt;/p&gt;

&lt;p&gt;The project is called Lectio and the code is &lt;a href="https://github.com/anxi0uz/lectio" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt;. This post isn't really about the hackathon though. It's about one problem that ate a surprising amount of my time: making all of it run on my own PC.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hardware
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ryzen 5 5600&lt;/li&gt;
&lt;li&gt;32 GB of RAM&lt;/li&gt;
&lt;li&gt;GTX 1660 Super with 6 GB of VRAM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 1660 Super came out in 2019. It's a Turing card without tensor cores. It's fine for games. For running neural networks it is, let's say, modest.&lt;/p&gt;

&lt;p&gt;And the whole thing had to work offline. No cloud APIs, everything local.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three models, one small card
&lt;/h2&gt;

&lt;p&gt;The processing pipeline needs three models:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Whisper large-v3-turbo&lt;/strong&gt; (through faster-whisper) turns speech into text with a timestamp for every word.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BGE-M3&lt;/strong&gt; turns chunks of the transcript into vectors for semantic search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen3 4B&lt;/strong&gt; (through Ollama) writes the summary, the table of contents and the quiz.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each of them fits into 6 GB on its own. All three together don't.&lt;/p&gt;

&lt;p&gt;And 6 GB isn't really 6 GB. My desktop takes 1–1.5 GB before I start anything. Discord takes another half a gigabyte. I found that out when Ollama suddenly started running 8–17% of the model on the CPU, and the reason turned out to be Discord sitting in the tray.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first attempt
&lt;/h2&gt;

&lt;p&gt;The simplest version is to load every model once, keep it in memory and process lectures. On 6 GB that doesn't fit, and Whisper was the first to run out of memory: Ollama was still holding the LLM after a chat request, and there was no room left.&lt;/p&gt;

&lt;p&gt;What I noticed next was more interesting than the crash itself. The models behave very differently when there's not enough memory.&lt;/p&gt;

&lt;p&gt;Ollama adapts. If the card is busy, it quietly offloads part of the layers to the CPU and keeps working. Slower, but it works.&lt;/p&gt;

&lt;p&gt;Whisper and the embedder don't adapt. They try to allocate memory, fail and take the whole job down with them.&lt;/p&gt;

&lt;p&gt;So the polite one was getting everything and the strict ones were crashing. That's backwards. The fix was to take memory back from Ollama before my own models load, not the other way around.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage by stage
&lt;/h2&gt;

&lt;p&gt;The worker now processes one lecture at a time, and every stage gets the card to itself:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ask Ollama to unload its model.&lt;/li&gt;
&lt;li&gt;Load Whisper, transcribe, unload Whisper.&lt;/li&gt;
&lt;li&gt;Ask Ollama to unload again, in case the chat loaded it in the meantime.&lt;/li&gt;
&lt;li&gt;Load BGE-M3, build the vectors, unload BGE-M3.&lt;/li&gt;
&lt;li&gt;Now Ollama gets the whole card for the summary.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It's all behind one setting, &lt;code&gt;RELEASE_MODELS_BETWEEN_STAGES=true&lt;/code&gt;. On a card with more memory you turn it off and nothing gets unloaded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ollama doesn't let go
&lt;/h2&gt;

&lt;p&gt;By default Ollama keeps a model loaded for five minutes after the last request. So if someone asked the lecture chat a question, and a minute later a new lecture went into processing, Whisper would start with the LLM still occupying the card.&lt;/p&gt;

&lt;p&gt;Ollama has an endpoint for this: send a request with &lt;code&gt;keep_alive: 0&lt;/code&gt; and it unloads the model right away. It isn't part of the OpenAI-compatible API, so I call the native one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;unload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;native_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_base_url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removesuffix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/api/generate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AsyncClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;10.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;native_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;keep_alive&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HTTPError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Other OpenAI-compatible servers don't have this endpoint.
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the LLM is something other than Ollama, the request just fails quietly and processing continues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unloading a model is harder than it sounds
&lt;/h2&gt;

&lt;p&gt;Models are created once and cached:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@cache&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Transcriber&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;FasterWhisperTranscriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cache_clear&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;gc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;empty_cache&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clear the cache, run the garbage collector, tell PyTorch to give the memory back. Looks fine.&lt;/p&gt;

&lt;p&gt;It didn't free anything.&lt;/p&gt;

&lt;p&gt;The problem was in the code that used the model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;transcript&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the moment &lt;code&gt;release_transcriber()&lt;/code&gt; runs, the local variable &lt;code&gt;model&lt;/code&gt; still points at the model. The cache is cleared, but the object is alive, so the garbage collector can't touch it and the memory stays taken.&lt;/p&gt;

&lt;p&gt;The fix looks weird, but it works. Never keep the model in a variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# No local reference to the model: release_* can only free memory
# once nothing else points at it.
&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;transcript&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;get_transcriber&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;release_transcriber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comment in the code exists so I don't "clean it up" later.&lt;/p&gt;

&lt;h2&gt;
  
  
  fp16, but the right way
&lt;/h2&gt;

&lt;p&gt;BGE-M3 in fp32 is too much for this card, so it runs in half precision. My first version was the obvious one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;BAAI/bge-m3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;half&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Memory usage dropped less than expected. The model was loaded in fp32 first and converted afterwards, and the fp32 copy stayed in PyTorch's CUDA allocator cache.&lt;/p&gt;

&lt;p&gt;It has to be loaded in fp16 from the start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;embedding_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model_kwargs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dtype&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float16&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The trade-off I didn't expect
&lt;/h2&gt;

&lt;p&gt;The API needs its own copy of BGE-M3 to turn search queries into vectors. Another model on the card.&lt;/p&gt;

&lt;p&gt;I moved it to the CPU, and the numbers turned out like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search got slower by about &lt;strong&gt;40 ms&lt;/strong&gt; per query, which nobody will notice;&lt;/li&gt;
&lt;li&gt;Qwen3 now fits on the GPU entirely and generates &lt;strong&gt;68 tokens per second instead of 39&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A 40 ms slower search for an LLM that's almost twice as fast. One line in &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SEARCH_DEVICE=cpu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The small stuff
&lt;/h2&gt;

&lt;p&gt;A few more settings made a real difference:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WHISPER_COMPUTE_TYPE=int8_float16
WHISPER_BATCH_SIZE=4
LLM_MODEL=qwen3:4b-instruct
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whisper weights in int8 with fp16 computation, a small batch, and a 4B model instead of 8B. For Ollama I also turned on &lt;code&gt;OLLAMA_FLASH_ATTENTION=1&lt;/code&gt; and &lt;code&gt;OLLAMA_KV_CACHE_TYPE=q8_0&lt;/code&gt;, which makes the context cache half as big.&lt;/p&gt;

&lt;p&gt;And one thing I didn't have time to dig into. faster-whisper runs on CTranslate2, not PyTorch. But CTranslate2 only found cuBLAS and cuDNN when &lt;code&gt;torch&lt;/code&gt; had been imported before it. So the transcriber starts with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;  &lt;span class="c1"&gt;# noqa: F401
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;faster_whisper&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BatchedInferencePipeline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;WhisperModel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The import isn't used. Remove it and Whisper stops finding CUDA.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;The evening before the defense I put a 1 hour 25 minute lecture through the pipeline. From upload to "ready" it took &lt;strong&gt;14 minutes 16 seconds&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Extracting audio (ffmpeg)&lt;/td&gt;
&lt;td&gt;7 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transcription (Whisper)&lt;/td&gt;
&lt;td&gt;5 min 2 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indexing (BGE-M3)&lt;/td&gt;
&lt;td&gt;39 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Summary (Qwen3 4B)&lt;/td&gt;
&lt;td&gt;8 min 27 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Whisper itself took 4 minutes 56 seconds for 85 minutes of audio. That's about 17 times faster than real time, on a card with no tensor cores.&lt;/p&gt;

&lt;p&gt;Search works after six minutes. Everything after that is the 4B model writing the summary. That's 60% of the total time, and that's what a bigger card or a stronger model would speed up the most.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took from this
&lt;/h2&gt;

&lt;p&gt;I expected the hard part to be the models. It wasn't. The models are good, the libraries are good, and each of them works fine as long as it's alone on the card.&lt;/p&gt;

&lt;p&gt;The hard part was sharing. Which model gives memory back politely and which one crashes. Who holds a reference you forgot about. Which library caches what, and for how long.&lt;/p&gt;

&lt;p&gt;None of it is in the model docs, because each model is documented as if it's the only thing running on your GPU.&lt;/p&gt;

&lt;p&gt;With 6 GB it never is.&lt;/p&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>gpu</category>
    </item>
    <item>
      <title>I Moved From Go to FastAPI. It Felt Suspiciously Easy.</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Fri, 07 Aug 2026 19:46:03 +0000</pubDate>
      <link>https://dev.to/anxi0uz/i-moved-from-go-to-fastapi-it-felt-suspiciously-easy-3ck0</link>
      <guid>https://dev.to/anxi0uz/i-moved-from-go-to-fastapi-it-felt-suspiciously-easy-3ck0</guid>
      <description>&lt;p&gt;For quite a while, most of my backend code was written in Go.&lt;/p&gt;

&lt;p&gt;I built projects like Logiflow, a logistics backend with PostgreSQL, Redis, WebSockets, OSRM and monitoring, and Sentinel, an event-driven fraud detection project using Kafka and PostgreSQL.&lt;/p&gt;

&lt;p&gt;At some point I also got tired of setting up the same Go project structure over and over again, so I built &lt;code&gt;gofro&lt;/code&gt;, a small scaffolding CLI for generating the boring parts.&lt;/p&gt;

&lt;p&gt;I got used to the way Go backend projects feel.&lt;/p&gt;

&lt;p&gt;You create the server, configure the router, initialize the database, construct dependencies, pass them around, handle errors and gradually connect everything together.&lt;/p&gt;

&lt;p&gt;Then I started building LinkUp with Python and FastAPI.&lt;/p&gt;

&lt;p&gt;My first impression was simple:&lt;/p&gt;

&lt;p&gt;This felt suspiciously easy.&lt;/p&gt;

&lt;p&gt;Not because the project itself was easier, but because a surprising amount of code I was used to writing simply disappeared.&lt;/p&gt;

&lt;p&gt;After spending some time with FastAPI, I started to understand where that complexity actually went.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where did all the plumbing go?
&lt;/h2&gt;

&lt;p&gt;A typical Go project of mine has a fairly explicit structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmd/
internal/
    api/
    config/
    database/
    handler/
pkg/
migrations/
Dockerfile
Makefile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I like this approach.&lt;/p&gt;

&lt;p&gt;If something exists in the application, I can usually find where it was created and where it was passed.&lt;/p&gt;

&lt;p&gt;Routes are registered somewhere. Dependencies are constructed somewhere. Database connections are opened somewhere.&lt;/p&gt;

&lt;p&gt;When I started using FastAPI, the same things looked very different.&lt;/p&gt;

&lt;p&gt;For example, you can define a Pydantic model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RegisterRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;EmailStr&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use it directly in a route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@router.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/register&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;RegisterRequest&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FastAPI understands that &lt;code&gt;data&lt;/code&gt; comes from the request body. Pydantic validates it, FastAPI uses the same information for OpenAPI, and serialization is handled for you.&lt;/p&gt;

&lt;p&gt;When I first saw this, I had to stop for a moment and figure out how FastAPI knew what I wanted.&lt;/p&gt;

&lt;p&gt;In Go I was used to seeing more of this process explicitly.&lt;/p&gt;

&lt;p&gt;FastAPI did not remove request parsing or validation. It just moved them behind conventions built around Python type annotations.&lt;/p&gt;

&lt;p&gt;That became a recurring theme while learning it.&lt;/p&gt;

&lt;p&gt;Less visible code does not necessarily mean less happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I found &lt;code&gt;Depends&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Dependency injection felt even stranger at first.&lt;/p&gt;

&lt;p&gt;In LinkUp I have dependencies for things like the database session, Redis and the currently authenticated user.&lt;/p&gt;

&lt;p&gt;A database dependency can be represented roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SessionDep&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Annotated&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="n"&gt;AsyncSession&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Depends&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;get_session&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then another route or dependency simply asks for &lt;code&gt;SessionDep&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;FastAPI resolves it.&lt;/p&gt;

&lt;p&gt;Coming from Go, I was much more used to something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;NewServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything is visible right there.&lt;/p&gt;

&lt;p&gt;With FastAPI, you look at a function parameter and the framework basically says:&lt;/p&gt;

&lt;p&gt;"Yeah, I know a guy."&lt;/p&gt;

&lt;p&gt;At first this felt like magic.&lt;/p&gt;

&lt;p&gt;After using it for a while, it started making more sense. The dependency graph still exists. FastAPI just lets me describe part of it declaratively instead of wiring every dependency manually.&lt;/p&gt;

&lt;p&gt;I still prefer understanding where those dependencies come from, but I no longer find the approach strange.&lt;/p&gt;

&lt;p&gt;Most of the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;async def&lt;/code&gt; does not make everything asynchronous
&lt;/h2&gt;

&lt;p&gt;This was probably the most important adjustment.&lt;/p&gt;

&lt;p&gt;Go gave me a fairly straightforward application-level model of concurrency.&lt;/p&gt;

&lt;p&gt;If I want to start another concurrent task, I can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The runtime obviously does a lot behind that simple line, but goroutines are a normal part of how Go programs are written.&lt;/p&gt;

&lt;p&gt;Python async works differently.&lt;/p&gt;

&lt;p&gt;In FastAPI, it is very easy to look at this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(...):&lt;/span&gt;
    &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and mentally classify everything inside it as asynchronous.&lt;/p&gt;

&lt;p&gt;That is not how it works.&lt;/p&gt;

&lt;p&gt;I ran into a good example while implementing authentication in LinkUp.&lt;/p&gt;

&lt;p&gt;Passwords are hashed with Argon2. Argon2 is intentionally expensive. Making password hashing computationally expensive is part of its job.&lt;/p&gt;

&lt;p&gt;But Argon2 is still synchronous CPU work.&lt;/p&gt;

&lt;p&gt;Putting that call inside an &lt;code&gt;async def&lt;/code&gt; does not suddenly make it cooperate with the event loop.&lt;/p&gt;

&lt;p&gt;If the hashing operation runs directly on the event loop thread, the loop has to wait for it to finish.&lt;/p&gt;

&lt;p&gt;So in LinkUp, password hashing and verification are moved into a thread pool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hash_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;run_in_threadpool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;password_hash&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was a useful reminder that &lt;code&gt;async&lt;/code&gt; is not a property that spreads through the entire function.&lt;/p&gt;

&lt;p&gt;An async PostgreSQL driver can yield while waiting for network I/O.&lt;/p&gt;

&lt;p&gt;Redis can yield.&lt;/p&gt;

&lt;p&gt;An HTTP client can yield.&lt;/p&gt;

&lt;p&gt;CPU-bound synchronous work cannot do that automatically.&lt;/p&gt;

&lt;p&gt;It sounds obvious once you understand the model, but an endpoint full of &lt;code&gt;async&lt;/code&gt; keywords can make it easy to forget what is actually happening underneath.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQLAlchemy was familiar and unfamiliar at the same time
&lt;/h2&gt;

&lt;p&gt;The database side was another interesting part of the transition.&lt;/p&gt;

&lt;p&gt;The concepts were already familiar.&lt;/p&gt;

&lt;p&gt;A request needs a database session.&lt;/p&gt;

&lt;p&gt;Something fails, so the transaction should be rolled back.&lt;/p&gt;

&lt;p&gt;The session needs to be closed afterwards.&lt;/p&gt;

&lt;p&gt;None of that was new.&lt;/p&gt;

&lt;p&gt;The Python way of expressing it was.&lt;/p&gt;

&lt;p&gt;A simplified version of the LinkUp session dependency looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_session&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;session_factory&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rollback&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FastAPI uses the code before &lt;code&gt;yield&lt;/code&gt; as setup and the remaining part as teardown.&lt;/p&gt;

&lt;p&gt;I understood why the lifecycle worked this way before the syntax itself started feeling natural.&lt;/p&gt;

&lt;p&gt;That happened quite a lot while moving to Python.&lt;/p&gt;

&lt;p&gt;I was not relearning what a database transaction was. I was learning how the Python ecosystem usually expresses the same idea.&lt;/p&gt;

&lt;p&gt;That is a very different experience from learning backend development for the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual backend problems did not change much
&lt;/h2&gt;

&lt;p&gt;After the first few days, something else became obvious.&lt;/p&gt;

&lt;p&gt;Once I got past the syntax and framework conventions, most of the important questions were the same ones I already knew.&lt;/p&gt;

&lt;p&gt;LinkUp uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Argon2 password hashing&lt;/li&gt;
&lt;li&gt;short-lived JWT access tokens&lt;/li&gt;
&lt;li&gt;opaque refresh tokens stored in Redis&lt;/li&gt;
&lt;li&gt;refresh token rotation&lt;/li&gt;
&lt;li&gt;revocation on logout&lt;/li&gt;
&lt;li&gt;HttpOnly cookies&lt;/li&gt;
&lt;li&gt;PostgreSQL persistence&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The implementation is Python, but the questions are not Python-specific.&lt;/p&gt;

&lt;p&gt;When should a transaction commit?&lt;/p&gt;

&lt;p&gt;What happens if two registration requests try to create the same email?&lt;/p&gt;

&lt;p&gt;Where should refresh sessions live?&lt;/p&gt;

&lt;p&gt;Can a refresh token be reused?&lt;/p&gt;

&lt;p&gt;How should logout invalidate a session?&lt;/p&gt;

&lt;p&gt;What happens if a valid access token references a user that no longer exists?&lt;/p&gt;

&lt;p&gt;Python did not remove those problems.&lt;/p&gt;

&lt;p&gt;FastAPI just removed a lot of the repetitive framework code around them.&lt;/p&gt;

&lt;p&gt;That was probably the biggest change in how I looked at the framework.&lt;/p&gt;

&lt;p&gt;At first, fewer lines of code made the whole thing look simpler.&lt;/p&gt;

&lt;p&gt;Later I realized that the engineering was still there. The ratio between framework code and application code had changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go made me notice hidden complexity
&lt;/h2&gt;

&lt;p&gt;I think starting with Go affected the way I reacted to FastAPI.&lt;/p&gt;

&lt;p&gt;Go made me used to seeing plumbing.&lt;/p&gt;

&lt;p&gt;My Go projects tend to be fairly explicit about HTTP handlers, database access, context propagation, errors and infrastructure.&lt;/p&gt;

&lt;p&gt;Sentinel goes even further with Kafka consumers, explicit delivery semantics, worker pools and transactional persistence.&lt;/p&gt;

&lt;p&gt;I eventually wrote &lt;code&gt;gofro&lt;/code&gt; because I had repeated enough of the usual setup that generating part of it became convenient.&lt;/p&gt;

&lt;p&gt;Then I moved to FastAPI and suddenly request validation, dependency injection, OpenAPI generation and quite a lot of HTTP plumbing required very little code.&lt;/p&gt;

&lt;p&gt;My first instinct was to look for what I was missing.&lt;/p&gt;

&lt;p&gt;In practice, the abstraction is usually fine. I just need to know what it is doing.&lt;/p&gt;

&lt;p&gt;An &lt;code&gt;async def&lt;/code&gt; endpoint can still contain blocking code.&lt;/p&gt;

&lt;p&gt;An ORM can still produce an inefficient query.&lt;/p&gt;

&lt;p&gt;A dependency can have the wrong lifecycle.&lt;/p&gt;

&lt;p&gt;A Pydantic schema can model the wrong contract.&lt;/p&gt;

&lt;p&gt;A transaction can still be committed at the wrong time.&lt;/p&gt;

&lt;p&gt;FastAPI does not solve backend engineering.&lt;/p&gt;

&lt;p&gt;It mostly saves me from writing some of the repetitive parts of it.&lt;/p&gt;

&lt;p&gt;I like that distinction much more than simply saying FastAPI is "easier."&lt;/p&gt;

&lt;h2&gt;
  
  
  There are still things I miss about Go
&lt;/h2&gt;

&lt;p&gt;Python is much more concise for a lot of application code.&lt;/p&gt;

&lt;p&gt;There are places in my Go projects where the equivalent Python implementation would probably be much smaller.&lt;/p&gt;

&lt;p&gt;There is less repetitive error handling, less manual DTO plumbing and generally less code needed to express common web application behavior.&lt;/p&gt;

&lt;p&gt;But explicitness has advantages too.&lt;/p&gt;

&lt;p&gt;In Go, this is boring:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;especially after seeing it for the thousandth time.&lt;/p&gt;

&lt;p&gt;But I always know where the failure is being handled.&lt;/p&gt;

&lt;p&gt;In FastAPI, a small route can depend on several other functions, and part of its behavior may live somewhere deeper in that dependency graph.&lt;/p&gt;

&lt;p&gt;SQLAlchemy can express a query very compactly, but I still need to care about the SQL it eventually generates.&lt;/p&gt;

&lt;p&gt;Neither approach feels universally better to me.&lt;/p&gt;

&lt;p&gt;They just put complexity in different places.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part I liked most was realizing I did not start from zero
&lt;/h2&gt;

&lt;p&gt;This was probably the nicest part of switching stacks.&lt;/p&gt;

&lt;p&gt;My Python fluency was much lower than my familiarity with the backend problems I was trying to solve.&lt;/p&gt;

&lt;p&gt;Sometimes I had to look up a Python construction while already knowing exactly what I wanted the application to do.&lt;/p&gt;

&lt;p&gt;I could forget the syntax for an async generator dependency while still understanding why the database session needed cleanup.&lt;/p&gt;

&lt;p&gt;I could be unfamiliar with a particular SQLAlchemy API while already understanding the transaction boundary I wanted.&lt;/p&gt;

&lt;p&gt;I could still be getting used to &lt;code&gt;asyncio&lt;/code&gt; while knowing that running Argon2 directly on an event loop was a bad idea once I understood how the loop worked.&lt;/p&gt;

&lt;p&gt;The language changed.&lt;/p&gt;

&lt;p&gt;The framework changed.&lt;/p&gt;

&lt;p&gt;The libraries changed.&lt;/p&gt;

&lt;p&gt;PostgreSQL did not.&lt;/p&gt;

&lt;p&gt;Redis did not.&lt;/p&gt;

&lt;p&gt;HTTP did not.&lt;/p&gt;

&lt;p&gt;Transactions did not.&lt;/p&gt;

&lt;p&gt;Most of the problems simply appeared in a different form.&lt;/p&gt;

&lt;p&gt;I was not learning backend development again.&lt;/p&gt;

&lt;p&gt;I was translating what I already knew into another ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do I prefer FastAPI now?
&lt;/h2&gt;

&lt;p&gt;I still do not know.&lt;/p&gt;

&lt;p&gt;I am not sure I need to choose either.&lt;/p&gt;

&lt;p&gt;I like Go because the system often feels very visible. There is relatively little framework machinery between me and the application.&lt;/p&gt;

&lt;p&gt;I like FastAPI because I can describe a lot of application behavior with surprisingly little code.&lt;/p&gt;

&lt;p&gt;What changed after moving from one to the other is that I now look at convenient abstractions a little differently.&lt;/p&gt;

&lt;p&gt;Instead of assuming the complexity disappeared, I try to understand where it moved.&lt;/p&gt;

&lt;p&gt;FastAPI can make backend code feel very simple.&lt;/p&gt;

&lt;p&gt;Backend development itself is still the same problem.&lt;/p&gt;

</description>
      <category>python</category>
      <category>fastapi</category>
      <category>go</category>
      <category>backend</category>
    </item>
    <item>
      <title>SSH died. Spent 3 hours fixing the wrong thing.</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Wed, 20 May 2026 15:38:14 +0000</pubDate>
      <link>https://dev.to/anxi0uz/ssh-died-spent-3-hours-fixing-the-wrong-thing-4dlh</link>
      <guid>https://dev.to/anxi0uz/ssh-died-spent-3-hours-fixing-the-wrong-thing-4dlh</guid>
      <description>&lt;p&gt;Three or four days ago I deployed a Gitea runner, tested it, closed the terminal and moved on. Today, for some reason I don't even remember, I tried to SSH into the server. Nothing.&lt;/p&gt;

&lt;p&gt;Opened the browser to check if the server was alive — course project running, Gitea up, Nextcloud up, everything in the k3s cluster fine. Went into VMmanager, rebooted. Still couldn't get in. Closed The Boys and went to fix it through VNC.&lt;/p&gt;




&lt;h2&gt;
  
  
  nmap first
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-p&lt;/span&gt; 22 2.27.42.100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;PORT     STATE    SERVICE
22/tcp   filtered ssh
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;filtered&lt;/code&gt; — not closed, not refused. Packets reaching the server and getting silently dropped. Firewall somewhere.&lt;/p&gt;

&lt;p&gt;Checked the INPUT chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Chain INPUT (policy DROP)
1    KUBE-ROUTER-INPUT
2    ACCEPT     tcp dpt:22
3    KUBE-PROXY-FIREWALL
...
8    ufw-before-input
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ACCEPT rule for port 22 at position 2. Looked fine.&lt;/p&gt;

&lt;p&gt;Wasn't fine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where it actually breaks
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nft list ruleset | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"22|drop|DROP"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type filter hook input priority filter; policy drop;
...
tcp dport 22 counter packets 0 bytes 0 accept
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zero packets on the accept rule. Connections weren't reaching it at all.&lt;/p&gt;

&lt;p&gt;The server has both iptables-nft (kube-router, UFW) and native nftables running at the same time. They fight. kube-router constantly reconciles and overwrites stuff. The output was already warning about it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# Warning: table ip filter is managed by iptables-nft, do not touch!
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Gitea runner deploy from a few days ago triggered a reconciliation that messed up the rule ordering. I just hadn't tried SSH since then.&lt;/p&gt;




&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;Native nftables table at priority &lt;code&gt;-150&lt;/code&gt;. Runs before any filter chains (priority &lt;code&gt;0&lt;/code&gt;), before kube-router, before everything. kube-router only manages the iptables-nft layer — doesn't touch native nftables tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nft add table inet ssh_rescue
nft &lt;span class="s1"&gt;'add chain inet ssh_rescue input { type filter hook input priority -150; }'&lt;/span&gt;
nft add rule inet ssh_rescue input tcp dport 22 accept
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SSH came back. Wrote to my friend: "fixed". He said "eee". Made it a systemd service. Two minutes later wrote to him: "SSH died again".&lt;/p&gt;




&lt;h2&gt;
  
  
  Round two
&lt;/h2&gt;

&lt;p&gt;Back in VNC. Table still there, rules still there, zero packets on the accept rule again.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;systemctl start nftables&lt;/code&gt; had loaded the saved &lt;code&gt;/etc/nftables.conf&lt;/code&gt; which had kube-router's warning comments in it and corrupted the nftables state. Re-added the table manually. SSHed from the server to itself — worked. sshd on &lt;code&gt;0.0.0.0:22&lt;/code&gt; — fine. Still couldn't connect from outside.&lt;/p&gt;

&lt;p&gt;Then checked fail2ban, which had installed itself as a dependency somewhere during all this. It had banned two IPs — bots hammering port 22 the whole time. My repeated failed attempts got caught in the same drop. Ran &lt;code&gt;fail2ban-client unban --all&lt;/code&gt;, connected immediately.&lt;/p&gt;

&lt;p&gt;Then SSH died again. Disabled fail2ban completely — still nothing.&lt;/p&gt;




&lt;h2&gt;
  
  
  The actual reason
&lt;/h2&gt;

&lt;p&gt;I was in the middle of debugging nftables chains when I remembered — my VPN is self-hosted on a server in Finland. The day before I'd been complaining to my friend that the VPN was slow. The provider had sent an email:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Due to an increase in brute-force complaints via SSH (port 22), outgoing traffic on port 22 has been blocked for VPS servers located in Finland.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I had read it. I knew about it. And I spent three hours in VNC chasing nftables, fail2ban and kube-router while the answer was sitting in my inbox the whole time.&lt;/p&gt;

&lt;p&gt;Turned off the VPN. SSH connected immediately.&lt;/p&gt;




&lt;h2&gt;
  
  
  What to do from day one
&lt;/h2&gt;

&lt;p&gt;Add the ssh_rescue table before you need it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nft add table inet ssh_rescue
nft &lt;span class="s1"&gt;'add chain inet ssh_rescue input { type filter hook input priority -150; }'&lt;/span&gt;
nft add rule inet ssh_rescue input tcp dport 22 accept
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it a service so it survives reboots and kube-router reconciliation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /usr/local/bin/ssh-rescue.sh &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF2&lt;/span&gt;&lt;span class="sh"&gt;'
#!/bin/bash
nft list table inet ssh_rescue 2&amp;gt;/dev/null || {
    nft add table inet ssh_rescue
    nft add chain inet ssh_rescue input { type filter hook input priority -150; }
    nft add rule inet ssh_rescue input tcp dport 22 accept
}
&lt;/span&gt;&lt;span class="no"&gt;EOF2
&lt;/span&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /usr/local/bin/ssh-rescue.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After any deploy that touches networking — run &lt;code&gt;nmap -p 22 &amp;lt;ip&amp;gt;&lt;/code&gt; immediately.&lt;/p&gt;

&lt;p&gt;And read your damn emails.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>selfhosted</category>
      <category>devops</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>I got tired of setting up Go projects from scratch, so I built a scaffolding CLI</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Sun, 17 May 2026 13:37:39 +0000</pubDate>
      <link>https://dev.to/anxi0uz/i-got-tired-of-setting-up-go-projects-from-scratch-so-i-built-a-scaffolding-cli-33je</link>
      <guid>https://dev.to/anxi0uz/i-got-tired-of-setting-up-go-projects-from-scratch-so-i-built-a-scaffolding-cli-33je</guid>
      <description>&lt;p&gt;Before I wrote any actual business logic in my last project, I spent days just setting up the infrastructure around it. Parsing configs, writing Dockerfiles, wiring up Compose, connecting Postgres and Redis, getting the server to actually start. At some point I just gave up and went to play Dota instead.&lt;/p&gt;

&lt;p&gt;I'd done this before in .NET — &lt;code&gt;dotnet new&lt;/code&gt; generates a working project from a template in seconds. Go has nothing like that out of the box. So I built it.&lt;/p&gt;

&lt;p&gt;It's called &lt;a href="https://github.com/anxi0uz/gofro" rel="noopener noreferrer"&gt;gofro&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;One command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gofro new myapi &lt;span class="nt"&gt;--postgres&lt;/span&gt; &lt;span class="nt"&gt;--redis&lt;/span&gt; &lt;span class="nt"&gt;--grafana&lt;/span&gt; &lt;span class="nt"&gt;--github&lt;/span&gt; johndoe &lt;span class="nt"&gt;--git&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cmd/main.go&lt;/code&gt; with graceful shutdown wired up&lt;/li&gt;
&lt;li&gt;Config loading via koanf (TOML + env vars, env wins)&lt;/li&gt;
&lt;li&gt;Docker Compose with only the services you asked for&lt;/li&gt;
&lt;li&gt;Multi-stage Dockerfile&lt;/li&gt;
&lt;li&gt;pgxpool connection + goose migrations runner (if &lt;code&gt;--postgres&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;go-redis client (if &lt;code&gt;--redis&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Prometheus scrape config + Grafana in Compose (if &lt;code&gt;--grafana&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;OpenAPI spec + oapi-codegen setup so you can define your API and generate typed handlers&lt;/li&gt;
&lt;li&gt;Generic storage layer — &lt;code&gt;GetAll&lt;/code&gt;, &lt;code&gt;GetOne&lt;/code&gt;, &lt;code&gt;Create&lt;/code&gt;, &lt;code&gt;Update&lt;/code&gt;, &lt;code&gt;Delete&lt;/code&gt; over pgx&lt;/li&gt;
&lt;li&gt;Module path set to &lt;code&gt;github.com/johndoe/myapi&lt;/code&gt; automatically&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git init&lt;/code&gt; if you pass &lt;code&gt;--git&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then &lt;code&gt;go mod tidy&lt;/code&gt; and &lt;code&gt;docker compose up -d&lt;/code&gt; and you're writing actual code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I built this instead of using something existing
&lt;/h2&gt;

&lt;p&gt;Coming from .NET, &lt;code&gt;dotnet new&lt;/code&gt; was just there. Pick a template, get a project, start working. In Go I kept doing the same dance every time: copy the config parser from the last project, rewrite the Compose file, remember how pgxpool initialization works, set up graceful shutdown again.&lt;/p&gt;

&lt;p&gt;The last time I did it was for a college logistics platform. I had a tight deadline, hadn't touched Go in a while after a stressful hackathon, and spent way too long just building the scaffolding before writing a single handler. That's when I decided to just solve it once.&lt;/p&gt;

&lt;p&gt;gofro is opinionated. It picks the stack for you — chi for routing, koanf for config, pgx for Postgres, goose for migrations, oapi-codegen for API generation. If you want something different, it's probably not for you. But if you're fine with that stack, you skip a day of setup.&lt;/p&gt;




&lt;h2&gt;
  
  
  The flags
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--postgres    pgxpool + goose migrations + generic storage layer
--redis       go-redis/v9 client
--prometheus  Prometheus scrape config
--grafana     Grafana in Compose (enables --prometheus automatically)
--github      sets module path to github.com/&amp;lt;nick&amp;gt;/&amp;lt;project&amp;gt;
--module      full custom module path
--git         runs git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can mix and match. Minimal API with no databases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gofro new myapi &lt;span class="nt"&gt;--github&lt;/span&gt; johndoe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full stack with observability:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gofro new myapi &lt;span class="nt"&gt;--postgres&lt;/span&gt; &lt;span class="nt"&gt;--redis&lt;/span&gt; &lt;span class="nt"&gt;--prometheus&lt;/span&gt; &lt;span class="nt"&gt;--grafana&lt;/span&gt; &lt;span class="nt"&gt;--github&lt;/span&gt; johndoe &lt;span class="nt"&gt;--git&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What the generated project looks like
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapi/
├── cmd/
│   └── main.go              # graceful shutdown, signal handling, dependency wiring
├── configs/
│   ├── config.toml          # base config
│   └── prometheus.yml       # only with --prometheus
├── internal/
│   ├── api/
│   │   ├── api.swagger.yaml # define your endpoints here
│   │   ├── gen.go           # go:generate directive for oapi-codegen
│   │   └── oapi-codegen.yaml
│   ├── config/
│   │   └── config.go        # struct + koanf loader + DSN helpers
│   ├── database/
│   │   ├── postgres.go      # only with --postgres
│   │   └── redis.go         # only with --redis
│   └── handler/
│       └── server_impl.go   # Server struct, JSON(), Run()
├── pkg/
│   └── storage/
│       └── storage.go       # only with --postgres
├── migrations/              # only with --postgres
├── docker-compose.yml
├── Dockerfile
├── .env
└── Makefile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow after generation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define your API in &lt;code&gt;internal/api/api.swagger.yaml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;make generate&lt;/code&gt; — oapi-codegen produces typed models and the server interface&lt;/li&gt;
&lt;li&gt;Implement the interface methods on the &lt;code&gt;Server&lt;/code&gt; struct&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;docker compose up -d&lt;/code&gt; and &lt;code&gt;go run ./cmd/&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The generic storage layer
&lt;/h2&gt;

&lt;p&gt;This is the part I use in every project. It's built on &lt;code&gt;go-sqlbuilder&lt;/code&gt; and pgx, works with any struct via generics:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// SELECT with optional filter&lt;/span&gt;
&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetAll&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sqlbuilder&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SelectBuilder&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"active"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// SELECT one&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetOne&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sqlbuilder&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SelectBuilder&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ErrNotFound&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// INSERT&lt;/span&gt;
&lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// UPDATE — skips fields tagged `immutable` (like created_at)&lt;/span&gt;
&lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sqlbuilder&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UpdateBuilder&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fields tagged &lt;code&gt;db:"-"&lt;/code&gt; are skipped on insert. Fields tagged &lt;code&gt;immutable&lt;/code&gt; are skipped on update. No magic, just generics and struct tags.&lt;/p&gt;




&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/anxi0uz/gofro@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure &lt;code&gt;$(go env GOPATH)/bin&lt;/code&gt; is in your &lt;code&gt;$PATH&lt;/code&gt;. Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gofro new myproject &lt;span class="nt"&gt;--postgres&lt;/span&gt; &lt;span class="nt"&gt;--redis&lt;/span&gt; &lt;span class="nt"&gt;--github&lt;/span&gt; yourname &lt;span class="nt"&gt;--git&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;myproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Source: &lt;a href="https://github.com/anxi0uz/gofro" rel="noopener noreferrer"&gt;github.com/anxi0uz/gofro&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>cli</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My friend wanted GitLab. He got Gitea and Nextcloud for Obsidian instead.</title>
      <dc:creator>Alexey</dc:creator>
      <pubDate>Thu, 14 May 2026 14:22:41 +0000</pubDate>
      <link>https://dev.to/anxi0uz/my-friend-wanted-gitlab-he-got-gitea-and-nextcloud-for-obsidian-instead-500i</link>
      <guid>https://dev.to/anxi0uz/my-friend-wanted-gitlab-he-got-gitea-and-nextcloud-for-obsidian-instead-500i</guid>
      <description>&lt;p&gt;A friend sent me an article about GitHub potentially getting blocked in Russia and asked me to spin up GitLab. I suggested Gitea — I'd used it at a college hackathon, knew it was lightweight and wouldn't eat half the server. He agreed.&lt;/p&gt;

&lt;p&gt;While the deploy was running, I asked him how he syncs Obsidian. He said — plain WebDAV, nothing fancy. Well, server's already open anyway, so I threw in Nextcloud too. Hour and a half later I had both a git host and a cloud storage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why not GitLab
&lt;/h2&gt;

&lt;p&gt;My friend originally wanted GitLab. I opened the docs, looked at the requirements — 4 GB RAM just to start — and said no. We don't have a dedicated git server, there's already a project running on it. GitLab would've eaten everything.&lt;/p&gt;

&lt;p&gt;Gitea idles at ~150 MB. Actions are compatible with GitHub Actions syntax, so existing workflows move over without rewriting. I'd already used it at a hackathon, knew it worked fine. Suggested it, got the green light.&lt;/p&gt;




&lt;h2&gt;
  
  
  On Helm
&lt;/h2&gt;

&lt;p&gt;First time I touched Kubernetes was when I had to deploy a college project for a grade. Wrote manifests by hand — Deployment, Service, Ingress, PVC, repeat. I knew Helm existed but never had a reason to dig into it.&lt;/p&gt;

&lt;p&gt;Turns out it's like pacman, but for Kubernetes. One &lt;code&gt;values.yaml&lt;/code&gt; instead of five hundred lines of YAML, one command — everything's up. Would've lost my mind doing it the old way.&lt;/p&gt;

&lt;p&gt;First though, Helm couldn't see the cluster at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Kubernetes cluster unreachable: Get "http://localhost:8080/version"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;k3s puts the kubeconfig somewhere Helm doesn't look by default. Fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;KUBECONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/rancher/k3s/k3s.yaml
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Gitea
&lt;/h2&gt;

&lt;p&gt;The server already had ingress-nginx and cert-manager with a &lt;code&gt;letsencrypt-prod&lt;/code&gt; ClusterIssuer. Set the DNS beforehand — A record &lt;code&gt;git.logiflowadvanced.online → 2.27.42.100&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gitea-values.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;ingress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;ingressClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
  &lt;span class="na"&gt;hosts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git.logiflowadvanced.online&lt;/span&gt;
      &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
          &lt;span class="na"&gt;pathType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Prefix&lt;/span&gt;
  &lt;span class="na"&gt;tls&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;secretName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gitea-tls&lt;/span&gt;
      &lt;span class="na"&gt;hosts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git.logiflowadvanced.online&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;cert-manager.io/cluster-issuer&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;letsencrypt-prod&lt;/span&gt;

&lt;span class="na"&gt;gitea&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;admin&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;admin&lt;/span&gt;
    &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;yourpassword&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;your@email.com&lt;/span&gt;

&lt;span class="na"&gt;persistence&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10Gi&lt;/span&gt;

&lt;span class="na"&gt;postgresql-ha&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="na"&gt;postgresql&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm repo add gitea-charts https://dl.gitea.com/charts/
helm repo update
helm &lt;span class="nb"&gt;install &lt;/span&gt;gitea gitea-charts/gitea &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace&lt;/span&gt; gitea &lt;span class="nt"&gt;--create-namespace&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-f&lt;/span&gt; gitea-values.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pods came up. Opened the browser — invalid certificate, browser complaining. Checked the Ingress:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;NAME    CLASS    HOSTS                          ADDRESS   PORTS
&lt;/span&gt;&lt;span class="gp"&gt;gitea   &amp;lt;none&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;git.logiflowadvanced.online              80, 443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CLASS: &amp;lt;none&amp;gt;&lt;/code&gt; — the nginx controller just ignored this Ingress entirely. cert-manager didn't issue anything either, so nginx was serving its default self-signed cert.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl patch ingress gitea &lt;span class="nt"&gt;-n&lt;/span&gt; gitea &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;json &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'[{"op":"add","path":"/spec/ingressClassName","value":"nginx"}]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the patch, cert-manager issued the certificate and the site opened fine.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSH
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;gitea-ssh&lt;/code&gt; is created as a headless ClusterIP by default — not reachable from outside. Port 22 is taken by the system SSH, so I needed a NodePort. You can't patch a headless service into NodePort — have to delete and recreate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl delete svc gitea-ssh &lt;span class="nt"&gt;-n&lt;/span&gt; gitea

kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; - &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
apiVersion: v1
kind: Service
metadata:
  name: gitea-ssh
  namespace: gitea
spec:
  type: NodePort
  selector:
    app.kubernetes.io/name: gitea
  ports:
    - port: 22
      targetPort: 2222
      nodePort: 30022
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remote looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add gitea ssh://git@git.logiflowadvanced.online:30022/username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Nextcloud
&lt;/h2&gt;

&lt;p&gt;Set up the DNS for &lt;code&gt;cloud.logiflowadvanced.online&lt;/code&gt; while Gitea was still deploying.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nextcloud-values.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;ingress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;ingressClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nginx&lt;/span&gt;
  &lt;span class="na"&gt;hosts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cloud.logiflowadvanced.online&lt;/span&gt;
      &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
          &lt;span class="na"&gt;pathType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Prefix&lt;/span&gt;
  &lt;span class="na"&gt;tls&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;secretName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nextcloud-tls&lt;/span&gt;
      &lt;span class="na"&gt;hosts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;cloud.logiflowadvanced.online&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;cert-manager.io/cluster-issuer&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;letsencrypt-prod&lt;/span&gt;
    &lt;span class="na"&gt;nginx.ingress.kubernetes.io/proxy-body-size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0"&lt;/span&gt;

&lt;span class="na"&gt;nextcloud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cloud.logiflowadvanced.online&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;admin&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;yourpassword&lt;/span&gt;

&lt;span class="na"&gt;mariadb&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;yourdbpassword&lt;/span&gt;
    &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nextcloud&lt;/span&gt;
    &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nextcloud&lt;/span&gt;

&lt;span class="na"&gt;postgresql&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="na"&gt;persistence&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10Gi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm &lt;span class="nb"&gt;install &lt;/span&gt;nextcloud nextcloud/nextcloud &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace&lt;/span&gt; nextcloud &lt;span class="nt"&gt;--create-namespace&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-f&lt;/span&gt; nextcloud-values.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same &lt;code&gt;ingressClassName&lt;/code&gt; issue — same patch, same result.&lt;/p&gt;

&lt;p&gt;After the first login it kept redirecting to &lt;code&gt;/login/cleary?=1&lt;/code&gt;. Nextcloud didn't know its own external address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; nextcloud deploy/nextcloud &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  php occ config:system:set overwriteprotocol &lt;span class="nt"&gt;--value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https"&lt;/span&gt;
kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; nextcloud deploy/nextcloud &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  php occ config:system:set overwrite.cli.url &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://cloud.logiflowadvanced.online"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Obsidian
&lt;/h3&gt;

&lt;p&gt;Created separate users for me and my friend. WebDAV URL per user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://cloud.logiflowadvanced.online/remote.php/dav/files/username/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the RemotelySave plugin: type — WebDAV, URL, login, password. Works.&lt;/p&gt;




&lt;p&gt;The thing that ate most of my time wasn't Gitea or Nextcloud — it was &lt;code&gt;ingressClassName&lt;/code&gt;. Neither chart sets it automatically, and without it nginx just ignores the Ingress completely. cert-manager doesn't issue anything. Browser shows self-signed, you stare at the logs, pods are all Running, no errors anywhere.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;kubectl get ingress -n &amp;lt;namespace&amp;gt;&lt;/code&gt; right after deploy. If CLASS says &lt;code&gt;&amp;lt;none&amp;gt;&lt;/code&gt; — that's your problem.&lt;/p&gt;

&lt;p&gt;The other non-obvious one: &lt;code&gt;gitea-ssh&lt;/code&gt; is headless and you can't patch it into a NodePort — you have to delete and recreate it. Spent a few minutes trying to patch it before actually reading the error.&lt;/p&gt;

&lt;p&gt;With Nextcloud and MariaDB — if MariaDB didn't come up on the first deploy or you uninstalled and reinstalled, helm will complain about credential mismatch on upgrade. Just &lt;code&gt;helm uninstall&lt;/code&gt; + &lt;code&gt;kubectl delete pvc --all -n nextcloud&lt;/code&gt; and start fresh, it's faster than untangling the creds.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>git</category>
      <category>selfhosted</category>
    </item>
  </channel>
</rss>
