<?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: Benjamin Touchard</title>
    <description>The latest articles on DEV Community by Benjamin Touchard (@benjy33000).</description>
    <link>https://dev.to/benjy33000</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%2F1740181%2F3f1038da-05fb-410f-832b-0bd4c2f84fc9.png</url>
      <title>DEV Community: Benjamin Touchard</title>
      <link>https://dev.to/benjy33000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benjy33000"/>
    <language>en</language>
    <item>
      <title>Why I built Maintenant after a full disk took down my Postgres</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Wed, 25 Nov 2026 09:37:31 +0000</pubDate>
      <link>https://dev.to/benjy33000/why-i-built-maintenant-after-a-full-disk-took-down-my-postgres-9l0</link>
      <guid>https://dev.to/benjy33000/why-i-built-maintenant-after-a-full-disk-took-down-my-postgres-9l0</guid>
      <description>&lt;h2&gt;
  
  
  My stack monitoring was driving me crazy
&lt;/h2&gt;

&lt;p&gt;Like many developers who self-host, I run about a dozen services across VPS instances. Nextcloud, Vaultwarden, a few APIs, some workers, databases. The kind of typical setup you see all over r/selfhosted.&lt;/p&gt;

&lt;p&gt;For years, my monitoring looked like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Uptime Kuma&lt;/strong&gt; for HTTP checks: a great tool, but completely unaware of containers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Healthchecks.io&lt;/strong&gt; for cron jobs: SaaS, which bothered me from a data sovereignty standpoint&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A bash script&lt;/strong&gt; that checked disk space and sent me an email&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing at all&lt;/strong&gt; for SSL certificates: I checked them manually whenever I remembered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Five disconnected tools. Five dashboards. Five configurations to maintain. And above all, no unified overview.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wake-up call
&lt;/h2&gt;

&lt;p&gt;One Friday night, my Nextcloud instance went down. The underlying PostgreSQL container had crashed because the disk was full. Uptime Kuma alerted me that Nextcloud was unresponsive, 20 minutes after the crash. But it couldn't tell me &lt;em&gt;why&lt;/em&gt;: it only saw the HTTP endpoint, not the container state, not the disk usage, not the error logs.&lt;/p&gt;

&lt;p&gt;I spent 45 minutes diagnosing a problem that proper monitoring would have caught in seconds.&lt;/p&gt;

&lt;p&gt;That evening, I opened a &lt;code&gt;main.go&lt;/code&gt; file and started writing Maintenant.&lt;/p&gt;

&lt;h2&gt;
  
  
  The founding principles
&lt;/h2&gt;

&lt;p&gt;Three convictions guided every design decision:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A single container.&lt;/strong&gt; If your monitoring tool itself requires a 3-container stack (hello Grafana + Prometheus + cAdvisor), something is wrong. Maintenant is a single Go binary with the frontend embedded via &lt;code&gt;embed.FS&lt;/code&gt; and SQLite as its database. &lt;code&gt;docker compose up -d&lt;/code&gt; and you're done.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero configuration.&lt;/strong&gt; Maintenant connects to the Docker socket and automatically discovers all your containers. No YAML to write. No Prometheus targets to declare. Your containers show up in the dashboard within seconds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaoq999o11k1upqypgx4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaoq999o11k1upqypgx4.webp" alt="Unified dashboard: global uptime, response times, resources" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All-in-one.&lt;/strong&gt; Containers, HTTP/TCP endpoints, heartbeats/cron, SSL certificates, system metrics, update detection, all in a single dashboard. One source of truth for the state of your infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdeyobigh2w01x9xvb73v.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdeyobigh2w01x9xvb73v.webp" alt="Container auto-discovery: states, resources, Compose projects" width="799" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned along the way
&lt;/h2&gt;

&lt;p&gt;The biggest technical challenge wasn't the monitoring itself. It was automatic runtime detection. Maintenant supports both Docker and Kubernetes, and it detects which one is available at startup. On Kubernetes, it uses the service account with read-only RBAC to discover workloads.&lt;/p&gt;

&lt;p&gt;The other lesson: simplicity is a feature. Every time I was tempted to add a configuration option, I asked myself: "Can I detect this automatically?" The answer was usually yes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The core is open source under the Apache 2.0 license: &lt;a href="https://github.com/kolapsis/maintenant" rel="noopener noreferrer"&gt;https://github.com/kolapsis/maintenant&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you self-host and you're tired of juggling several monitoring tools, or if you simply have no monitoring at all, I'd like to hear what you think of it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://maintenant.dev/blog/why-i-built-maintenant/" rel="noopener noreferrer"&gt;maintenant.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintenant&lt;/strong&gt; is an open-source, self-hosted monitoring tool for Docker and Kubernetes: containers, endpoints, cron heartbeats, TLS certificates and alerts, in one container that discovers your stack on its own. Install it in a minute: &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;https://maintenant.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This project was funded by the French Government as part of the France 2030 plan operated by Bpifrance.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" alt="France 2030 and Cap Digital" width="174" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>selfhosted</category>
      <category>docker</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Back up an OpenLDAP directory: two exports, one reload, four checks</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Fri, 20 Nov 2026 09:58:17 +0000</pubDate>
      <link>https://dev.to/benjy33000/back-up-an-openldap-directory-two-exports-one-reload-four-checks-4jil</link>
      <guid>https://dev.to/benjy33000/back-up-an-openldap-directory-two-exports-one-reload-four-checks-4jil</guid>
      <description>&lt;p&gt;A directory is the front door to everything else. When it does not come back,&lt;br&gt;
nobody signs in to anything — and it is the kind of backup you discover is&lt;br&gt;
incomplete the day you need it, because an LDIF export of a live directory looks&lt;br&gt;
perfectly valid right up to the moment you try to reload it onto a fresh server.&lt;/p&gt;

&lt;p&gt;This guide covers the whole chain. By the end you will know why a directory&lt;br&gt;
backup is two exports and not one, what &lt;code&gt;slapcat&lt;/code&gt; guarantees that &lt;code&gt;ldapsearch&lt;/code&gt;&lt;br&gt;
does not, what your LDIF really contains — including what will make the reload&lt;br&gt;
fail —, how to reload the export by hand in a throwaway container, and which&lt;br&gt;
four &lt;code&gt;ldapsearch&lt;/code&gt; commands tell you a restored directory is usable.&lt;/p&gt;

&lt;p&gt;Everything here works with the OpenLDAP tools, &lt;code&gt;docker&lt;/code&gt; and the AWS CLI, and nothing else.&lt;/p&gt;
&lt;h2&gt;
  
  
  A directory backup is two exports
&lt;/h2&gt;

&lt;p&gt;An OpenLDAP directory lives in two databases, and a backup that takes only one&lt;br&gt;
of them does not reload.&lt;/p&gt;

&lt;p&gt;The first is the data tree: your organisational units, your accounts, your&lt;br&gt;
groups. That is the one everybody exports, with &lt;code&gt;slapcat&lt;/code&gt; or with &lt;code&gt;ldapsearch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The second is the configuration tree, &lt;code&gt;cn=config&lt;/code&gt;: the schemas, the access&lt;br&gt;
rules, the loaded overlays, the indexes. It holds none of your accounts, and yet&lt;br&gt;
it is the one that decides whether the data export can be reloaded at all. A&lt;br&gt;
directory that picked up a home-made attribute over the years — &lt;code&gt;employeeRef&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;caseNumber&lt;/code&gt;, anything a business application added — describes that attribute&lt;br&gt;
in &lt;code&gt;cn=config&lt;/code&gt;, and nowhere else. Without that export, you have a data file that&lt;br&gt;
the restore server refuses to write, entry after entry, without knowing why.&lt;/p&gt;

&lt;p&gt;Forgetting &lt;code&gt;cn=config&lt;/code&gt; also costs you the access rules. A directory reloaded&lt;br&gt;
without them is a directory whose entries are all there and whose applications&lt;br&gt;
no longer read what they used to read.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;code&gt;slapcat&lt;/code&gt; cold, &lt;code&gt;ldapsearch&lt;/code&gt; hot
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;slapcat&lt;/code&gt; reads the database files directly, on the server, without going&lt;br&gt;
through &lt;code&gt;slapd&lt;/code&gt;. It is fast, it uses no connection, it is subject to no size&lt;br&gt;
limit — but it reads a database that moves. An export taken while writes are&lt;br&gt;
coming in can hold one entry in its state before a change and another in its&lt;br&gt;
state after. For a directory that is almost never serious: entries are&lt;br&gt;
independent. It becomes serious when the change in flight touches an account and&lt;br&gt;
the group that references it: you get a group pointing at a member that is not&lt;br&gt;
there. The only genuinely frozen export is the one taken with &lt;code&gt;slapd&lt;/code&gt; stopped.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ldapsearch&lt;/code&gt; goes through the server, and so needs neither disk access nor a&lt;br&gt;
service outage: it runs from any machine that can reach port 389. Every entry it&lt;br&gt;
returns is consistent, but the whole is no more consistent than with &lt;code&gt;slapcat&lt;/code&gt;:&lt;br&gt;
the read happens entry by entry, with no frozen view.&lt;/p&gt;

&lt;p&gt;Two traps are its own. The server applies a size limit to results —&lt;br&gt;
&lt;code&gt;sizelimit&lt;/code&gt;, 500 entries by default in &lt;code&gt;slapd&lt;/code&gt;: past that it stops, and your&lt;br&gt;
export stops with it. Take the export with the directory's administrator&lt;br&gt;
account, which is not subject to it, and look at the exit code. And by default&lt;br&gt;
&lt;code&gt;ldapsearch&lt;/code&gt; only returns application attributes: you have to ask for &lt;code&gt;"*" "+"&lt;/code&gt;&lt;br&gt;
to also get what the server built.&lt;/p&gt;
&lt;h2&gt;
  
  
  What the LDIF really contains
&lt;/h2&gt;

&lt;p&gt;Three things people usually discover at reload time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The passwords are in there, as hashes.&lt;/strong&gt; A &lt;code&gt;userPassword: {SSHA}xxxxx&lt;/code&gt;&lt;br&gt;
reloads as it is, and the account signs in with its original password. Two&lt;br&gt;
consequences: the export file is worth exactly what the directory is worth, so&lt;br&gt;
it is protected the same way; and the only check that proves people will still&lt;br&gt;
get in is a successful authentication after the restore, not a count of entries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operational attributes belong to the server.&lt;/strong&gt; &lt;code&gt;entryUUID&lt;/code&gt;, &lt;code&gt;entryCSN&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;structuralObjectClass&lt;/code&gt;, &lt;code&gt;creatorsName&lt;/code&gt;, &lt;code&gt;createTimestamp&lt;/code&gt;, &lt;code&gt;modifiersName&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;modifyTimestamp&lt;/code&gt;, &lt;code&gt;entryDN&lt;/code&gt;, &lt;code&gt;contextCSN&lt;/code&gt;, &lt;code&gt;memberOf&lt;/code&gt;, the password-policy&lt;br&gt;
attributes in &lt;code&gt;pwd…&lt;/code&gt;: the server builds them itself and refuses to have them&lt;br&gt;
written. A &lt;code&gt;slapcat&lt;/code&gt; export, or an &lt;code&gt;ldapsearch&lt;/code&gt; with &lt;code&gt;"+"&lt;/code&gt;, contains all of them&lt;br&gt;
— they have to be stripped before reloading. &lt;code&gt;memberOf&lt;/code&gt; is the most misleading&lt;br&gt;
case: it is computed by an overlay from the groups, and reimporting it amounts&lt;br&gt;
to freezing memberships the server is going to recompute on its side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom schemas live elsewhere.&lt;/strong&gt; The entries carrying a home-made attribute&lt;br&gt;
depend on it, and that attribute is not in the data export. That is the whole&lt;br&gt;
point of the second export.&lt;/p&gt;
&lt;h2&gt;
  
  
  The backup script
&lt;/h2&gt;

&lt;p&gt;On the directory server, both exports and their upload:&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="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail

&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;date +%Y%m%d_%H%M%S&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://backups-directory/ldap

slapcat -n 0 -o ldif-wrap=no &lt;span class="o"&gt;|&lt;/span&gt; gzip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/config_${ts}.ldif.gz"&lt;/span&gt;
slapcat -n 1 -o ldif-wrap=no &lt;span class="o"&gt;|&lt;/span&gt; gzip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/directory_${ts}.ldif.gz"&lt;/span&gt;

aws s3 cp &lt;span class="s2"&gt;"/backups/config_${ts}.ldif.gz"&lt;/span&gt; &lt;span class="s2"&gt;"${dest}/"&lt;/span&gt;
aws s3 cp &lt;span class="s2"&gt;"/backups/directory_${ts}.ldif.gz"&lt;/span&gt; &lt;span class="s2"&gt;"${dest}/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-n 0&lt;/code&gt; names the configuration database, &lt;code&gt;-n 1&lt;/code&gt; the first data database.&lt;br&gt;
&lt;code&gt;-o ldif-wrap=no&lt;/code&gt; stops long lines from being folded at 78 columns: without it,&lt;br&gt;
a long attribute is cut and continues on the next line, preceded by a space. A&lt;br&gt;
folded file reloads perfectly well, but it can no longer be filtered line by&lt;br&gt;
line — and that is exactly what you are about to have to do.&lt;/p&gt;

&lt;p&gt;If you have no shell access to the directory server, the data export is taken&lt;br&gt;
remotely, along the same lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ldapsearch -x -H ldap://ldap.internal \
  -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="s2"&gt;"$LDAP_ADMIN_PASSWORD"&lt;/span&gt; \
  -b &lt;span class="nv"&gt;dc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example,dc=com -LLL -o ldif-wrap=no &lt;span class="s2"&gt;"(objectClass=*)"&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt; &lt;span class="s2"&gt;"+"&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; gzip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/directory_${ts}.ldif.gz"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Without &lt;code&gt;pipefail&lt;/code&gt;, a failed export comes out as a success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;slapcat | gzip&lt;/code&gt;, the shell only looks at the exit code of the last link.&lt;br&gt;
&lt;code&gt;gzip&lt;/code&gt; succeeds at compressing an empty stream, so the script returns 0 and&lt;br&gt;
cron is happy. &lt;code&gt;set -o pipefail&lt;/code&gt; — included in the &lt;code&gt;set -euo pipefail&lt;/code&gt;&lt;br&gt;
above — makes the whole line fail as soon as &lt;code&gt;slapcat&lt;/code&gt; fails. It is the&lt;br&gt;
number one cause of empty backups that stay green for months.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep the timestamp in the file names, and keep both exports of the same&lt;br&gt;
timestamp together: a schema that does not match the data being reloaded is of&lt;br&gt;
no use. For retention, a lifecycle rule on the bucket deletes objects older than&lt;br&gt;
N days with no script to maintain.&lt;/p&gt;
&lt;h2&gt;
  
  
  Reloading once, by hand
