<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Operations on perch docs</title><link>https://perch.mxraven.com/docs/operations/</link><description>Recent content in Operations on perch docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://perch.mxraven.com/docs/operations/index.xml" rel="self" type="application/rss+xml"/><item><title>systemd service</title><link>https://perch.mxraven.com/docs/operations/systemd/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://perch.mxraven.com/docs/operations/systemd/</guid><description>&lt;p&gt;&lt;code&gt;perch serve&lt;/code&gt; runs in the foreground, logs to stderr, drains connections on&#10;&lt;code&gt;SIGTERM&lt;/code&gt;/&lt;code&gt;SIGINT&lt;/code&gt; (waiting up to five seconds), and reloads certificate files&#10;on &lt;code&gt;SIGHUP&lt;/code&gt;, so it maps directly onto a &lt;code&gt;Type=simple&lt;/code&gt; unit. It does not fork,&#10;write a PID file, implement &lt;code&gt;sd_notify&lt;/code&gt;, or support socket activation; do not&#10;use &lt;code&gt;Type=notify&lt;/code&gt; or socket units.&lt;/p&gt;&#10;&lt;p&gt;The examples below use a dedicated &lt;code&gt;perch&lt;/code&gt; service account,&#10;&lt;code&gt;/etc/perch/perch.yaml&lt;/code&gt;, and &lt;code&gt;/var/lib/perch&lt;/code&gt;. Adjust paths if your layout&#10;differs, and keep &lt;code&gt;data_dir&lt;/code&gt; in YAML in sync with &lt;code&gt;StateDirectory&lt;/code&gt; and&#10;&lt;code&gt;ReadWritePaths&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Backup and garbage collection</title><link>https://perch.mxraven.com/docs/operations/maintenance/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://perch.mxraven.com/docs/operations/maintenance/</guid><description>&lt;p&gt;&lt;code&gt;perch gc&lt;/code&gt; and &lt;code&gt;perch backup&lt;/code&gt; are one-shot commands and are safe to run while&#10;&lt;code&gt;perch serve&lt;/code&gt; is running: SQLite WAL mode allows concurrent readers and&#10;writers.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;perch reconcile&lt;/code&gt; does not need a timer. &lt;code&gt;serve&lt;/code&gt; reconciles S3 at startup and&#10;every &lt;code&gt;storage.s3.reconcile_every&lt;/code&gt; (default &lt;code&gt;5m&lt;/code&gt;).&lt;/p&gt;&#10;&lt;h2 id="backup-timer"&gt;Backup timer&lt;a class="anchor" href="#backup-timer"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;perch backup&lt;/code&gt; refuses to overwrite an existing destination. Use a wrapper to&#10;add timestamps and prune old copies. Write &lt;code&gt;/usr/local/bin/perch-backup&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo tee /usr/local/bin/perch-backup &amp;gt;/dev/null &lt;span style="color:#5af78e"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;#!/bin/sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;set -eu&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;stamp=$(date +%Y%m%d-%H%M%S)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;/usr/local/bin/perch backup --config /etc/perch/perch.yaml &amp;#34;/var/lib/perch/backups/perch-$stamp.db&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;find /var/lib/perch/backups -type f -name &amp;#39;perch-*.db&amp;#39; -mtime +14 -delete&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;EOF&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo chmod &lt;span style="color:#ff9f43"&gt;0755&lt;/span&gt; /usr/local/bin/perch-backup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;/etc/systemd/system/perch-backup.service&lt;/code&gt;:&lt;/p&gt;</description></item></channel></rss>