&lt;/h2&gt;

&lt;p&gt;An export is only proven once reloaded, onto a server that knows nothing about&lt;br&gt;
the old one. A throwaway container is enough.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run -d --name ldap-test \
  -e &lt;span class="nv"&gt;LDAP_ROOT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;dc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example,dc=com \
  -e &lt;span class="nv"&gt;LDAP_ADMIN_USERNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin \
  -e &lt;span class="nv"&gt;LDAP_ADMIN_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test&lt;/span&gt; \
  -e &lt;span class="nv"&gt;LDAP_SKIP_DEFAULT_TREE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yes \
  -e &lt;span class="nv"&gt;LDAP_CONFIG_ADMIN_ENABLED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yes \
  -e &lt;span class="nv"&gt;LDAP_CONFIG_ADMIN_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;test-config \
  bitnamilegacy/openldap:2.6.10-debian-12-r4

&lt;span class="k"&gt;until&lt;/span&gt; docker &lt;span class="nb"&gt;exec&lt;/span&gt; ldap-test ldapsearch -x -H ldap://localhost:1389 \
  -b &lt;span class="s2"&gt;""&lt;/span&gt; -s base namingContexts &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; sleep 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;LDAP_SKIP_DEFAULT_TREE&lt;/code&gt; is essential: without it, the image creates its own&lt;br&gt;
demonstration tree under &lt;code&gt;LDAP_ROOT&lt;/code&gt;, and those entries collide with yours at&lt;br&gt;
reload time ("entry already exists"). A perfectly restorable export then fails&lt;br&gt;
for a reason that has nothing to do with it.&lt;/p&gt;

&lt;p&gt;That leaves stripping the operational attributes and loading the data. This is&lt;br&gt;
where the &lt;code&gt;ldif-wrap=no&lt;/code&gt; of the export pays off: the filter works line by line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gunzip -c /backups/directory_20260918_030000.ldif.gz \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -viE &lt;span class="s1"&gt;'^(structuralObjectClass|entryUUID|entryCSN|creatorsName|createTimestamp|modifiersName|modifyTimestamp|entryDN|subschemaSubentry|hasSubordinates|numSubordinates|contextCSN|memberOf|pwd[A-Za-z]+):'&lt;/span&gt; \
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/directory.ldif

docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i ldap-test ldapadd -x -H ldap://localhost:1389 \
  -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; /tmp/directory.ldif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a directory with a custom schema, this is where it stops:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adding new entry "cn=camille.durand,ou=people,dc=example,dc=com"
ldap_add: Undefined attribute type (17)
    additional info: employeeRef: attribute type undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ldapadd&lt;/code&gt; stops on the first entry carrying an attribute the server does not&lt;br&gt;
know, and says nothing about the next ones. An export that uses three of them&lt;br&gt;
therefore takes three full reloads to diagnose, and you only learn about the&lt;br&gt;
next missing one once you have fixed the previous one.&lt;/p&gt;

&lt;p&gt;The fix is in the &lt;code&gt;cn=config&lt;/code&gt; export. You do not replay it whole onto a fresh&lt;br&gt;
server: it describes the file paths, the databases and the overlays of the old&lt;br&gt;
server. What you take out of it are the schema entries, under&lt;br&gt;
&lt;code&gt;cn=schema,cn=config&lt;/code&gt;, and only the ones your applications added — &lt;code&gt;core&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;cosine&lt;/code&gt;, &lt;code&gt;inetorgperson&lt;/code&gt; and &lt;code&gt;nis&lt;/code&gt; are already in the image. A schema entry&lt;br&gt;
looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dn: cn=myschema,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: myschema
olcAttributeTypes: ( 1.3.6.1.4.1.99999.1.1 NAME 'employeeRef' DESC 'HR employee number' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
olcObjectClasses: ( 1.3.6.1.4.1.99999.1.2 NAME 'employee' SUP top AUXILIARY MAY ( employeeRef ) )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It loads into the configuration tree, with that tree's administrator account —&lt;br&gt;
which is not the directory's — &lt;strong&gt;before&lt;/strong&gt; the data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i ldap-test ldapadd -x -H ldap://localhost:1389 \
  -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,cn=config -w test-config &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; /tmp/schema.ldif

docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i ldap-test ldapadd -x -H ldap://localhost:1389 \
  -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; /tmp/directory.ldif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is also the order you will have to replay them in the day you restore for&lt;br&gt;
real. Note how long it took: that is your real restore duration, the only one&lt;br&gt;
worth comparing to the delay you promised.&lt;/p&gt;
&lt;h2&gt;
  
  
  What to check in a reloaded directory
&lt;/h2&gt;

&lt;p&gt;A reload that ran without an error does not mean the directory is usable. Four&lt;br&gt;
questions, in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ldapsearch -x -H ldap://localhost:1389 -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="nb"&gt;test&lt;/span&gt; \
  -b &lt;span class="nv"&gt;ou&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;people,dc=example,dc=com -LLL &lt;span class="s2"&gt;"(objectClass=inetOrgPerson)"&lt;/span&gt; dn \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -c &lt;span class="s1"&gt;'^dn:'&lt;/span&gt;

ldapsearch -x -H ldap://localhost:1389 -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="nb"&gt;test&lt;/span&gt; \
  -b &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;camille.durand,ou=people,dc=example,dc=com -s base -LLL dn

ldapsearch -x -H ldap://localhost:1389 -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc=example,dc=com -w &lt;span class="nb"&gt;test&lt;/span&gt; \
  -b &lt;span class="nv"&gt;ou&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;groups,dc=example,dc=com -LLL &lt;span class="s2"&gt;"(cn=support)"&lt;/span&gt; member

ldapsearch -x -H ldap://localhost:1389 \
  -D &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;camille.durand,ou=people,dc=example,dc=com -w &lt;span class="s2"&gt;"$CAMILLE_PASSWORD"&lt;/span&gt; \
  -b &lt;span class="s2"&gt;""&lt;/span&gt; -s base -LLL namingContexts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The accounts are there.&lt;/strong&gt; Compare against the order of magnitude in
production, not an exact number. And check the command's exit code: if the
server hit its size limit, the count is wrong on the low side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A known account is there, that one precisely.&lt;/strong&gt; Six entries are not
necessarily &lt;strong&gt;the&lt;/strong&gt; right six: looking an entry up by its full DN is stronger
than a count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The memberships are there.&lt;/strong&gt; Groups decide privileges. A directory reloaded
without its &lt;code&gt;member&lt;/code&gt; values is a directory where everyone lost their access —
and it is the first symptom of a &lt;code&gt;memberOf&lt;/code&gt; reimported in place of the groups
themselves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The passwords work.&lt;/strong&gt; That last command queries nothing useful: it
authenticates as &lt;code&gt;camille.durand&lt;/code&gt;. It is the only one that proves the hashes
came back usable. An export that reloads everything except the
&lt;code&gt;userPassword&lt;/code&gt; values gives a directory that looks perfect and lets nobody
in.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then destroy everything: &lt;code&gt;docker rm -f ldap-test&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this chain does not prove
&lt;/h2&gt;

&lt;p&gt;It proves that the most recent export reloads into a fresh OpenLDAP, that the&lt;br&gt;
expected entries and groups are there, and that a restored account still&lt;br&gt;
authenticates.&lt;/p&gt;

&lt;p&gt;It does not prove that the rest of &lt;code&gt;cn=config&lt;/code&gt; came back: the access rules, the&lt;br&gt;
overlays and the indexes are not replayed in the throwaway container above, only the schemas are.&lt;br&gt;
It says nothing about replication between your servers, and nothing about how old the export is: a March directory reloads perfectly in September. And the reloaded&lt;br&gt;
directory is not identical byte for byte to the original: the operational&lt;br&gt;
attributes were rebuilt by the test server, which is just as well — what&lt;br&gt;
matters to you is that your users sign back in. Finally, it says nothing about&lt;br&gt;
what has been created since the last export: that gap is your RPO, and it is&lt;br&gt;
tuned with the backup frequency, not with the tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is an LDIF export of the right size good enough?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. A complete data export does not reload onto a fresh server as soon as the&lt;br&gt;
directory uses a custom attribute: &lt;code&gt;ldapadd&lt;/code&gt; stops on the first entry carrying&lt;br&gt;
it. File size says nothing about that, and nothing either about the operational&lt;br&gt;
attributes you have to strip before replaying it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is in &lt;code&gt;cn=config&lt;/code&gt;, and why back it up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The schemas, the access rules, the loaded overlays and the indexes. None of your&lt;br&gt;
accounts. Yet it is that export which makes the other one reloadable: the custom&lt;br&gt;
attributes your entries depend on are described there, and nowhere else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you have to stop &lt;code&gt;slapd&lt;/code&gt; to take a backup?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For a genuinely frozen export, yes. Taken hot, entries stay individually&lt;br&gt;
consistent, but a group and the account it references can be captured on either&lt;br&gt;
side of a change. On most directories that trade-off is worth it; on a directory&lt;br&gt;
that changes constantly, stopping the service is the only export without&lt;br&gt;
surprises.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why can a restored account no longer sign in?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because the &lt;code&gt;userPassword&lt;/code&gt; values were not reloaded, or not as they were. The&lt;br&gt;
LDIF holds them as hashes, which replay identically — but a filtered export, or&lt;br&gt;
one taken by an account that cannot read them, gives a directory that looks&lt;br&gt;
perfect and lets nobody in. Only a successful authentication after the restore&lt;br&gt;
proves otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does an &lt;code&gt;ldapsearch&lt;/code&gt; export stop at 500 entries?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because the server applies a size limit to results, &lt;code&gt;sizelimit&lt;/code&gt;, set to 500&lt;br&gt;
entries by default in &lt;code&gt;slapd&lt;/code&gt;. Past that the search stops and the export stops&lt;br&gt;
with it, on a file that looks perfectly normal. Take the export with the&lt;br&gt;
directory's administrator account, which is not subject to it, and read the&lt;br&gt;
command's exit code.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://restoreproof.io/blog/back-up-an-openldap-directory" rel="noopener noreferrer"&gt;restoreproof.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RestoreProof&lt;/strong&gt; runs this kind of restore test on a schedule, inside your own infrastructure, and signs a report proving the backup restores. Your data never leaves your servers. Free plan, no credit card: &lt;a href="https://app.restoreproof.io" rel="noopener noreferrer"&gt;https://app.restoreproof.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>backup</category>
      <category>devops</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Keeping a SaaS in the EU: what self-hosting answers, and what it does not</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Wed, 18 Nov 2026 08:23:54 +0000</pubDate>
      <link>https://dev.to/benjy33000/keeping-a-saas-in-the-eu-what-self-hosting-answers-and-what-it-does-not-1f7j</link>
      <guid>https://dev.to/benjy33000/keeping-a-saas-in-the-eu-what-self-hosting-answers-and-what-it-does-not-1f7j</guid>
      <description>&lt;p&gt;"Where is the data?" is the second question every European enterprise buyer&lt;br&gt;
asks, right after the price. If your answer requires a diagram with five&lt;br&gt;
vendors on it, the deal slows down. If it is one sentence, it does not.&lt;/p&gt;

&lt;p&gt;This post separates what self-hosting actually settles from what you still&lt;br&gt;
have to do — because pretending a technical choice is compliance would be&lt;br&gt;
dishonest and would fail your first audit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What self-hosting settles
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Data residency.&lt;/strong&gt; Choose a server in Frankfurt, Paris or Amsterdam and the&lt;br&gt;
database, the sessions, the uploaded files and the logs are there. No&lt;br&gt;
region-by-service map, no "the control plane is in us-east-1 but your data is&lt;br&gt;
not", no surprise when a vendor adds a processing region.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The sub-processor list.&lt;/strong&gt; Every managed service in your stack is a&lt;br&gt;
processor you must name, contract with, and keep an eye on. A self-hosted&lt;br&gt;
binary has one entry: your hosting provider. If you also use a payment&lt;br&gt;
provider and an email relay — most products do — that is three, and each one&lt;br&gt;
is there for a reason you can explain in a sentence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transfer questions.&lt;/strong&gt; No transfer outside the EU means no standard&lt;br&gt;
contractual clauses to attach, no transfer impact assessment to write, and&lt;br&gt;
nothing to redo when the legal ground shifts again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit.&lt;/strong&gt; You can move hosts in an afternoon: it is a binary, a database dump&lt;br&gt;
and a volume of files. Portability is a GDPR principle and, more practically,&lt;br&gt;
a negotiating position.&lt;/p&gt;

&lt;h2&gt;
  
  
  What self-hosting does not settle
&lt;/h2&gt;

&lt;p&gt;Be clear-eyed here. Running your own server does not make you compliant.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A privacy policy and a processing register&lt;/strong&gt; are still yours to write.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A legal basis&lt;/strong&gt; for each processing purpose is still yours to establish.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data subject rights&lt;/strong&gt; must work in practice: access, export, rectification,
erasure — within a month, without heroics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retention&lt;/strong&gt; must be decided and enforced. "We keep everything forever" is
not a policy, it is a liability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security measures&lt;/strong&gt; must be real and documented: encryption in transit,
access control, logging, backups, incident response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A processor agreement with your host&lt;/strong&gt; is still required, as is one with
every other vendor you keep.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The honest framing: self-hosting removes an entire category of &lt;em&gt;third-party&lt;/em&gt;&lt;br&gt;
questions and leaves the &lt;em&gt;internal&lt;/em&gt; ones, which you would have had anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a boilerplate can do for you
&lt;/h2&gt;

&lt;p&gt;Some of the above is code, and code can ship. In GoVueKit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data export&lt;/strong&gt; — a signed-in user downloads their data as JSON, which is
the portability right implemented rather than promised.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account erasure&lt;/strong&gt; — a real delete, with the sensible guard that the sole
owner of a shared organization must transfer or delete it first; solo
organizations are erased with the account.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An audit log&lt;/strong&gt; of administrative actions, including impersonation, which
is exactly what an auditor asks to see.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session visibility and revocation&lt;/strong&gt; — users list their signed-in devices
and can end sessions, which covers a surprising number of questionnaire
lines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encryption in transit by default&lt;/strong&gt; — the production compose file puts the
app behind Traefik with Let's Encrypt, and the reference Traefik stack ships
in &lt;code&gt;deploy/traefik/&lt;/code&gt;; there is no HTTP-only path to forget.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security baseline as code&lt;/strong&gt; — argon2id password hashing, CSRF on every
state-changing route, strict CSP and security headers, an anti-SSRF outbound
client, timing-safe token comparison. Each one is a line you can point at in
a questionnaire and a test you can run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error reporting you control&lt;/strong&gt; — the reporter is an interface; if you would
rather not send stack traces to a third party, do not configure one and
nothing leaves the process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it cannot do is decide your retention periods or write your register.&lt;/p&gt;

&lt;h2&gt;
  
  
  The enterprise questionnaire, in practice
&lt;/h2&gt;

&lt;p&gt;The document that arrives before a serious contract asks roughly this. A&lt;br&gt;
self-hosted deployment answers most of it structurally:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Self-hosted answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where is data stored?&lt;/td&gt;
&lt;td&gt;Our server, region X.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;List sub-processors.&lt;/td&gt;
&lt;td&gt;Host, payment provider, email relay.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is data encrypted in transit?&lt;/td&gt;
&lt;td&gt;Yes, TLS terminated at our proxy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who can access production data?&lt;/td&gt;
&lt;td&gt;Named administrators, over SSH keys.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How are passwords stored?&lt;/td&gt;
&lt;td&gt;argon2id, 64 MiB, 3 iterations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is there MFA?&lt;/td&gt;
&lt;td&gt;TOTP, on every sign-in path.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Are administrative actions logged?&lt;/td&gt;
&lt;td&gt;Yes, audit log with actor and target.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How is data deleted on request?&lt;/td&gt;
&lt;td&gt;Self-service erasure, plus backup expiry.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What is the backup policy?&lt;/td&gt;
&lt;td&gt;Nightly, off-server, restore tested.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can we get our data out?&lt;/td&gt;
&lt;td&gt;JSON export; full database dump on request.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The rows you must fill in yourself are retention periods, incident response&lt;br&gt;
times, and who your DPO is (if you need one). Everything else is a&lt;br&gt;
consequence of the architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  When EU self-hosting is not the right call
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Your users are global and latency-sensitive.&lt;/strong&gt; One EU server serving
Sydney is a bad experience; you will want a CDN in front, or regional
deployments, and that is a different design.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You have no operations capacity and no intention of acquiring any.&lt;/strong&gt; A
European managed platform is a better answer than an unpatched VPS. There
are EU-based ones; residency does not require self-hosting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your customers do not care.&lt;/strong&gt; If you sell to US startups, this whole
article is a rounding error next to shipping features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data residency is a sales advantage in some markets and irrelevant in others.&lt;br&gt;
Know which one you are in before you optimise for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The practical setup
&lt;/h2&gt;

&lt;p&gt;If you decided EU residency matters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Host with a European provider (Hetzner, Scaleway, OVHcloud). Choose the
region explicitly.&lt;/li&gt;
&lt;li&gt;Keep the processor list short and deliberate: payments and email are worth
renting; identity and database are not.&lt;/li&gt;
&lt;li&gt;Turn on the product features that implement rights — export, erasure,
session revocation — and test them like features, because they are.&lt;/li&gt;
&lt;li&gt;Write the register and the retention policy. Two documents, an afternoon,
and they are what an auditor actually reads.&lt;/li&gt;
&lt;li&gt;Restore a backup. Availability is part of the security obligation, and an
untested backup is not a backup.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://govuekit.dev/#security" rel="noopener noreferrer"&gt;See the security checklist on the product page&lt;/a&gt; or read&lt;br&gt;
&lt;a href="https://govuekit.dev/blog/the-rented-stack-bill" rel="noopener noreferrer"&gt;what renting the stack commits you to&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://govuekit.dev/blog/eu-hosting-gdpr-saas" rel="noopener noreferrer"&gt;govuekit.dev&lt;/a&gt;. GoVueKit is a complete Go + Vue 3 SaaS codebase you buy once and own; the whole stack runs on your machine with one &lt;code&gt;docker compose up&lt;/code&gt;: &lt;a href="https://govuekit.dev/labs" rel="noopener noreferrer"&gt;https://govuekit.dev/labs&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>gdpr</category>
      <category>saas</category>
      <category>security</category>
      <category>europe</category>
    </item>
    <item>
      <title>Back up WordPress: the database, the files, and proof the site comes back</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Fri, 13 Nov 2026 08:48:54 +0000</pubDate>
      <link>https://dev.to/benjy33000/back-up-wordpress-the-database-the-files-and-proof-the-site-comes-back-4g1j</link>
      <guid>https://dev.to/benjy33000/back-up-wordpress-the-database-the-files-and-proof-the-site-comes-back-4g1j</guid>
      <description>&lt;p&gt;Most WordPress backup guides stop at an installed plugin and a ticked box. The day it matters, what decides whether your site comes back is knowing what the backup actually contains, and whether anyone has ever replayed the files.&lt;/p&gt;

&lt;p&gt;A WordPress site lives in two places: a MySQL database and a &lt;code&gt;wp-content&lt;/code&gt; folder. A backup that takes only one of them does not restore half a site, it restores a broken one. This guide covers the whole chain: what each half holds, what you can leave out, what &lt;code&gt;wp-config.php&lt;/code&gt; implies, the script that produces both files and ships them to S3, restoring by hand until the site answers, and the queries that tell you a restored database really holds your posts. It needs only &lt;code&gt;mysqldump&lt;/code&gt;, &lt;code&gt;tar&lt;/code&gt;, &lt;code&gt;docker&lt;/code&gt; and the AWS CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  A WordPress backup is two things
&lt;/h2&gt;

&lt;p&gt;WordPress keeps its data in two places, and a backup that takes only one of them restores nothing usable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The MySQL database&lt;/strong&gt; holds the posts, the pages, the comments, the accounts, the site settings and every plugin's configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;wp-content&lt;/code&gt;&lt;/strong&gt; holds the uploaded media (&lt;code&gt;uploads&lt;/code&gt;), the themes and the plugins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the database alone, every post references images that no longer exist and the active theme cannot be found: WordPress starts, but on a site stripped of its presentation. With &lt;code&gt;wp-content&lt;/code&gt; alone, you have files that nothing ties to a post or an author. You need both, and you need to know that both are there.&lt;/p&gt;

&lt;p&gt;What you can leave out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;the WordPress core&lt;/strong&gt;: &lt;code&gt;wp-admin&lt;/code&gt;, &lt;code&gt;wp-includes&lt;/code&gt; and the PHP files at the root. It is a public download: you fetch it at whichever version you want, and it adds nothing to the archive;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the caches&lt;/strong&gt;: &lt;code&gt;wp-content/cache&lt;/code&gt; and whatever an optimisation plugin produces. They regenerate themselves, and they inflate the archive without adding anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That leaves &lt;code&gt;wp-config.php&lt;/code&gt;, which is neither the core nor your data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The case of &lt;code&gt;wp-config.php&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This file holds two things of a different nature.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The database credentials&lt;/strong&gt;: &lt;code&gt;DB_NAME&lt;/code&gt;, &lt;code&gt;DB_USER&lt;/code&gt;, &lt;code&gt;DB_PASSWORD&lt;/code&gt;, &lt;code&gt;DB_HOST&lt;/code&gt;. They only apply to the server the file lives on, and you normally have them elsewhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The salting keys&lt;/strong&gt;: &lt;code&gt;AUTH_KEY&lt;/code&gt;, &lt;code&gt;SECURE_AUTH_KEY&lt;/code&gt;, &lt;code&gt;NONCE_SALT&lt;/code&gt; and their neighbours. They sign session cookies. Losing them logs everybody out once, and that is all; regenerating them is a routine operation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Backing it up saves you half an hour on restore day, and puts your production database password into an archive that travels to remote storage. Leaving it out costs you four lines to rewrite, and that is the choice to prefer when the archive leaves your network. Either way, keep a record of your WordPress version and of the list of active plugins: that is what is most often missing on the day you restore.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backup script
&lt;/h2&gt;

&lt;p&gt;Two files, produced side by side: the database dump and the &lt;code&gt;wp-content&lt;/code&gt; archive.&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="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail

&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;date +%Y%m%d_%H%M%S&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://backups-mysite/wordpress

mysqldump -h db.internal -u wordpress --single-transaction --routines --triggers \
  wordpress &lt;span class="o"&gt;|&lt;/span&gt; gzip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/wordpress_${ts}.sql.gz"&lt;/span&gt;

tar -czf &lt;span class="s2"&gt;"/backups/.wp-content_${ts}.tar.gz"&lt;/span&gt; -C /var/www/html wp-content
mv &lt;span class="s2"&gt;"/backups/.wp-content_${ts}.tar.gz"&lt;/span&gt; &lt;span class="s2"&gt;"/backups/wp-content_${ts}.tar.gz"&lt;/span&gt;

aws s3 cp &lt;span class="s2"&gt;"/backups/wordpress_${ts}.sql.gz"&lt;/span&gt; &lt;span class="s2"&gt;"${dest}/mysql/"&lt;/span&gt;
aws s3 cp &lt;span class="s2"&gt;"/backups/wp-content_${ts}.tar.gz"&lt;/span&gt; &lt;span class="s2"&gt;"${dest}/files/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--single-transaction&lt;/code&gt; takes the dump inside a single transaction: WordPress's InnoDB tables come out consistent with each other without the site being locked for the duration. &lt;code&gt;--routines --triggers&lt;/code&gt; adds what &lt;code&gt;mysqldump&lt;/code&gt; leaves out by default.&lt;/p&gt;

&lt;p&gt;The password is not on the command line: it is read from the &lt;code&gt;MYSQL_PWD&lt;/code&gt; variable or from a &lt;code&gt;~/.my.cnf&lt;/code&gt; file. A password passed as an argument shows up in the machine's process list, for everyone.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Without &lt;code&gt;pipefail&lt;/code&gt;, a failed dump comes out as a success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;mysqldump | gzip&lt;/code&gt;, the shell only looks at the exit code of the last link. &lt;code&gt;gzip&lt;/code&gt; is perfectly happy compressing an empty stream, so the script returns 0 and cron is content. &lt;code&gt;set -o pipefail&lt;/code&gt;, included in the &lt;code&gt;set -euo pipefail&lt;/code&gt; above, makes the whole line fail as soon as &lt;code&gt;mysqldump&lt;/code&gt; fails. It is the number one cause of empty backups that stay green for months.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The archive is written under a hidden name, then renamed. That is not a flourish: for the minutes the &lt;code&gt;tar&lt;/code&gt; takes, the file is already the most recent one in the directory, and anyone reading "the most recent backup" reads a truncated archive. The &lt;code&gt;mv&lt;/code&gt; is atomic, so the file only appears under its final name once it is complete.&lt;/p&gt;

&lt;p&gt;Keep the timestamp in both names, and keep the two halves separate: they restore separately, and a single archive holding everything forces you to unpack all of it to check one half. For retention, a lifecycle rule on the bucket deletes objects older than N days with no script to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restoring once, by hand
&lt;/h2&gt;

&lt;p&gt;A backup is only proven once restored. Do it once, in full, on a throwaway machine. It is also the procedure you will follow the day it matters.&lt;/p&gt;

&lt;p&gt;The database first, in a fresh MySQL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create wp-test

docker run -d --name wp-db --network wp-test \
  -e &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test&lt;/span&gt; -e &lt;span class="nv"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;wordpress mysql:8.0
&lt;span class="k"&gt;until&lt;/span&gt; docker &lt;span class="nb"&gt;exec&lt;/span&gt; wp-db mysqladmin ping -h 127.0.0.1 -u root -ptest --silent&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; sleep 2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;

gunzip -c /backups/wordpress_20260918_010000.sql.gz \
  &lt;span class="o"&gt;|&lt;/span&gt; docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i wp-db mysql -u root -ptest wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A single-database dump does not create the database&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mysqldump wordpress&lt;/code&gt;, as above, contains neither &lt;code&gt;CREATE DATABASE&lt;/code&gt; nor &lt;code&gt;USE&lt;/code&gt;: the database has to exist beforehand, and to be named on the client's command line. That is what &lt;code&gt;MYSQL_DATABASE=wordpress&lt;/code&gt; and the trailing &lt;code&gt;wordpress&lt;/code&gt; are for. With &lt;code&gt;mysqldump --databases wordpress&lt;/code&gt;, the dump carries its own &lt;code&gt;CREATE DATABASE&lt;/code&gt; and &lt;code&gt;USE&lt;/code&gt;, and replays without naming a database.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then the files, and a WordPress started on top of them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir -p /wp-test
tar -xzf /backups/wp-content_20260918_010000.tar.gz -C /wp-test

docker run -d --name wp-site --network wp-test -p 8080:80 \
  -e &lt;span class="nv"&gt;WORDPRESS_DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;wp-db \
  -e &lt;span class="nv"&gt;WORDPRESS_DB_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;wordpress \
  -e &lt;span class="nv"&gt;WORDPRESS_DB_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;root \
  -e &lt;span class="nv"&gt;WORDPRESS_DB_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test&lt;/span&gt; \
  -v /wp-test/wp-content:/var/www/html/wp-content \
  wordpress:6-apache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The container installs the WordPress core itself: that is the demonstration that it never had to be in the backup. Only &lt;code&gt;wp-content&lt;/code&gt; comes from your archive, and the database comes from your dump.&lt;/p&gt;

&lt;p&gt;That leaves asking the site whether it answers:&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="k"&gt;until&lt;/span&gt; curl -sf -o /dev/null http://localhost:8080/&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; sleep 2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
curl -s http://localhost:8080/wp-json/wp/v2/posts &lt;span class="o"&gt;|&lt;/span&gt; head -c 400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 200 on the home page proves only that the container started: a fresh install answers 200 too. What counts is one of your own posts coming back through the REST API. At that point the whole chain is proven at once: the dump, the database, the application, the HTTP.&lt;/p&gt;

&lt;p&gt;Note how long it took. That is your real restore duration, the only one worth comparing to the delay you promised. &lt;code&gt;mysql:8.0&lt;/code&gt; must match the major version of your server, since a dump taken on a newer server does not always replay on an older one; for a site hosted on MariaDB, use a &lt;code&gt;mariadb&lt;/code&gt; image. Then destroy everything: &lt;code&gt;docker rm -f wp-site wp-db&lt;/code&gt; and &lt;code&gt;docker network rm wp-test&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in a restored database
&lt;/h2&gt;

&lt;p&gt;A dump that replayed without an error does not mean your data is there. Four questions, in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="cm"&gt;(*) from wp_users;
select count(*)&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;wp_posts&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;post_status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'publish'&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;post_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'post'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="cm"&gt;(*) from wp_options where option_name in ('siteurl', 'home') and option_value &amp;lt;&amp;gt; '';
select max(post_date) from wp_posts where post_status = 'publish';
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;An account can still log in.&lt;/strong&gt; Zero rows in &lt;code&gt;wp_users&lt;/code&gt; is a restored site nobody administers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The published posts came back.&lt;/strong&gt; That is the number that tells a restored site from a fresh install: a fresh install already has every &lt;code&gt;wp_&lt;/code&gt; table, and none of your posts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The site has an address.&lt;/strong&gt; &lt;code&gt;siteurl&lt;/code&gt; and &lt;code&gt;home&lt;/code&gt; must be present and not empty, so exactly two rows. Without them, WordPress serves a site nobody reaches, however complete the restore was.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The data is recent.&lt;/strong&gt; The date of the latest published post should look like the one you expect, not like last month's. That is what catches a backup job that stopped running.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;wp_&lt;/code&gt; is a default, not a rule: a site that changed its prefix needs its own in all four queries, otherwise they query tables that do not exist. The prefix is the &lt;code&gt;$table_prefix&lt;/code&gt; line of &lt;code&gt;wp-config.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the files side, three landmarks and a volume:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ls -d /wp-test/wp-content/themes /wp-test/wp-content/plugins /wp-test/wp-content/uploads
find /wp-test/wp-content/uploads -type f &lt;span class="o"&gt;|&lt;/span&gt; wc -l
du -sh /wp-test/wp-content/uploads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A perfectly shaped tree with an empty &lt;code&gt;uploads&lt;/code&gt; is the usual result of a &lt;code&gt;tar&lt;/code&gt; over an excluded path, or of a mount that was missing when the backup ran. The file count and the total size are what see it; compare them against the order of magnitude in production, not against an exact number.&lt;/p&gt;

&lt;p&gt;Finally, one witness media file, asked of the restored site rather than read off the disk. Take the address of an image from your most recent post:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sS -o /dev/null -w &lt;span class="s1"&gt;'%{http_code}\n'&lt;/span&gt; \
  http://localhost:8080/wp-content/uploads/2026/09/photo.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 404 here, with a full database and a site that answers, is exactly the case half the WordPress backups out there never see.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this chain does not prove
&lt;/h2&gt;

&lt;p&gt;It proves that a recent dump replays into a fresh MySQL, that the restored database holds your accounts, your published posts and the site address, and that the archive holds the expected tree and volume of media.&lt;/p&gt;

&lt;p&gt;It does not prove that the two halves come from the same instant. The dump and the archive are produced one after the other: a media file uploaded in between is referenced in the database without being in the archive. The gap is a few minutes, but it exists, and it shrinks by bringing the two commands closer together, not by testing more.&lt;/p&gt;

&lt;p&gt;Nor does it prove that every plugin restarts: a plugin expecting a table outside the prefix, a licence or an external service can perfectly well fail on an otherwise complete database. And it says nothing about what has been published since the last dump. That gap is your RPO, and it is tuned with the backup frequency, not with the tests.&lt;/p&gt;

&lt;p&gt;Finally, if you chose to leave &lt;code&gt;wp-config.php&lt;/code&gt; out, the real restore requires rewriting it. Keep that step in your written procedure.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Should I back up the database or the files?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both, and separately. The database holds the posts, the accounts and the settings; &lt;code&gt;wp-content&lt;/code&gt; holds the media, the themes and the plugins. With the database alone, every post points at images that no longer exist. With the files alone, nothing ties a media file to a post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I back up the whole &lt;code&gt;/var/www/html&lt;/code&gt; folder?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. The WordPress core (&lt;code&gt;wp-admin&lt;/code&gt;, &lt;code&gt;wp-includes&lt;/code&gt;, the PHP files at the root) is a public download you fetch at whichever version you want. Caches regenerate themselves. The part that exists only once is &lt;code&gt;wp-content&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about &lt;code&gt;wp-config.php&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It holds your production database credentials and the cookie salting keys. Backing it up saves you half an hour on restore day and puts a production password into an archive that travels to remote storage. The salting keys can be regenerated: losing them logs everybody out once, and nothing more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The restored site answers 200. Does that prove the restore?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No: a fresh install answers 200 too. What proves something is one of your own posts coming back through the REST API, and the address of a media file from that post returning anything other than a 404.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My tables are not prefixed &lt;code&gt;wp_&lt;/code&gt;. What changes?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The verification queries, which name the tables one by one. A query written with &lt;code&gt;wp_&lt;/code&gt; asks about tables that do not exist and fails instead of counting. The prefix is in &lt;code&gt;wp-config.php&lt;/code&gt;, on the &lt;code&gt;$table_prefix&lt;/code&gt; line.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://restoreproof.io/blog/back-up-wordpress-database-and-files" rel="noopener noreferrer"&gt;restoreproof.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RestoreProof&lt;/strong&gt; runs this kind of restore test on a schedule, inside your own infrastructure, and signs a report proving the backup restores. Your data never leaves your servers. Free plan, no credit card: &lt;a href="https://app.restoreproof.io" rel="noopener noreferrer"&gt;https://app.restoreproof.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>backup</category>
      <category>mysql</category>
      <category>devops</category>
    </item>
    <item>
      <title>Self-hosted as one Go binary: embed.FS, SQLite WAL and the trade-offs</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Tue, 10 Nov 2026 09:34:42 +0000</pubDate>
      <link>https://dev.to/benjy33000/self-hosted-as-one-go-binary-embedfs-sqlite-wal-and-the-trade-offs-32ho</link>
      <guid>https://dev.to/benjy33000/self-hosted-as-one-go-binary-embedfs-sqlite-wal-and-the-trade-offs-32ho</guid>
      <description>&lt;p&gt;Monitoring stacks have a complexity problem. Prometheus needs cAdvisor, Grafana, node_exporter and Alertmanager. Datadog needs an agent plus a SaaS account. Even "simple" tools like Uptime Kuma need Node.js and a separate database.&lt;/p&gt;

&lt;p&gt;That is no longer the only option. Self-hosted tools have matured to the point where a single Go binary can replace a five-container stack. This post looks at what that means in practice, using &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;Maintenant&lt;/a&gt; as the example, and at what you give up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "single binary" means
&lt;/h2&gt;

&lt;p&gt;A single-binary tool ships as one executable file. No runtime dependencies, no external database, no separate frontend server. The engine, the web interface, the database and the alert system are compiled into one artifact.&lt;/p&gt;

&lt;p&gt;In Docker terms: one image, one container, one volume.&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;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;maintenant&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ghcr.io/kolapsis/maintenant:latest&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"8080:8080"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/var/run/docker.sock:/var/run/docker.sock:ro&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/proc:/host/proc:ro&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;maintenant-data:/data&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;MAINTENANT_ADDR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0:8080"&lt;/span&gt;
      &lt;span class="na"&gt;MAINTENANT_DB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/data/maintenant.db"&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;
&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;maintenant-data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No Postgres container, no Redis container, no nginx in front of it, no separate worker processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three trends that made it practical
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Go's &lt;code&gt;embed.FS&lt;/code&gt;&lt;/strong&gt; makes it trivial to ship a full web UI inside a single binary. No separate frontend server needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQLite's WAL mode&lt;/strong&gt; shows that an embedded database handles real-time workloads (continuous writes plus a live dashboard reading) without PostgreSQL or InfluxDB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker's dominance&lt;/strong&gt; in self-hosting means a tool can assume a container runtime and skip the "works on bare metal, VMs, containers and Kubernetes" matrix.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Go advantage
&lt;/h2&gt;

&lt;p&gt;Most single-binary tools are written in Go, for good reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static compilation&lt;/strong&gt;: no runtime dependencies, no shared libraries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low memory footprint&lt;/strong&gt;: goroutines are cheap, garbage collection is efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-compilation&lt;/strong&gt;: one build produces linux/amd64 and linux/arm64 binaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Embedded assets&lt;/strong&gt;: &lt;code&gt;embed.FS&lt;/code&gt; ships the entire frontend inside the binary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maintenant embeds its web UI, its SQLite engine and all its monitoring logic in a single ~20 MB binary, and idles at under 30 MB of RAM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fewer failure modes
&lt;/h2&gt;

&lt;p&gt;Every additional component is a potential failure point. Prometheus can crash independently of Grafana. An Alertmanager config can desync from its Prometheus rules. cAdvisor can run out of memory while Grafana keeps showing stale data.&lt;/p&gt;

&lt;p&gt;With a single binary, either the whole thing works or it does not. There is no partial failure state to debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simpler backups and updates
&lt;/h2&gt;

&lt;p&gt;There is one SQLite file in one volume. Back it up the way you back up your other volumes: no &lt;code&gt;pg_dump&lt;/code&gt;, no TSDB snapshots, no dashboard exports. Updating is &lt;code&gt;docker compose pull &amp;amp;&amp;amp; docker compose up -d&lt;/code&gt;: one image, one container, no version compatibility matrix between Prometheus, Grafana and their plugins.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trade-offs
&lt;/h2&gt;

&lt;p&gt;Single-binary tools are opinionated by nature. You trade flexibility for simplicity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No distributed tracing.&lt;/strong&gt; If you need OpenTelemetry-level observability, this is the wrong class of tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No infinite retention.&lt;/strong&gt; Embedded SQLite is not a time-series database tuned for years of data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No custom dashboards and no query language.&lt;/strong&gt; The views are pre-built; there is no PromQL equivalent and no plugin ecosystem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scaling limits.&lt;/strong&gt; One central server with lightweight agents on remote hosts, not a distributed system. Multi-region aggregation remains the domain of distributed stacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One host to lose.&lt;/strong&gt; If the machine running it dies, monitoring dies with it. Run it somewhere separate from the infrastructure it watches.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you manage hundreds of servers across several cloud providers and need ad-hoc queries, a distributed stack is the right tool. For a handful of servers running Docker Compose or single-node Kubernetes, one binary is often enough.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://maintenant.dev/blog/self-hosted-monitoring-single-binary/" rel="noopener noreferrer"&gt;maintenant.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintenant&lt;/strong&gt; is an open-source, self-hosted monitoring tool for Docker and Kubernetes: containers, endpoints, cron heartbeats, TLS certificates and alerts, in one container that discovers your stack on its own. Install it in a minute: &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;https://maintenant.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This project was funded by the French Government as part of the France 2030 plan operated by Bpifrance.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" alt="France 2030 and Cap Digital" width="174" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>selfhosted</category>
      <category>sqlite</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Back up MySQL and MariaDB to S3: from mysqldump to a verified restore</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Fri, 06 Nov 2026 08:26:06 +0000</pubDate>
      <link>https://dev.to/benjy33000/back-up-mysql-and-mariadb-to-s3-from-mysqldump-to-a-verified-restore-2gn7</link>
      <guid>https://dev.to/benjy33000/back-up-mysql-and-mariadb-to-s3-from-mysqldump-to-a-verified-restore-2gn7</guid>
      <description>&lt;p&gt;Most MySQL backup guides stop at the &lt;code&gt;mysqldump&lt;/code&gt; command line. That is the easy part. What decides whether you get your data back is everything around it: what the dump leaves out, which options you passed, whether the script really fails when the dump fails, and whether anyone has ever replayed the file.&lt;/p&gt;

&lt;p&gt;This guide covers the whole chain: what a MySQL backup has to contain besides the tables, which &lt;code&gt;mysqldump&lt;/code&gt; options actually change something, a script that cannot report success on an empty file, a manual restore in a throwaway container, and four SQL queries that tell you the restored database holds your data. MariaDB follows the same path, down to the container image. It needs only &lt;code&gt;mysqldump&lt;/code&gt;, &lt;code&gt;docker&lt;/code&gt; and the AWS CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a MySQL backup has to contain
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;mysqldump&lt;/code&gt; writes SQL: the &lt;code&gt;CREATE TABLE&lt;/code&gt; and &lt;code&gt;INSERT&lt;/code&gt; statements of the databases you name. What lives at server level is not in there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the accounts and their grants, which are in the &lt;code&gt;mysql&lt;/code&gt; database;&lt;/li&gt;
&lt;li&gt;the other databases on the same server, if you did not pass &lt;code&gt;--databases&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the server configuration (&lt;code&gt;my.cnf&lt;/code&gt;, &lt;code&gt;/etc/mysql/conf.d/&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two things go missing even more quietly, because &lt;code&gt;mysqldump&lt;/code&gt; does not take them by default: &lt;strong&gt;stored procedures and functions&lt;/strong&gt;, and scheduler &lt;strong&gt;events&lt;/strong&gt;. &lt;strong&gt;Triggers&lt;/strong&gt;, on the other hand, are taken by default. A database restored without its procedures reads perfectly and computes nothing any more.&lt;/p&gt;

&lt;p&gt;The storage engine is written into the dump, on every &lt;code&gt;CREATE TABLE&lt;/code&gt;, as &lt;code&gt;ENGINE=InnoDB&lt;/code&gt;. It must therefore exist on the server where you restore: a dump of MyISAM tables replays on a MySQL 8, but a dump produced with a third-party engine stops on the first table. Count your engines once on production, with &lt;code&gt;select engine, count(*) from information_schema.tables group by engine&lt;/code&gt;, and you will know what you are dealing with.&lt;/p&gt;

&lt;h2&gt;
  
  
  The options that matter
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;What it changes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--single-transaction&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a consistent snapshot of InnoDB tables, without locking production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--routines --events&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;adds procedures, functions and events, absent without it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--triggers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;already on by default: do not turn it off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--databases&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;puts a &lt;code&gt;CREATE DATABASE&lt;/code&gt; and a &lt;code&gt;USE&lt;/code&gt; in the dump, which therefore recreates the database itself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--set-gtid-purged=OFF&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;strips the &lt;code&gt;SET @@GLOBAL.gtid_purged&lt;/code&gt; carried by a dump taken on a GTID server&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;--single-transaction&lt;/code&gt; only protects what is transactional. On MyISAM tables it does nothing at all: the only consistency available comes from &lt;code&gt;--lock-tables&lt;/code&gt;, which blocks writes for the duration of the dump. A database mixing both engines cannot be backed up consistently in a single command, a good reason to finish migrating to InnoDB.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--set-gtid-purged=OFF&lt;/code&gt; only matters if your server runs with GTID enabled. In that case the dump starts by setting the replication position, which a test server that has already executed transactions refuses to replay.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backup script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d_%H%M%S&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://backups-billing/mysql
&lt;span class="nv"&gt;cnf&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/mysql/backup.cnf

mysqldump &lt;span class="nt"&gt;--defaults-extra-file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;cnf&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--single-transaction&lt;/span&gt; &lt;span class="nt"&gt;--routines&lt;/span&gt; &lt;span class="nt"&gt;--events&lt;/span&gt; &lt;span class="nt"&gt;--triggers&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--databases&lt;/span&gt; billing &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/billing_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt;

mysql &lt;span class="nt"&gt;--defaults-extra-file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;cnf&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-N&lt;/span&gt; &lt;span class="nt"&gt;-B&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"select user, host from mysql.user where user not like 'mysql.%'"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; u h&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
      &lt;/span&gt;mysql &lt;span class="nt"&gt;--defaults-extra-file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;cnf&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-N&lt;/span&gt; &lt;span class="nt"&gt;-B&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"show grants for '&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;u&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;'@'&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;h&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;'"&lt;/span&gt;
    &lt;span class="k"&gt;done&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s/$/;/'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/grants_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql"&lt;/span&gt;

aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/billing_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/grants_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The password is in &lt;code&gt;backup.cnf&lt;/code&gt;, under a &lt;code&gt;[client]&lt;/code&gt; section, not on the command line: a &lt;code&gt;-ppassword&lt;/code&gt; is readable by anyone in the process list for the whole duration of the dump.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;show grants&lt;/code&gt; loop produces a replayable grants file. &lt;code&gt;SHOW GRANTS&lt;/code&gt; returns its lines without a trailing semicolon, hence the &lt;code&gt;sed&lt;/code&gt;: without it, the file replays as a single statement and fails.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Without &lt;code&gt;pipefail&lt;/code&gt;, a failed dump comes out as a success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;mysqldump | gzip&lt;/code&gt;, the shell only looks at the exit code of the last link. &lt;code&gt;gzip&lt;/code&gt; succeeds at compressing an empty stream, so the script returns 0 and cron is happy. &lt;code&gt;set -o pipefail&lt;/code&gt;, included in the &lt;code&gt;set -euo pipefail&lt;/code&gt; above, makes the whole line fail as soon as &lt;code&gt;mysqldump&lt;/code&gt; fails. It is the number one cause of empty backups that stay green for months.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep the timestamp in the file name: a file always overwritten under the same name leaves no chance of going back to yesterday. For retention, a lifecycle rule on the bucket does the job with no script to maintain.&lt;/p&gt;

&lt;p&gt;That leaves running it every night. A &lt;code&gt;cron&lt;/code&gt; entry is enough, on two conditions: its error output goes somewhere someone reads, and a run that drags on does not overlap with the next one. &lt;code&gt;flock -n&lt;/code&gt; on a lock file settles the second point in one line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restoring once, by hand
&lt;/h2&gt;

&lt;p&gt;A backup is only proven once restored. Do it once, in full, on a throwaway machine. It is also the procedure you will follow the day it matters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; mysql-test &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test &lt;/span&gt;mysql:8.4
&lt;span class="k"&gt;until &lt;/span&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;mysql-test mysqladmin ping &lt;span class="nt"&gt;-uroot&lt;/span&gt; &lt;span class="nt"&gt;-ptest&lt;/span&gt; &lt;span class="nt"&gt;--silent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;&lt;span class="nb"&gt;sleep &lt;/span&gt;1
&lt;span class="k"&gt;done

&lt;/span&gt;&lt;span class="nb"&gt;gunzip&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; /backups/billing_20260918_010000.sql.gz &lt;span class="se"&gt;\&lt;/span&gt;
  | docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; mysql-test mysql &lt;span class="nt"&gt;-uroot&lt;/span&gt; &lt;span class="nt"&gt;-ptest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No database is named at restore time: the dump was taken with &lt;code&gt;--databases&lt;/code&gt;, so it carries its own &lt;code&gt;CREATE DATABASE billing&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;mysql&lt;/code&gt; client stops on the first error, and that is what you want. Do not add &lt;code&gt;--force&lt;/code&gt; to a restore test: it turns a truncated dump into a half-filled database that looks like it works.&lt;/p&gt;

&lt;p&gt;Two details that cost an evening. If your client comes from MariaDB, which is the case in Alpine images, it verifies the server certificate and refuses to connect to a MySQL 8 presenting its self-signed one: &lt;code&gt;--skip-ssl&lt;/code&gt; on &lt;code&gt;mysql&lt;/code&gt;, &lt;code&gt;mysqldump&lt;/code&gt; and &lt;code&gt;mysqladmin&lt;/code&gt; lifts that for a local test. And the container answers &lt;code&gt;ping&lt;/code&gt; before it has finished initializing, hence the wait above rather than a fixed &lt;code&gt;sleep&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mysql:8.4&lt;/code&gt; must match the major version of your server, since a dump taken on a newer server does not replay on an older one. For MariaDB, only the image changes, to &lt;code&gt;mariadb:11&lt;/code&gt; or &lt;code&gt;mariadb:10.11&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Note how long it took. That is your real restore duration, the only one worth comparing to the delay you promised.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in a restored database
&lt;/h2&gt;

&lt;p&gt;A dump that replayed without an error does not mean the data is there. Four questions, in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;information_schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;table_schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'billing'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;auto_increment&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;information_schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt;
  &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;table_schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'billing'&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="k"&gt;table_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'invoices'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The tables are there.&lt;/strong&gt; Zero tables means an empty dump that replayed perfectly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The rows are there.&lt;/strong&gt; Compare against the order of magnitude in production, not an exact number: a database that grows is normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The data is recent.&lt;/strong&gt; Ask that question by counting yesterday's rows, not by reading a date: a number compares against a threshold, a date does not. Zero here means a backup job that stopped running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The counters kept up.&lt;/strong&gt; An &lt;code&gt;AUTO_INCREMENT&lt;/code&gt; back down to 1 causes key collisions on the first write after the restore.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then destroy everything: &lt;code&gt;docker rm -f mysql-test&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this chain does not prove
&lt;/h2&gt;

&lt;p&gt;It proves that a recent backup restores into a fresh MySQL and that it contains the expected data. It proves nothing about the accounts and their grants, which live in another file: to exercise those, you have to replay the grants file and connect with one of those accounts. It does not prove either that your application works on that database: for that, you need to start it against the container and request a page. And it says nothing about what has been written since the last dump. That gap is your RPO, and it is tuned with the backup frequency, not with the tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What does &lt;code&gt;mysqldump&lt;/code&gt; not back up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Accounts and their grants, which live in the &lt;code&gt;mysql&lt;/code&gt; database, the other databases on the server if you did not pass &lt;code&gt;--databases&lt;/code&gt;, and the server configuration. Stored procedures, functions and events are not included by default: that takes &lt;code&gt;--routines --events&lt;/code&gt;. Triggers, on the other hand, are included by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is &lt;code&gt;--single-transaction&lt;/code&gt; enough for a consistent backup?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On InnoDB tables, yes, and without blocking writes. On MyISAM tables it does nothing: those tables are not transactional, and the only consistency available comes from &lt;code&gt;--lock-tables&lt;/code&gt;, which blocks production for the duration of the dump.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does a dump refuse to replay with a &lt;code&gt;gtid_purged&lt;/code&gt; error?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because it was taken on a server with GTID enabled: the file starts by setting &lt;code&gt;SET @@GLOBAL.gtid_purged&lt;/code&gt;, and a test server that has already executed transactions refuses that line. &lt;code&gt;--set-gtid-purged=OFF&lt;/code&gt; at dump time strips it, and the file replays anywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I test a MariaDB backup?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the same procedure: only the throwaway container image changes, to &lt;code&gt;mariadb:11&lt;/code&gt; or &lt;code&gt;mariadb:10.11&lt;/code&gt;. The dump is the same SQL, and the MariaDB client replays it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I back up MySQL accounts and their grants?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not with the dump of your database: they live in the &lt;code&gt;mysql&lt;/code&gt; database. You produce a replayable file by walking the accounts in &lt;code&gt;mysql.user&lt;/code&gt; and asking &lt;code&gt;SHOW GRANTS&lt;/code&gt; for each one. One precaution: &lt;code&gt;SHOW GRANTS&lt;/code&gt; returns its lines without a trailing semicolon, and without it the file replays as a single statement and fails.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://restoreproof.io/blog/back-up-mysql-mariadb-verify-restore" rel="noopener noreferrer"&gt;restoreproof.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RestoreProof&lt;/strong&gt; runs this kind of restore test on a schedule, inside your own infrastructure, and signs a report proving the backup restores. Your data never leaves your servers. Free plan, no credit card: &lt;a href="https://app.restoreproof.io" rel="noopener noreferrer"&gt;https://app.restoreproof.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>backup</category>
      <category>database</category>
      <category>devops</category>
    </item>
    <item>
      <title>Six things to monitor in a Docker Compose stack</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Wed, 04 Nov 2026 08:35:08 +0000</pubDate>
      <link>https://dev.to/benjy33000/six-things-to-monitor-in-a-docker-compose-stack-270h</link>
      <guid>https://dev.to/benjy33000/six-things-to-monitor-in-a-docker-compose-stack-270h</guid>
      <description>&lt;p&gt;You have deployed your stack with Docker Compose. Your containers are running. Everything seems to be working. But what happens when something breaks at 3 AM?&lt;/p&gt;

&lt;p&gt;This checklist covers the six things worth monitoring in a Compose stack, whatever tool you use to do it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Containers
&lt;/h2&gt;

&lt;p&gt;The most basic level: are your containers running?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Container state&lt;/strong&gt;: running, stopped, restarting, exited&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restart loops&lt;/strong&gt;: a container stuck in a restart loop is often worse than one that has stopped entirely&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker health checks&lt;/strong&gt;: the native &lt;code&gt;HEALTHCHECK&lt;/code&gt; is underused but extremely valuable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit codes&lt;/strong&gt;: a non-zero exit code indicates a crash, not a clean shutdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A health check in your &lt;code&gt;docker-compose.yml&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;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myapp:latest&lt;/span&gt;
    &lt;span class="na"&gt;healthcheck&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CMD"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;curl"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-f"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://localhost:3000/health"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;30s&lt;/span&gt;
      &lt;span class="na"&gt;timeout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10s&lt;/span&gt;
      &lt;span class="na"&gt;retries&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
      &lt;span class="na"&gt;start_period&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;40s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your monitoring should alert when a container transitions to &lt;code&gt;unhealthy&lt;/code&gt;, not only when it stops.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Endpoints
&lt;/h2&gt;

&lt;p&gt;Check that your services respond correctly to requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP checks
&lt;/h3&gt;

&lt;p&gt;Beyond "does it respond", a proper HTTP check verifies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The status code (200, 201, etc.)&lt;/li&gt;
&lt;li&gt;The response time (latency)&lt;/li&gt;
&lt;li&gt;SSL certificate validity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As one example, Maintenant reads this from Docker labels on the service, so the check lives next to the code:&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;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;maintenant.endpoint.http&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.example.com/health"&lt;/span&gt;
  &lt;span class="na"&gt;maintenant.endpoint.interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;30s"&lt;/span&gt;
  &lt;span class="na"&gt;maintenant.endpoint.http.expected-status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;200"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fesk89d93tnzogjjy6tep.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fesk89d93tnzogjjy6tep.webp" alt="HTTP/TCP endpoint monitoring: latency, status codes" width="799" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TCP checks
&lt;/h3&gt;

&lt;p&gt;For services that do not speak HTTP (databases, Redis, MQTT), a TCP check verifies that the port is open and accepting connections.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. SSL certificates
&lt;/h2&gt;

&lt;p&gt;Expired certificates are one of the most common causes of preventable downtime. With Let's Encrypt and automatic renewal, it is tempting to assume everything just works, but renewals can fail silently. Alert well ahead of expiry (for example at 30, 14, 7, 3 and 1 day) so a failed renewal is noticed while there is still time to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Cron jobs
&lt;/h2&gt;

&lt;p&gt;Scheduled tasks are the most overlooked services. Is your nightly backup actually running? Did your cleanup job finish successfully?&lt;/p&gt;

&lt;p&gt;Use the heartbeat pattern: the job sends a ping to a URL after each execution, and you get alerted if the ping does not arrive within the expected window. Report the exit code and send the ping whether the job succeeded or not:&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="c"&gt;# crontab: ';' not '&amp;amp;&amp;amp;', so the ping is sent even when backup.sh fails&lt;/span&gt;
0 3 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /usr/local/bin/backup.sh&lt;span class="p"&gt;;&lt;/span&gt; curl &lt;span class="nt"&gt;-fsS&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null https://monitor.example.com/ping/&lt;span class="o"&gt;{&lt;/span&gt;uuid&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. System resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Disk space&lt;/strong&gt;: a full disk can crash your database&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory usage&lt;/strong&gt;: per container and per host&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CPU&lt;/strong&gt;: to detect abnormal spikes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network I/O&lt;/strong&gt;: to identify congestion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set thresholds with some margin (for example warn at 80% disk, not at 100%), and keep history so you can tell a spike from a trend. The Docker stats API gives per-container CPU, memory, network and block I/O.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkdgpqoewwcz018phdonp.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkdgpqoewwcz018phdonp.webp" alt="System resources: CPU, memory, disk, network per container" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Image updates
&lt;/h2&gt;

&lt;p&gt;Knowing that a security update is available for your PostgreSQL or Redis image matters. Comparing the digest of the image you run with the one in the registry tells you when a newer build exists for the tag you use.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://maintenant.dev/blog/docker-compose-monitoring-guide/" rel="noopener noreferrer"&gt;maintenant.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintenant&lt;/strong&gt; is an open-source, self-hosted monitoring tool for Docker and Kubernetes: containers, endpoints, cron heartbeats, TLS certificates and alerts, in one container that discovers your stack on its own. Install it in a minute: &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;https://maintenant.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This project was funded by the French Government as part of the France 2030 plan operated by Bpifrance.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" alt="France 2030 and Cap Digital" width="174" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>monitoring</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Back up Vaultwarden: the database, the data directory, and a restore test</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Fri, 30 Oct 2026 08:30:07 +0000</pubDate>
      <link>https://dev.to/benjy33000/back-up-vaultwarden-the-database-the-data-directory-and-a-restore-test-5399</link>
      <guid>https://dev.to/benjy33000/back-up-vaultwarden-the-database-the-data-directory-and-a-restore-test-5399</guid>
      <description>&lt;p&gt;A password manager restored halfway is worse than one that is lost: it looks complete. The accounts are there, the entries are there, and nobody notices a thing until the day someone types their master password and nothing decrypts.&lt;/p&gt;

&lt;p&gt;This guide covers the whole chain for Vaultwarden: what a backup has to contain besides the database, why copying a SQLite file while it is open is not a backup, a script that cannot report success on a truncated archive, a restore into a throwaway container where you actually open the vault, and the queries that tell you a restored vault is still a vault. It needs only &lt;code&gt;sqlite3&lt;/code&gt;, &lt;code&gt;tar&lt;/code&gt;, &lt;code&gt;docker&lt;/code&gt; and the AWS CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  The vault is not in the database
&lt;/h2&gt;

&lt;p&gt;Vaultwarden knows none of your passwords. Every entry is encrypted in the browser before it is sent, and the server only stores the encrypted blob, in the &lt;code&gt;data&lt;/code&gt; column of the &lt;code&gt;ciphers&lt;/code&gt; table. The master password never leaves the user's machine.&lt;/p&gt;

&lt;p&gt;What the server does keep is each account's &lt;strong&gt;encryption material&lt;/strong&gt;, in the &lt;code&gt;users&lt;/code&gt; table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;akey&lt;/code&gt;, the account's symmetric key, itself encrypted with a key derived from the master password;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;private_key&lt;/code&gt; and &lt;code&gt;public_key&lt;/code&gt;, the RSA pair used for sharing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hence the consequence that makes this subject different from an ordinary application database: &lt;strong&gt;a database restored without that material hands back no readable secret&lt;/strong&gt;. The accounts are there, the entries are there, everyone types their master password, and nothing decrypts, permanently, because the missing key exists nowhere else. A partial export, a truncated column, a &lt;code&gt;users&lt;/code&gt; table restored from a backup older than &lt;code&gt;ciphers&lt;/code&gt;: in all three cases the vault looks complete and it is lost.&lt;/p&gt;

&lt;h2&gt;
  
  
  What sits beside the database
&lt;/h2&gt;

&lt;p&gt;Vaultwarden's data directory (&lt;code&gt;/data&lt;/code&gt; in the container) holds what the database does not:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Content&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rsa_key.pem&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the key that signs session tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;attachments/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the attachments of your entries, encrypted as well&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sends/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the files behind Bitwarden Sends&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;icon_cache/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;site favicons, a cache, nothing to back up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the settings made from the admin page&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;rsa_key.pem&lt;/code&gt; is not the vault's key: it signs tokens. Lose it and Vaultwarden makes another one at start-up, everyone logs in again, and the vaults stay readable. Attachments, on the other hand, are referenced from the database: a database restored alongside an &lt;code&gt;attachments/&lt;/code&gt; tree taken at a different hour gives you entries pointing at files that are not there.&lt;/p&gt;

&lt;p&gt;A Vaultwarden backup is therefore two pieces taken together: the database and the data directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two installs, two ways to back up
&lt;/h2&gt;

&lt;h3&gt;
  
  
  SQLite, the default install
&lt;/h3&gt;

&lt;p&gt;Without &lt;code&gt;DATABASE_URL&lt;/code&gt;, Vaultwarden writes to &lt;code&gt;db.sqlite3&lt;/code&gt;, at the root of the data directory. Copying that file while the service is running is not a backup: SQLite keeps recent transactions in a &lt;code&gt;-wal&lt;/code&gt; journal next to it, and a &lt;code&gt;cp&lt;/code&gt; catches one file and not the other, or both at two different instants.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A hot &lt;code&gt;cp&lt;/code&gt; of &lt;code&gt;db.sqlite3&lt;/code&gt; produces a file that opens&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is what makes the trap expensive: the copied file is not empty, it opens, it contains tables. What is missing is the last writes, or the pages are inconsistent with each other. The &lt;code&gt;.backup&lt;/code&gt; command of &lt;code&gt;sqlite3&lt;/code&gt; takes a read lock, follows the journal, and produces a consistent file without stopping the service.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  PostgreSQL or MySQL
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;DATABASE_URL&lt;/code&gt;, the database lives elsewhere and is backed up like any other, with &lt;code&gt;pg_dump&lt;/code&gt; or &lt;code&gt;mysqldump&lt;/code&gt;. Only the dump line changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pg_dump &lt;span class="nt"&gt;-h&lt;/span&gt; db.internal &lt;span class="nt"&gt;-U&lt;/span&gt; backup_user &lt;span class="nt"&gt;-d&lt;/span&gt; vaultwarden &lt;span class="nt"&gt;--no-owner&lt;/span&gt; &lt;span class="nt"&gt;--no-acl&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/vaultwarden_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In both cases, the data directory is backed up the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backup script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d_%H%M%S&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/var/lib/vaultwarden
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://backups-vaultwarden

sqlite3 &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/db.sqlite3"&lt;/span&gt; &lt;span class="s2"&gt;".backup '/backups/db_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sqlite3'"&lt;/span&gt;
&lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; &lt;span class="s2"&gt;"/backups/db_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sqlite3"&lt;/span&gt;

&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-cf&lt;/span&gt; - &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--exclude&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./icon_cache &lt;span class="nt"&gt;--exclude&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'./db.sqlite3*'&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/data_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.tar.gz"&lt;/span&gt;

aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/db_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sqlite3.gz"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/data_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.tar.gz"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database is excluded from the archive: &lt;code&gt;.backup&lt;/code&gt; has already taken it cleanly, and adding it to the &lt;code&gt;tar&lt;/code&gt; would put back into the backup the very hot copy we just avoided. &lt;code&gt;icon_cache&lt;/code&gt; is excluded because Vaultwarden rebuilds it on its own.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Without &lt;code&gt;pipefail&lt;/code&gt;, a truncated archive comes out as a success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;tar -cf - ... | gzip &amp;gt; file&lt;/code&gt;, the shell only looks at the exit code of the last link. If &lt;code&gt;tar&lt;/code&gt; stops along the way (a file vanishing under it, a full disk), &lt;code&gt;gzip&lt;/code&gt; still compresses what it received and returns 0. The script returns 0, cron is happy, and the archive holds half the directory. &lt;code&gt;set -o pipefail&lt;/code&gt;, included in the &lt;code&gt;set -euo pipefail&lt;/code&gt; above, makes the whole line fail as soon as &lt;code&gt;tar&lt;/code&gt; fails.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep the timestamp in both file names, and keep them &lt;strong&gt;paired&lt;/strong&gt;: what restores is the database and the directory taken in the same minute, not the latest file on each side. For retention, a lifecycle rule on the bucket deletes objects older than N days with no script to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restoring once, by hand
&lt;/h2&gt;

&lt;p&gt;A backup is only proven once restored. Do it once, in full, in a throwaway container. It is also the procedure you will follow the day it matters.&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;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /tmp/vw-test/data
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; /backups/data_20260918_010000.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; /tmp/vw-test/data
&lt;span class="nb"&gt;gunzip&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; /backups/db_20260918_010000.sqlite3.gz &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/vw-test/data/db.sqlite3

docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; vw-test &lt;span class="nt"&gt;-p&lt;/span&gt; 8080:80 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;DOMAIN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:8080 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; /tmp/vw-test/data:/data &lt;span class="se"&gt;\&lt;/span&gt;
  vaultwarden/server:&amp;lt;your version&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The image must carry the production version&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Vaultwarden applies its schema migrations at start-up. An image older than the one that wrote the database refuses to start on it, and a newer image migrates the restored file, which is the right behaviour for a real restore, but not what you want from a test. Use your production's exact version, not &lt;code&gt;latest&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then open &lt;code&gt;http://localhost:8080&lt;/code&gt; in a browser, log in with an account's master password, and &lt;strong&gt;display the password of one entry&lt;/strong&gt;. That is the only step that proves the vault decrypts. It needs a human who knows a master password: nobody else can do it, and that is exactly what you want from a password manager.&lt;/p&gt;

&lt;p&gt;Note how long it took. That is your real restore duration.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in a restored database
&lt;/h2&gt;

&lt;p&gt;That the file opens does not mean the vault is there. Four questions, in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="k"&gt;length&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="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ciphers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;updated_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ciphers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
 &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="k"&gt;length&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="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
   &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;akey&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;akey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;private_key&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;public_key&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Accounts are left.&lt;/strong&gt; An account with no password hash is an invited user who never logged in, not a user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entries are left.&lt;/strong&gt; Compare against the order of magnitude in production, not an exact number: a vault that grows is normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The entries are recent.&lt;/strong&gt; The last change should be yesterday's, not last month's. That is what catches a backup job that stopped running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The encryption material followed.&lt;/strong&gt; This query must return zero. An active account that lost its &lt;code&gt;akey&lt;/code&gt; or its key pair is an unreadable vault that looks intact, the case described at the top of this page.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To check the integrity of a SQLite file, &lt;code&gt;sqlite3 db.sqlite3 'pragma integrity_check;'&lt;/code&gt; reads every page, which a &lt;code&gt;sha256sum&lt;/code&gt; does not: a digest proves the file has not changed since the copy, not that it was valid when copied. Run it on a copy, because SQLite needs to write to replay the &lt;code&gt;-wal&lt;/code&gt; journal when opening.&lt;/p&gt;

&lt;p&gt;On the file side, two commands are enough:&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;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; /tmp/vw-test/data/rsa_key.pem
find /tmp/vw-test/data &lt;span class="nt"&gt;-type&lt;/span&gt; f | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The signing key is there, and the tree has not melted away. Remember that second number: it is a floor to compare against on later restores.&lt;/p&gt;

&lt;p&gt;Then destroy everything: &lt;code&gt;docker rm -f vw-test&lt;/code&gt; and &lt;code&gt;rm -rf /tmp/vw-test&lt;/code&gt;. What you have just handled is a production vault.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this chain does not prove
&lt;/h2&gt;

&lt;p&gt;It proves that a recent backup opens, that it contains accounts and entries, and that each account's encryption material is intact. It does not prove that an entry decrypts: that needs a master password, which has no business being in a script. If the database and the data directory are checked separately, nothing verifies that every attachment cited by the database exists in the archive, which is why the two backups are taken in the same minute. And it says nothing about what has been added to the vault since the last backup: that gap is your RPO, and it is tuned with the backup frequency, not with the tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is backing up the Vaultwarden database enough?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. The data directory holds the key that signs session tokens, the attachments of your entries, and the files behind Sends. More importantly, the two pieces depend on each other: attachments are referenced from the database, so a database and a file tree taken an hour apart give you entries pointing at files that are not there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can &lt;code&gt;db.sqlite3&lt;/code&gt; be copied while Vaultwarden is running?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not with &lt;code&gt;cp&lt;/code&gt;. SQLite keeps recent writes in a &lt;code&gt;-wal&lt;/code&gt; journal next to the main file, and a plain copy catches one without the other. The &lt;code&gt;.backup&lt;/code&gt; command of &lt;code&gt;sqlite3&lt;/code&gt; produces a consistent file without stopping the service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a Vaultwarden backup contain my passwords in the clear?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No: every entry is encrypted in the browser before it reaches the server, and the master password never leaves the user's machine. A backup still has to be treated like the vault itself, because it contains everything needed to attack the master passwords offline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you verify that a restored vault really decrypts?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By logging in with a master password and displaying an entry. An automated check cannot do that, and should not be able to: there is no place to put a master password that is not also a place to steal it from. What an automated check can verify is that each account's encryption material is present and complete, which is the failure nobody sees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which image version should the restore test use?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your production's exact version, not &lt;code&gt;latest&lt;/code&gt;. Vaultwarden applies its schema migrations at start-up: an image older than the one that wrote the database refuses to start on it, and a newer image migrates the restored file. That is the right behaviour for a real restore, not for a test, which has to read the database as it was backed up.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://restoreproof.io/blog/back-up-vaultwarden-and-verify-the-vault" rel="noopener noreferrer"&gt;restoreproof.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RestoreProof&lt;/strong&gt; runs this kind of restore test on a schedule, inside your own infrastructure, and signs a report proving the backup restores. Your data never leaves your servers. Free plan, no credit card: &lt;a href="https://app.restoreproof.io" rel="noopener noreferrer"&gt;https://app.restoreproof.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>selfhosted</category>
      <category>security</category>
      <category>backup</category>
      <category>docker</category>
    </item>
    <item>
      <title>Deploying a Go + Vue SaaS on one VPS with Traefik and Let's Encrypt</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Wed, 28 Oct 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/benjy33000/deploying-a-go-vue-saas-on-one-vps-with-traefik-and-lets-encrypt-10b</link>
      <guid>https://dev.to/benjy33000/deploying-a-go-vue-saas-on-one-vps-with-traefik-and-lets-encrypt-10b</guid>
      <description>&lt;p&gt;A SaaS that compiles into one binary does not need a deployment platform. It&lt;br&gt;
needs a server, a proxy that gets certificates, and a backup you have&lt;br&gt;
restored at least once.&lt;/p&gt;

&lt;p&gt;Here is the complete setup, in the order you would actually do it.&lt;/p&gt;
&lt;h2&gt;
  
  
  What you are building
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Internet
           │  :80 / :443
      ┌────▼─────┐   Let's Encrypt certificates, HTTP→HTTPS
      │  Traefik │
      └────┬─────┘
           │  docker network "traefik"
      ┌────▼─────┐   one process: API + embedded Vue app + job worker
      │   app    │
      └────┬─────┘
           │
      ┌────▼─────┐   not exposed to the internet
      │ postgres │
      └──────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Two containers you wrote nothing for, one that is your product. A 1 vCPU /&lt;br&gt;
2 GB server runs this comfortably at the start.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: the server and DNS
&lt;/h2&gt;

&lt;p&gt;Any provider works; for EU data residency, Hetzner, Scaleway and OVHcloud are&lt;br&gt;
the usual answers. Point an &lt;code&gt;A&lt;/code&gt; record (and &lt;code&gt;AAAA&lt;/code&gt; if you have IPv6) at the&lt;br&gt;
server, install Docker, and do the boring hardening: SSH keys only, automatic&lt;br&gt;
security updates, a firewall that allows 22, 80 and 443.&lt;/p&gt;

&lt;p&gt;DNS first, because Let's Encrypt validates over HTTP and will fail politely&lt;br&gt;
until the record resolves.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2: Traefik, once per host
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create traefik
&lt;span class="nv"&gt;ACME_EMAIL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;you@example.com docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; deploy/traefik/docker-compose.yml up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Traefik now owns ports 80 and 443, redirects HTTP to HTTPS, and requests&lt;br&gt;
certificates for any container that asks through labels. You do this once; a&lt;br&gt;
second application on the same host joins the same network.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 3: configure the app
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The variables that must be right in production:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;APP_ENV&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;production&lt;/code&gt; — turns on secure cookie flags&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BASE_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;https://app.example.com&lt;/code&gt;, used in emails and OAuth callbacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DOMAIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;app.example.com&lt;/code&gt;, used by the Traefik labels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CSRF_KEY&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;openssl rand -hex 32&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POSTGRES_PASSWORD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;something random you never type again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DB_DRIVER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;postgres&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MAILER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;resend&lt;/code&gt; (+ &lt;code&gt;RESEND_API_KEY&lt;/code&gt;) or &lt;code&gt;smtp&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SUPER_ADMIN_EMAIL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the address allowed into &lt;code&gt;/admin&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TRUSTED_PROXIES&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the docker network CIDR, so &lt;code&gt;X-Forwarded-For&lt;/code&gt; is trusted only from Traefik&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three of them — &lt;code&gt;APP_ENV&lt;/code&gt;, &lt;code&gt;DB_DRIVER&lt;/code&gt; and &lt;code&gt;TRUSTED_PROXIES&lt;/code&gt; — describe this&lt;br&gt;
stack's topology and are already set by &lt;code&gt;docker-compose.prod.yml&lt;/code&gt;, which wins&lt;br&gt;
over &lt;code&gt;.env&lt;/code&gt;. They are yours to fill in only if you deploy without that file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;make setup&lt;/code&gt; writes most of this interactively if you prefer answering&lt;br&gt;
questions to reading a table.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 4: ship it
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.prod.yml up &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The multi-stage build compiles the Vue app, embeds it in the Go binary and&lt;br&gt;
produces a distroless image running as a non-root user. Migrations run at&lt;br&gt;
startup, so there is no separate migrate step to forget.&lt;/p&gt;

&lt;p&gt;Two minutes later &lt;code&gt;https://app.example.com&lt;/code&gt; answers with a valid certificate.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 5: the webhook and the mail domain
&lt;/h2&gt;

&lt;p&gt;Two things are easy to postpone and painful to discover later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payments.&lt;/strong&gt; Point the Stripe webhook endpoint at&lt;br&gt;
&lt;code&gt;https://app.example.com/api/billing/webhook&lt;/code&gt; and put the signing secret in&lt;br&gt;
&lt;code&gt;STRIPE_WEBHOOK_SECRET&lt;/code&gt;. Trigger a test event and check the log line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email deliverability.&lt;/strong&gt; Publish SPF, add the DKIM records your provider&lt;br&gt;
generates, and start DMARC at &lt;code&gt;p=none&lt;/code&gt; with a reporting address. Send from a&lt;br&gt;
subdomain (&lt;code&gt;mail.example.com&lt;/code&gt;) so your root domain's reputation is insulated.&lt;br&gt;
Mail without DKIM goes to spam at the two providers your customers use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 6: backups you have restored
&lt;/h2&gt;

&lt;p&gt;The part that separates a hobby deployment from a business:&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="c"&gt;# nightly, to somewhere that is not this server&lt;/span&gt;
docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.prod.yml &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-T&lt;/span&gt; db &lt;span class="se"&gt;\&lt;/span&gt;
  pg_dump &lt;span class="nt"&gt;-U&lt;/span&gt; govuekit govuekit | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /backups/db-&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%F&lt;span class="si"&gt;)&lt;/span&gt;.sql.gz
&lt;span class="nb"&gt;tar &lt;/span&gt;czf /backups/uploads-&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%F&lt;span class="si"&gt;)&lt;/span&gt;.tar.gz /var/lib/docker/volumes/&amp;lt;project&amp;gt;_uploads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two volumes, not one. Blobs live outside the database, so a &lt;code&gt;pg_dump&lt;/code&gt; alone&lt;br&gt;
restores accounts with broken avatars and missing attachments. If you set&lt;br&gt;
&lt;code&gt;STORAGE=s3&lt;/code&gt;, the object store holds them instead and only the database is&lt;br&gt;
yours to back up.&lt;/p&gt;

&lt;p&gt;Then do the thing nobody does: restore into a scratch container and sign in.&lt;br&gt;
An untested backup is a belief.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: updating
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.prod.yml up &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Migrations apply on boot. Rollback is the previous image tag, or the previous&lt;br&gt;
binary if you deploy without Docker. Because the frontend is embedded, there&lt;br&gt;
is no window where a new API meets an old bundle — they ship as one artifact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Without Docker, if you prefer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;make build              &lt;span class="c"&gt;# bin/govuekit, frontend inside&lt;/span&gt;
scp bin/govuekit server:/opt/myapp/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then a &lt;code&gt;systemd&lt;/code&gt; unit with &lt;code&gt;Restart=always&lt;/code&gt;, an &lt;code&gt;EnvironmentFile&lt;/code&gt;, and any&lt;br&gt;
reverse proxy in front — Caddy gets certificates with two lines, nginx needs&lt;br&gt;
certbot. The application does not care: it is one process listening on a port.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to watch once it is live
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Disk&lt;/strong&gt;, because SQLite files, uploads and Postgres all live on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate renewal&lt;/strong&gt;, which Traefik handles but you should still be told
about if it fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The dead-letter log line&lt;/strong&gt; from the mail queue: it is the first sign that
your provider's API key expired.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error reports&lt;/strong&gt;: set &lt;code&gt;SENTRY_DSN&lt;/code&gt;, or plug your own reporter — every
Error-level log record reaches it, including failures in background workers
that have no request behind them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the whole operational surface: one binary, one database, one proxy,&lt;br&gt;
two backups. If you want the cost side of the argument, read&lt;br&gt;
&lt;a href="https://govuekit.dev/blog/the-rented-stack-bill" rel="noopener noreferrer"&gt;the rented stack bill&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://govuekit.dev/blog/deploy-go-saas-vps-traefik" rel="noopener noreferrer"&gt;govuekit.dev&lt;/a&gt;. GoVueKit is a complete Go + Vue 3 SaaS codebase you buy once and own; the whole stack runs on your machine with one &lt;code&gt;docker compose up&lt;/code&gt;: &lt;a href="https://govuekit.dev/labs" rel="noopener noreferrer"&gt;https://govuekit.dev/labs&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>go</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>How container auto-discovery works with the Docker SDK and client-go</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Tue, 20 Oct 2026 08:58:00 +0000</pubDate>
      <link>https://dev.to/benjy33000/how-container-auto-discovery-works-with-the-docker-sdk-and-client-go-24ej</link>
      <guid>https://dev.to/benjy33000/how-container-auto-discovery-works-with-the-docker-sdk-and-client-go-24ej</guid>
      <description>&lt;p&gt;A monitoring tool can find your containers on its own, with no list of targets to write. There is no magic involved: it relies on the Docker and Kubernetes APIs, which already know everything about what is running. This post walks through how &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;Maintenant&lt;/a&gt;, a Go monitoring tool, does it with the Docker SDK for Go and client-go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Runtime detection
&lt;/h2&gt;

&lt;p&gt;On startup, the tool runs a detection sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the &lt;code&gt;MAINTENANT_RUNTIME&lt;/code&gt; environment variable is set, it forces the mode&lt;/li&gt;
&lt;li&gt;Otherwise, if &lt;code&gt;KUBERNETES_SERVICE_HOST&lt;/code&gt; is set, it switches to Kubernetes mode with in-cluster config&lt;/li&gt;
&lt;li&gt;Otherwise, it tries a kubeconfig (&lt;code&gt;KUBECONFIG&lt;/code&gt; or &lt;code&gt;~/.kube/config&lt;/code&gt;) and uses it if the cluster answers&lt;/li&gt;
&lt;li&gt;Otherwise, it connects to the Docker socket (&lt;code&gt;/var/run/docker.sock&lt;/code&gt;) and switches to Docker mode&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Docker mode
&lt;/h2&gt;

&lt;p&gt;In Docker mode, the official Docker SDK for Go connects to the Unix socket, mounted read-only. Three things happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Initial listing
&lt;/h3&gt;

&lt;p&gt;A call to &lt;code&gt;ContainerList&lt;/code&gt; retrieves every container, stopped ones included. For each container, the tool extracts Docker labels, the Compose project name (via the &lt;code&gt;com.docker.compose.project&lt;/code&gt; label), exposed ports, and health check configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaoq999o11k1upqypgx4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaoq999o11k1upqypgx4.webp" alt="Unified dashboard: all discovered containers at a glance" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Event listening
&lt;/h3&gt;

&lt;p&gt;A dedicated goroutine listens to Docker events in real time via &lt;code&gt;Events&lt;/code&gt;. Every &lt;code&gt;start&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt;, &lt;code&gt;die&lt;/code&gt;, and &lt;code&gt;health_status&lt;/code&gt; event is captured and processed immediately, which is what lets the dashboard update in real time over SSE.&lt;/p&gt;

&lt;h3&gt;
  
  
  Metrics collection
&lt;/h3&gt;

&lt;p&gt;The Docker &lt;code&gt;ContainerStats&lt;/code&gt; API provides CPU, memory, network, and disk I/O metrics per container. They are collected at regular intervals and stored in SQLite.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkdgpqoewwcz018phdonp.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkdgpqoewwcz018phdonp.webp" alt="System resources: CPU, memory, disk, network monitoring" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes mode
&lt;/h2&gt;

&lt;p&gt;In Kubernetes mode, the tool uses the official client-go library with in-cluster configuration (service account). The required RBAC is minimal and read-only:&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;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRole&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;maintenant&lt;/span&gt;
&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;namespaces"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;nodes"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pods"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;events"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;services"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;watch"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pods/log"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;apps"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deployments"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statefulsets"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;daemonsets"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;watch"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;batch"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jobs"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;watch"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;metrics.k8s.io"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pods"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;nodes"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing is created, modified, or deleted in the cluster: observation only.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workloads
&lt;/h3&gt;

&lt;p&gt;Unlike Docker mode, which operates at the container level, Kubernetes mode operates at the workload level: Deployments, DaemonSets, StatefulSets. Pods are grouped under their parent workload, which gives a more meaningful view of a service's health than a flat list of pods.&lt;/p&gt;

&lt;h2&gt;
  
  
  Storage: SQLite in WAL mode
&lt;/h2&gt;

&lt;p&gt;All collected data is stored in SQLite using WAL mode (Write-Ahead Logging). Readers do not block the writer and the writer does not block readers, which matters for a process that continuously collects metrics while serving a real-time dashboard.&lt;/p&gt;

&lt;p&gt;Memory stays low (under 30 MB at rest) thanks to strict goroutine management and Go's garbage collector.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Auto-discovery is the use of existing Docker and Kubernetes APIs (list, then watch events, then poll stats), combined with a lightweight Go architecture and simple storage choices.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://maintenant.dev/blog/auto-discovery-containers/" rel="noopener noreferrer"&gt;maintenant.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintenant&lt;/strong&gt; is an open-source, self-hosted monitoring tool for Docker and Kubernetes: containers, endpoints, cron heartbeats, TLS certificates and alerts, in one container that discovers your stack on its own. Install it in a minute: &lt;a href="https://maintenant.dev" rel="noopener noreferrer"&gt;https://maintenant.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This project was funded by the French Government as part of the France 2030 plan operated by Bpifrance.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo10fjt141n9rw7j6sge.png" alt="France 2030 and Cap Digital" width="174" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>docker</category>
      <category>kubernetes</category>
      <category>architecture</category>
    </item>
    <item>
      <title>The rented stack: what a BaaS-based starter really commits you to</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Mon, 19 Oct 2026 08:35:00 +0000</pubDate>
      <link>https://dev.to/benjy33000/the-rented-stack-what-a-baas-based-starter-really-commits-you-to-5h6d</link>
      <guid>https://dev.to/benjy33000/the-rented-stack-what-a-baas-based-starter-really-commits-you-to-5h6d</guid>
      <description>&lt;p&gt;A starter built on managed services gets you to a working product fast. That&lt;br&gt;
is a real benefit, and this post is not going to pretend otherwise. But the&lt;br&gt;
speed is bought with commitments that are invisible on day one and very&lt;br&gt;
visible in year two.&lt;/p&gt;

&lt;p&gt;Here is the full ledger, including the cases where renting wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four bills
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The monthly bill.&lt;/strong&gt; Platform hosting, database, auth, object storage,&lt;br&gt;
email, queue, error tracking. Each is modest alone. Together they are the kind&lt;br&gt;
of number founders discover when they finally read the invoice: the auth&lt;br&gt;
vendor's free tier ends at a few thousand monthly active users, the database&lt;br&gt;
service charges for compute you cannot turn off, and the platform bills seats&lt;br&gt;
for team members who only need to read logs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The coupling bill.&lt;/strong&gt; Vendor-specific code is code you cannot take with&lt;br&gt;
you: row-level security written in one vendor's dialect, auth tables you do&lt;br&gt;
not own, storage URLs baked into your frontend, functions written against a&lt;br&gt;
runtime that only exists there. None of it is wasted work — it is just work&lt;br&gt;
you will redo if you leave.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The compliance bill.&lt;/strong&gt; Every processor is a line in your GDPR register, a&lt;br&gt;
data-processing agreement to sign, a sub-processor list to keep current, and&lt;br&gt;
an answer you owe to every enterprise buyer's security questionnaire. Five&lt;br&gt;
vendors is five of each.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The dependency bill.&lt;/strong&gt; Their incident is your incident. Their price&lt;br&gt;
change is your board meeting. Their deprecation is your sprint.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the self-hosted alternative actually costs
&lt;/h2&gt;

&lt;p&gt;Being fair means quoting the other side properly. Self-hosting is not free:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a server to configure, patch and monitor;&lt;/li&gt;
&lt;li&gt;backups you must set up &lt;strong&gt;and restore at least once&lt;/strong&gt;, because an untested
backup is a hope;&lt;/li&gt;
&lt;li&gt;TLS certificates (automated, but yours to notice when they fail);&lt;/li&gt;
&lt;li&gt;an on-call reality where nobody else gets paged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GoVueKit's answer is to make that list as short as it can be: the app is one&lt;br&gt;
binary, sessions and the job queue live in the database, files can stay on&lt;br&gt;
disk, and &lt;code&gt;docker-compose.prod.yml&lt;/code&gt; puts the app behind Traefik with Let's&lt;br&gt;
Encrypt — the reference Traefik stack ships in &lt;code&gt;deploy/traefik/&lt;/code&gt; — so the&lt;br&gt;
certificate part is automatic. The&lt;br&gt;
&lt;a href="https://govuekit.dev/blog/deploy-go-saas-vps-traefik" rel="noopener noreferrer"&gt;deployment guide&lt;/a&gt; is a handful of commands&lt;br&gt;
long. What remains is genuinely your job: backups, monitoring and updates.&lt;/p&gt;

&lt;p&gt;Concretely, the required list is: &lt;strong&gt;a server, a domain&lt;/strong&gt;. Everything else —&lt;br&gt;
PostgreSQL instead of SQLite, S3-compatible storage, an email relay, a payment&lt;br&gt;
provider, an error reporter — is optional and swappable, and the kit boots&lt;br&gt;
without any of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The exit test
&lt;/h2&gt;

&lt;p&gt;Before you commit to any starter, run this thought experiment for each vendor&lt;br&gt;
in its stack:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The vendor triples its price, or is acquired, or changes its terms for&lt;br&gt;
companies my size. What do I do that week?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Score the answer, honestly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;What it tells you&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"Change a connection string."&lt;/td&gt;
&lt;td&gt;Healthy. Standard protocol, portable data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Export, transform, re-import over a weekend."&lt;/td&gt;
&lt;td&gt;Acceptable. Budget the weekend.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Rewrite auth and migrate users who cannot have their password hashes exported."&lt;/td&gt;
&lt;td&gt;You are not a customer, you are a tenant.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"I do not know."&lt;/td&gt;
&lt;td&gt;Find out before you build on it.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last two are the ones that decide architecture. They are also the ones the&lt;br&gt;
feature comparison table never mentions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where renting genuinely wins
&lt;/h2&gt;

&lt;p&gt;Do not read this as an argument for building everything yourself. Renting is&lt;br&gt;
the right answer when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You are validating.&lt;/strong&gt; If the product might not exist in three months, the
fastest path to a paying user beats every architectural consideration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The service is genuinely hard.&lt;/strong&gt; Payment processing, email delivery
reputation, fraud scoring, video transcoding. GoVueKit rents these too: it
uses Stripe for payments and Resend or an SMTP relay for delivery, because
building either would be malpractice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You have no operations capacity at all&lt;/strong&gt; and no intention of acquiring
any. A single founder with no infrastructure background will ship faster on
a platform, and that is a legitimate trade.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic load is your normal.&lt;/strong&gt; If your traffic swings by two orders of
magnitude on a schedule, per-request pricing may genuinely be cheaper than
provisioned capacity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The distinction worth holding: rent &lt;strong&gt;capabilities&lt;/strong&gt; that are hard and&lt;br&gt;
replaceable behind an interface. Avoid renting &lt;strong&gt;your data model, your users&lt;br&gt;
and your runtime&lt;/strong&gt;, because those are the parts you cannot swap.&lt;/p&gt;

&lt;p&gt;That is why GoVueKit puts every outbound integration behind a small seam —&lt;br&gt;
&lt;code&gt;billing.Provider&lt;/code&gt;, &lt;code&gt;email.Mailer&lt;/code&gt;, &lt;code&gt;storage.Storage&lt;/code&gt;, the error reporter —&lt;br&gt;
and keeps users, organizations, sessions, subscriptions and jobs in your own&lt;br&gt;
database. Stripe is the one payment implementation that ships; the seam is&lt;br&gt;
what you write against if you ever need another.&lt;/p&gt;

&lt;h2&gt;
  
  
  The EU angle, without the flag-waving
&lt;/h2&gt;

&lt;p&gt;If you sell to European companies, self-hosting answers three questions at&lt;br&gt;
once: where the data is, who processes it, and what happens if the answer must&lt;br&gt;
change. Host in Frankfurt, Paris or Amsterdam and the answer is "our server,&lt;br&gt;
nobody else, and we can move it".&lt;/p&gt;

&lt;p&gt;That is not compliance in itself — you still need a privacy policy, a&lt;br&gt;
register, and the ability to export and erase a user's data. GoVueKit ships&lt;br&gt;
the last part as product features (GDPR export and account erasure, audit log&lt;br&gt;
for administrative actions) precisely because they are tedious to retrofit.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical middle path
&lt;/h2&gt;

&lt;p&gt;You do not have to choose ideologically. A reasonable sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start self-hosted on one server with SQLite. It costs the price of a coffee
per month and has no vendor in it.&lt;/li&gt;
&lt;li&gt;Move to PostgreSQL when concurrent writes justify it — one environment
variable in GoVueKit, &lt;a href="https://govuekit.dev/blog/sqlite-or-postgres" rel="noopener noreferrer"&gt;same SQL either way&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Add S3-compatible storage when files outgrow the disk or you want two app
instances.&lt;/li&gt;
&lt;li&gt;Rent the genuinely hard things — payments, email delivery — from day one,
behind the interfaces that already exist.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You end up with a stack where every rented piece is replaceable in an&lt;br&gt;
afternoon, and nothing rented owns your users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://govuekit.dev/#pricing" rel="noopener noreferrer"&gt;See the dependency ledger on the product page&lt;/a&gt;, or read&lt;br&gt;
&lt;a href="https://govuekit.dev/blog/saas-boilerplate-comparison-2026" rel="noopener noreferrer"&gt;how the boilerplate families compare&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://govuekit.dev/blog/the-rented-stack-bill" rel="noopener noreferrer"&gt;govuekit.dev&lt;/a&gt;. GoVueKit is a complete Go + Vue 3 SaaS codebase you buy once and own; the whole stack runs on your machine with one &lt;code&gt;docker compose up&lt;/code&gt;: &lt;a href="https://govuekit.dev/labs" rel="noopener noreferrer"&gt;https://govuekit.dev/labs&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>saas</category>
      <category>architecture</category>
      <category>devops</category>
      <category>startup</category>
    </item>
    <item>
      <title>Back up PostgreSQL to S3: from pg_dump to a verified restore</title>
      <dc:creator>Benjamin Touchard</dc:creator>
      <pubDate>Sat, 17 Oct 2026 13:01:00 +0000</pubDate>
      <link>https://dev.to/benjy33000/back-up-postgresql-to-s3-from-pgdump-to-a-verified-restore-3lgb</link>
      <guid>https://dev.to/benjy33000/back-up-postgresql-to-s3-from-pgdump-to-a-verified-restore-3lgb</guid>
      <description>&lt;p&gt;Most PostgreSQL backup guides stop at the &lt;code&gt;pg_dump&lt;/code&gt; command line. That is the easy part. What decides whether you get your data back is everything around it: what the dump leaves out, which format you chose, whether the script really fails when the dump fails, and whether anyone has ever replayed the file.&lt;/p&gt;

&lt;p&gt;This guide covers the whole chain: what a PostgreSQL backup has to contain besides the database itself, how to pick between plain SQL, &lt;code&gt;custom&lt;/code&gt; and &lt;code&gt;directory&lt;/code&gt;, a backup script that cannot report success on an empty file, a manual restore in a throwaway container, and four SQL queries that tell you the restored database holds your data. It needs only &lt;code&gt;pg_dump&lt;/code&gt;, &lt;code&gt;docker&lt;/code&gt; and the AWS CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a PostgreSQL backup has to contain
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pg_dump&lt;/code&gt; backs up &lt;strong&gt;one database&lt;/strong&gt;: its tables, its data, its views, its functions. It does not back up what lives beside it, at server level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;roles and their passwords;&lt;/li&gt;
&lt;li&gt;the settings applied to the server (&lt;code&gt;postgresql.conf&lt;/code&gt;, &lt;code&gt;pg_hba.conf&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;the other databases on the same server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Roles are retrieved with &lt;code&gt;pg_dumpall --globals-only&lt;/code&gt;, which produces a small separate SQL file. Without it, the restore succeeds, but the application accounts no longer exist and nobody can connect.&lt;/p&gt;

&lt;p&gt;Extensions, on the other hand, are in the dump, as a &lt;code&gt;CREATE EXTENSION&lt;/code&gt;. They must therefore be &lt;strong&gt;installed&lt;/strong&gt; on the server where you restore, otherwise the dump stops on that line. That is the classic trap with &lt;code&gt;postgis&lt;/code&gt; and &lt;code&gt;pgcrypto&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the dump format
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it allows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Plain SQL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pg_dump&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;readable, fixable by hand, replayed with &lt;code&gt;psql&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;custom&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pg_dump -Fc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;already compressed, selective restore, table by table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;directory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pg_dump -Fd -j 4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the only one produced and restored in parallel&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a database of a few gigabytes, compressed plain SQL is enough and stays the easiest to inspect. Beyond that, &lt;code&gt;directory&lt;/code&gt; with &lt;code&gt;-j&lt;/code&gt; divides dump and restore time by the number of cores you give it.&lt;/p&gt;

&lt;p&gt;Do not compress a &lt;code&gt;-Fc&lt;/code&gt; or &lt;code&gt;-Fd&lt;/code&gt; dump: it already is, and gzipping it again only burns CPU for a few percent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backup script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d_%H%M%S&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://backups-billing/postgres

pg_dump &lt;span class="nt"&gt;-h&lt;/span&gt; db.internal &lt;span class="nt"&gt;-U&lt;/span&gt; backup_user &lt;span class="nt"&gt;-d&lt;/span&gt; billing &lt;span class="nt"&gt;--no-owner&lt;/span&gt; &lt;span class="nt"&gt;--no-acl&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/billing_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt;

pg_dumpall &lt;span class="nt"&gt;-h&lt;/span&gt; db.internal &lt;span class="nt"&gt;-U&lt;/span&gt; backup_user &lt;span class="nt"&gt;--globals-only&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"/backups/globals_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt;

aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/billing_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"/backups/globals_&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ts&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.sql.gz"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--no-owner --no-acl&lt;/code&gt; strips the original owners and privileges from the dump: without them, the restore asks for roles that only exist on the production server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Without &lt;code&gt;pipefail&lt;/code&gt;, a failed dump comes out as a success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;pg_dump | gzip&lt;/code&gt;, the shell only looks at the exit code of the last link. &lt;code&gt;gzip&lt;/code&gt; succeeds at compressing an empty stream, so the script returns 0 and cron is happy. &lt;code&gt;set -o pipefail&lt;/code&gt;, included in the &lt;code&gt;set -euo pipefail&lt;/code&gt; above, makes the whole line fail as soon as &lt;code&gt;pg_dump&lt;/code&gt; fails. It is the number one cause of empty backups that stay green for months.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep the timestamp in the file name: a file always overwritten under the same name leaves no chance of going back to yesterday. For retention, a lifecycle rule on the bucket does the job with no script to maintain: objects older than N days are deleted by the storage itself.&lt;/p&gt;

&lt;p&gt;That leaves running it every night. A &lt;code&gt;cron&lt;/code&gt; entry is enough, on two conditions: its error output goes somewhere someone reads, and a run that drags on does not overlap with the next one. &lt;code&gt;flock -n&lt;/code&gt; on a lock file settles the second point in one line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restoring once, by hand
&lt;/h2&gt;

&lt;p&gt;A backup is only proven once restored. Do it once, in full, on a throwaway machine. It is also the procedure you will follow the day it matters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; pg-test &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test &lt;/span&gt;postgres:17-alpine
&lt;span class="k"&gt;until &lt;/span&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;pg-test pg_isready &lt;span class="nt"&gt;-q&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do &lt;/span&gt;&lt;span class="nb"&gt;sleep &lt;/span&gt;1&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done

&lt;/span&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;pg-test createdb &lt;span class="nt"&gt;-U&lt;/span&gt; postgres billing
&lt;span class="nb"&gt;gunzip&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; /backups/globals_20260918_010000.sql.gz &lt;span class="se"&gt;\&lt;/span&gt;
  | docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; pg-test psql &lt;span class="nt"&gt;-U&lt;/span&gt; postgres &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nv"&gt;ON_ERROR_STOP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nt"&gt;-d&lt;/span&gt; postgres
&lt;span class="nb"&gt;gunzip&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; /backups/billing_20260918_010000.sql.gz &lt;span class="se"&gt;\&lt;/span&gt;
  | docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; pg-test psql &lt;span class="nt"&gt;-U&lt;/span&gt; postgres &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nv"&gt;ON_ERROR_STOP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nt"&gt;-d&lt;/span&gt; billing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ON_ERROR_STOP=1&lt;/code&gt; is essential: without it, &lt;code&gt;psql&lt;/code&gt; carries on after an error and you end up with a half-restored database that looks like it works.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Match the server's major version&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;postgres:17-alpine&lt;/code&gt; must match the major version of your server. A dump taken on a newer server does not replay on an older one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note how long it took. That is your real restore duration, the only one worth comparing to the delay you promised.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in a restored database
&lt;/h2&gt;

&lt;p&gt;A dump that replayed without an error does not mean the data is there. Four questions, in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;information_schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;table_schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'public'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;count&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;last_value&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;invoices_id_seq&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The tables are there.&lt;/strong&gt; Zero tables means an empty dump that replayed perfectly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The rows are there.&lt;/strong&gt; Compare against the order of magnitude in production, not an exact number: a database that grows is normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The data is recent.&lt;/strong&gt; The most recent date should be yesterday's, not last month's. That is what catches a backup job that stopped running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The sequences kept up.&lt;/strong&gt; A sequence left at 1 causes key collisions on the first write after the restore.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then destroy everything: &lt;code&gt;docker rm -f pg-test&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this chain does not prove
&lt;/h2&gt;

&lt;p&gt;It proves that a recent backup restores into a fresh PostgreSQL and that it contains the expected data. It does not prove that your application works on that database: for that, you need to start it against the restored container and request a page. It says nothing either about what has been created since the last dump. That gap is your RPO, and it is tuned with the backup frequency, not with the tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How often should a restore be tested?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As often as the backup runs, if you can. A nightly restore test surfaces a broken backup the morning after it breaks, rather than the day you need it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A backup job that finishes green means the backup works, doesn't it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It means the job ran without reporting an error. It says nothing about whether the file can be replayed. A &lt;code&gt;pg_dump | gzip&lt;/code&gt; pipeline without &lt;code&gt;pipefail&lt;/code&gt; returns success on an empty file. A dump taken by a role that cannot read every table restores perfectly with half the data. A schedule that stopped firing leaves behind a dump that still restores. Only a restore, followed by counting what came out, distinguishes a backup that exists from a backup that restores.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does &lt;code&gt;pg_dump&lt;/code&gt; not back up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Roles and their passwords, the server-level configuration (&lt;code&gt;postgresql.conf&lt;/code&gt;, &lt;code&gt;pg_hba.conf&lt;/code&gt;), and the other databases on the same server. Roles are dumped separately with &lt;code&gt;pg_dumpall --globals-only&lt;/code&gt;. Extensions are in the dump as &lt;code&gt;CREATE EXTENSION&lt;/code&gt;, which means they must be installed on the server you restore onto, or the restore stops on that line.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://restoreproof.io/blog/back-up-postgresql-to-s3" rel="noopener noreferrer"&gt;restoreproof.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RestoreProof&lt;/strong&gt; runs this kind of restore test on a schedule, inside your own infrastructure, and signs a report proving the backup restores. Your data never leaves your servers. Free plan, no credit card: &lt;a href="https://app.restoreproof.io" rel="noopener noreferrer"&gt;https://app.restoreproof.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>backup</category>
      <category>database</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
