<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Fediverse – Yeri Tiete</title>
    <link>https://yeri.be/tag/fediverse/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Mon, 29 May 2023 14:28:59 +0200</lastBuildDate>
    <atom:link href="https://yeri.be/tag/fediverse/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Keeping Mastodon storage in check</title>
      <link>https://yeri.be/keeping-mastodon-storage-in-check/</link>
      <pubDate>Mon, 29 May 2023 14:28:59 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/keeping-mastodon-storage-in-check/</guid><enclosure url="https://static.yeri.be/2023/05/clearing_mastodon_storage.png" length="0" type="image/png" />
      <description>&lt;p&gt;For my &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://m.superuser.one/&#34; target=&#34;_blank&#34;&gt;Mastodon instance&lt;/a&gt;, I use &lt;a href=&#34;https://yeri.be/mastodon-server-r2&#34;&gt;Cloudflare R2&lt;/a&gt;; mainly for two reasons: &lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Storage was growing quickly (~80Gb during its peak); I am hosting my instance on a RPi4 (w/ 8Gb RAM) and the SSD was filling up rapidly,&lt;/li&gt;&#xA;&lt;li&gt;I wanted something speedy to serve (big and cacheable) content (i.e. a CDN). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;While I didn&#39;t care much about storage any more, I still wanted to make sure it was kept in check, also for two reasons:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2023/05/clearing_mastodon_storage.png" alt="Keeping Mastodon storage in check"></p><p>For my <a rel="noreferrer noopener" href="https://m.superuser.one/" target="_blank">Mastodon instance</a>, I use <a href="https://yeri.be/mastodon-server-r2">Cloudflare R2</a>; mainly for two reasons: </p>
<ul>
<li>Storage was growing quickly (~80Gb during its peak); I am hosting my instance on a RPi4 (w/ 8Gb RAM) and the SSD was filling up rapidly,</li>
<li>I wanted something speedy to serve (big and cacheable) content (i.e. a CDN). </li>
</ul>
<p>While I didn't care much about storage any more, I still wanted to make sure it was kept in check, also for two reasons:</p>
<ul>
<li>Mastodon downloads a copy of all content it says on the Fediverse, and keeps it until purged. So every instance has all the content from other instances. This could theoretically lead to you hosting illegal content and getting in trouble for it,</li>
<li>Cloudflare used to be my employer, and I have free access to R2. However, there's always a risk they'll disable my employee benefits one day and get me to pay for my used storage.</li>
</ul>
<p>I run my Mastodon in a Docker instance, so your commands may vary (basically <code>tootctl X Y</code> is what matters). I run most of these commands once a week using systemd (except the media remover, that runs every day). </p>
<p>This will clear:</p>
<ul>
<li>accounts (you never interacted with)</li>
<li>header files (big picture every account can upload)</li>
<li>profile pictures</li>
<li>link preview cards</li>
<li>orphaned media (uploaded media but not posted)</li>
<li>media (from other accounts)</li>
<li>statuses (from other accounts)</li>
<li><em>and as a bonus</em> include updating Elasticsearch indices (which sound run every once in a while to optimise search)</li>
</ul>
<pre class="wp-block-code"><code>/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl accounts prune

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove --remove-headers --days 15

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove--prune-profiles --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl preview_cards remove --days 15

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove-orphans

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl statuses remove --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl search deploy</code></pre>
<p>Note that you should play with the <code>--days X</code> to find something that works for you (i.e.: you can scroll back in the history and still see posts/media, but not overload your storage). </p>
<p>I've included all the systemd files that's needed <a rel="noreferrer noopener" href="https://static.yeri.be/2023/05/mastodon-cleanup.tar" target="_blank">here</a>. Again, will only work in a Docker environment using the same paths as me. </p>
<p>The systemd files will need to be activated using something similar to this (but again, don't blindly run these commands as it'll likely not work):</p>
<pre class="wp-block-code"><code>cp *.service *.timer /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now *.timer
systemctl list-timers | grep masto</code></pre>
<p>Oh, and this is not specific to R2. This works even when storing everything locally.</p>
<p>I've <a href="https://yeri.be/using-mastodon-with-cloudflare">written before</a> on how to use Cloudflare CDN to protect/speed up your instance. </p>
]]></content:encoded>
      <category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Mastodon server: R2</title>
      <link>https://yeri.be/mastodon-server-r2/</link>
      <pubDate>Tue, 22 Nov 2022 11:49:00 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/mastodon-server-r2/</guid><enclosure url="https://static.yeri.be/2022/11/cf-r2.png" length="0" type="image/png" />
      <description>&lt;p&gt;This is a very short post because to be honest, I &lt;a href=&#34;https://m.superuser.one/@lxcid@kopiti.am/109374284873832578&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;didn&#39;t figure much out myself&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My uploads/static files are now saved in &lt;a href=&#34;http://web.archive.org/web/20230723095440/https://www.cloudflare.com/en-gb/products/r2/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;R2&lt;/a&gt; under &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://media.m.superuser.one/media_attachments/files/109/385/863/456/667/693/original/764c92352c9e9b5a.jpg&#34; target=&#34;_blank&#34;&gt;its own URL&lt;/a&gt; (part of my enterprise zone) so that my &lt;a href=&#34;https://developers.cloudflare.com/r2/data-access/public-buckets/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;normal caching rules&lt;/a&gt; and other settings are applied.&lt;/p&gt;&#xA;&lt;p&gt;Add &lt;a href=&#34;https://github.com/mastodon/mastodon/issues/20416#issuecomment-1312454331&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;these&lt;/a&gt; to your application.env file:&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;3_ENABLED = &#34;true&#34;&#xA;S3_BUCKET = &#34;&amp;lt;bucket name&gt;&#34;&#xA;S3_ENDPOINT = &#34;https://&amp;lt;some-id&gt;.r2.cloudflarestorage.com&#34;&#xA;S3_ALIAS_HOST = &#34;&amp;lt;connected domain&gt;&#34; &#xA;S3_PERMISSION = &#34;private&#34;&#xA;AWS_ACCESS_KEY_ID = &#34;&amp;lt;access_key&gt;&#34;&#xA;AWS_SECRET_ACCESS_KEY = &#34;&amp;lt;secret_access_key&gt;&#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The token/API key is a bit hard to find, but it&#39;s on &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://developers.cloudflare.com/r2/data-access/s3-api/tokens/&#34; target=&#34;_blank&#34;&gt;the top right&lt;/a&gt;. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/cf-r2.png" alt="Mastodon server: R2"></p><p>This is a very short post because to be honest, I <a href="https://m.superuser.one/@lxcid@kopiti.am/109374284873832578" target="_blank" rel="noreferrer noopener">didn't figure much out myself</a>.</p>
<p>My uploads/static files are now saved in <a href="http://web.archive.org/web/20230723095440/https://www.cloudflare.com/en-gb/products/r2/" target="_blank" rel="noreferrer noopener">R2</a> under <a rel="noreferrer noopener" href="https://media.m.superuser.one/media_attachments/files/109/385/863/456/667/693/original/764c92352c9e9b5a.jpg" target="_blank">its own URL</a> (part of my enterprise zone) so that my <a href="https://developers.cloudflare.com/r2/data-access/public-buckets/" target="_blank" rel="noreferrer noopener">normal caching rules</a> and other settings are applied.</p>
<p>Add <a href="https://github.com/mastodon/mastodon/issues/20416#issuecomment-1312454331" target="_blank" rel="noreferrer noopener">these</a> to your application.env file:</p>
<pre class="wp-block-code"><code>3_ENABLED = "true"
S3_BUCKET = "&lt;bucket name>"
S3_ENDPOINT = "https://&lt;some-id>.r2.cloudflarestorage.com"
S3_ALIAS_HOST = "&lt;connected domain>" 
S3_PERMISSION = "private"
AWS_ACCESS_KEY_ID = "&lt;access_key>"
AWS_SECRET_ACCESS_KEY = "&lt;secret_access_key>"</code></pre>
<p>The token/API key is a bit hard to find, but it's on <a rel="noreferrer noopener" href="https://developers.cloudflare.com/r2/data-access/s3-api/tokens/" target="_blank">the top right</a>. </p>
<p>Then (re)deploy your site. </p>
<pre class="wp-block-verse">I did set up a <a rel="noreferrer noopener" href="http://m.superuser.one/@yeri" target="_blank">new server</a> (my RPi4 started to struggle, and I guess if I'm half serious about Mastodon, I shouldn't host it at home), so I started afresh... But there's a way to migrate existing data to R2 as well, following <a rel="noreferrer noopener" href="https://stanislas.blog/2018/05/moving-mastodon-media-files-to-wasabi-object-storage/" target="_blank">this guide</a>. </pre>
]]></content:encoded>
      <category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Using Mastodon with Cloudflare</title>
      <link>https://yeri.be/using-mastodon-with-cloudflare/</link>
      <pubDate>Wed, 16 Nov 2022 16:07:46 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/using-mastodon-with-cloudflare/</guid><enclosure url="https://static.yeri.be/2022/11/mastodon.png" length="0" type="image/png" />
      <description>&lt;p&gt;If you&#39;re using Mastodon with Cloudflare CDN/protection and &lt;a href=&#34;http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;minify&lt;/a&gt; turned on, you&#39;ll notice the site may look broken (after a few visits, when hitting Cloudflare cache).&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;&lt;img src=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png&#34; alt=&#34;&#34; class=&#34;wp-image-70935&#34;/&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-element-caption&#34;&gt;Yeah, that&#39;s not how it&#39;s supposed to look.&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;p&gt;And you&#39;ll notice errors in the webdev tools similar to &lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute, with computed SHA-256 integrity&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js&#39; with computed SHA-256 integrity &#39;YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js&#39; with computed SHA-256 integrity &#39;1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js&#39; with computed SHA-256 integrity &#39;onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ=&#39;. The resource has been blocked.&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Basically, the sha256 hash doesn&#39;t match the js or css static files. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/mastodon.png" alt="Using Mastodon with Cloudflare"></p><p>If you're using Mastodon with Cloudflare CDN/protection and <a href="http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify" target="_blank" rel="noreferrer noopener">minify</a> turned on, you'll notice the site may look broken (after a few visits, when hitting Cloudflare cache).</p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png" alt="" class="wp-image-70935"/></a><figcaption class="wp-element-caption">Yeah, that's not how it's supposed to look.</figcaption></figure>
<p>And you'll notice errors in the webdev tools similar to <code>Failed to find a valid digest in the 'integrity' attribute, with computed SHA-256 integrity</code>:</p>
<pre class="wp-block-code"><code>Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js' with computed SHA-256 integrity 'YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js' with computed SHA-256 integrity '1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js' with computed SHA-256 integrity 'onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ='. The resource has been blocked.</code></pre>
<p>Basically, the sha256 hash doesn't match the js or css static files. </p>
<p>This happens because Cloudflare minifies those files and thus the hash has been changed.</p>
<p>To get it to work correctly, you'll need to create a Page Rule via <code>Rules > Page Rules > Create Page Rule</code> with the following info: </p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-1024x500.png" alt="" class="wp-image-70937"/></a><figcaption class="wp-element-caption">The page rule created; in this screenshot, the rule is still turned off.</figcaption></figure>
<ul>
<li>URL: YourMastodonURL.com/packs/*</li>
<li>Settings: Auto Minify: off (do not select anything)</li>
<li>Rocket Loader: slider off</li>
</ul>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule-details.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-details-1011x1024.png" alt="" class="wp-image-70938"/></a><figcaption class="wp-element-caption">Details on the page rule. Save and deploy.</figcaption></figure>
<p>Don't forget to purge your cache via the dashboard (for the Mastodon domain) via <code>Caching > Custom Purge > Hostname > YourMastodonURL.com</code>.</p>
]]></content:encoded>
      <category>errors</category><category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>javascript</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Mastodon server: email</title>
      <link>https://yeri.be/mastodon-server-email/</link>
      <pubDate>Sun, 13 Nov 2022 23:19:45 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/mastodon-server-email/</guid><enclosure url="https://static.yeri.be/2022/11/mastodon-mail.jpg" length="0" type="image/jpeg" />
      <description>&lt;p&gt;Always a hassle to get mail delivery to work. &lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-verse&#34;&gt;Had a similar problem with a VoIP (&lt;a href=&#34;https://developer.vonage.com/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Nexmo&lt;/a&gt; SMS/call forwarding) tool that just refused to work using local mail servers without a valid cert. Gave up and started using Mailgun. &lt;/pre&gt;&#xA;&lt;p&gt;Long story short: use something like Mailgun or another provider. &lt;/p&gt;&#xA;&lt;p&gt;Using localhost SMTP server support seems to be limited if you don&#39;t have working certs. &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://docs.joinmastodon.org/admin/config/#email&#34; target=&#34;_blank&#34;&gt;The documentation&lt;/a&gt; is also lacking as to what does what. Didn&#39;t figure out how to have it ignore SSL. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/mastodon-mail.jpg" alt="Mastodon server: email"></p><p>Always a hassle to get mail delivery to work. </p>
<pre class="wp-block-verse">Had a similar problem with a VoIP (<a href="https://developer.vonage.com/" target="_blank" rel="noreferrer noopener">Nexmo</a> SMS/call forwarding) tool that just refused to work using local mail servers without a valid cert. Gave up and started using Mailgun. </pre>
<p>Long story short: use something like Mailgun or another provider. </p>
<p>Using localhost SMTP server support seems to be limited if you don't have working certs. <a rel="noreferrer noopener" href="https://docs.joinmastodon.org/admin/config/#email" target="_blank">The documentation</a> is also lacking as to what does what. Didn't figure out how to have it ignore SSL. </p>
<p>This is what worked for me, using Mailgun server:</p>
<pre class="wp-block-code"><code>SMTP_SERVER=smtp.eu.mailgun.org
SMTP_PORT=465
SMTP_LOGIN=mastodon@your.domain
SMTP_PASSWORD=some-password
SMTP_FROM_ADDRESS=you@anything.com
SMTP_DELIVERY_METHOD=smtp
SMTP_SSL=true
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none</code></pre>
<p>And it looks like I'm <a href="https://peterbabic.dev/blog/setting-up-smtp-in-mastodon/" target="_blank" rel="noreferrer noopener">not the only one</a> struggling.</p>
]]></content:encoded>
      <category>linux</category><category>software</category>
      <category>fediverse</category><category>mail</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Feed2Toot</title>
      <link>https://yeri.be/feed2toot/</link>
      <pubDate>Sat, 12 Nov 2022 16:36:32 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/feed2toot/</guid><enclosure url="https://static.yeri.be/2023/10/toot.jpg" length="0" type="image/jpeg" />
      <description>&lt;p&gt;Started looking into a service to auto-post from this blog onto my &lt;a href=&#34;https://m.superuser.one&#34; data-type=&#34;URL&#34; data-id=&#34;m.superuser.one&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Mastodon&lt;/a&gt; feed. &lt;a href=&#34;https://feed2toot.readthedocs.io/en/latest/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Feed2Toot&lt;/a&gt; fit the bill perfectly. &lt;/p&gt;&#xA;&lt;p&gt;I wanted to run the whole thing from a Docker container, though, so I&#39;ll quickly write a how-to.&lt;/p&gt;&#xA;&lt;p&gt;This whole thing runs from a Raspberry Pi, as root. No k8s or k3s for me. The path I use is &lt;code&gt;/root/git/feed2toot/&lt;/code&gt;, so be sure to modify that to whatever you&#39;re using.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2023/10/toot.jpg" alt="Feed2Toot"></p><p>Started looking into a service to auto-post from this blog onto my <a href="https://m.superuser.one" data-type="URL" data-id="m.superuser.one" target="_blank" rel="noreferrer noopener">Mastodon</a> feed. <a href="https://feed2toot.readthedocs.io/en/latest/" target="_blank" rel="noreferrer noopener">Feed2Toot</a> fit the bill perfectly. </p>
<p>I wanted to run the whole thing from a Docker container, though, so I'll quickly write a how-to.</p>
<p>This whole thing runs from a Raspberry Pi, as root. No k8s or k3s for me. The path I use is <code>/root/git/feed2toot/</code>, so be sure to modify that to whatever you're using.</p>
<p>First off, <a rel="noreferrer noopener" href="https://feed2toot.readthedocs.io/en/latest/configure.html" target="_blank">get your credentials</a> for the app. You can either install the Feed2Toot package on a system (i.e. throwaway VM, to keep it clean), or use the Docker container below, but add <code>RUN apk add bash</code> and change the last line to <code>CMD ["bash"]</code> and then chroot into it via <code>docker exec -it feed2toot bash</code>.</p>
<p>This will generate two files (<code>feed2toot_clientcred.txt</code> and <code>feed2toot_usercred.txt</code>). Be sure to save these.</p>
<p>You can also try to run Feed2Toot at least once to make sure it's working and to fine-tune your <code>ini</code> file. This is mine:</p>
<pre class="wp-block-code"><code>&#91;mastodon]
instance_url=https://m.superuser.one
; Here you need the two files created by register_feed2toot_app
user_credentials=/etc/feed2toot/feed2toot_usercred.txt
client_credentials=/etc/feed2toot/feed2toot_clientcred.txt
; Default visibility is public, but you can override it:
; toot_visibility=unlisted

&#91;cache]
cachefile=/feed2toot/feed2toot.db
cache_limit=10000

&#91;lock]
lock_file=/var/lock/feed2toot.lock
lock_timeout=3600

&#91;rss]
uri=https://yeri.be/feed
; uri_list=/feed2toot/rsslist.txt
toot={title} {link}
; toot_max_len=500
title_pattern=Open Source
title_pattern_case_sensitive=true
no_uri_pattern_no_global_pattern=true
; ignore_ssl=false

&#91;hashtaglist]
; several_words_hashtags_list=/feed2toot/hashtags.txt
; no_tags_in_toot=false

&#91;feedparser]
; accept_bozo_exceptions=true

&#91;media]
; custom=/var/lib/feed2toot/media/logo.png</code></pre>
<p>I have three other files to make this work, first off <code>Dockerfile</code>:</p>
<pre class="wp-block-code"><code>FROM python:3.6-alpine
RUN pip3 install feed2toot &amp;&amp; mkdir -p /etc/feed2toot/
COPY feed2toot.ini feed2toot_clientcred.txt feed2toot_usercred.txt /etc/feed2toot/
VOLUME /feed2toot/
CMD &#91;"feed2toot", "-c", "/etc/feed2toot/feed2toot.ini"]</code></pre>
<p>The script I run to build the container (<code>start.sh</code>):</p>
<pre class="wp-block-code"><code>#!/bin/bash
git pull

BASEIMAGE=`cat Dockerfile | grep FROM | awk '{print $2}'`
docker pull $BASEIMAGE
docker stop feed2toot
docker rm feed2toot
docker build -t feed2toot .
./run.sh</code></pre>
<p>And finally, the script to run the container every so often (<code>run.sh</code>):</p>
<pre class="wp-block-code"><code>#!/bin/bash
docker run -d --rm -v /srv/mastodon/feed2toot/:/feed2toot/ --name feed2toot feed2toot</code></pre>
<p>This will save the database file under <code>/srv/mastodon/</code>, to preserve states across rebuilds.</p>
<p>Note that once Feed2Toot runs, it'll exit, and the container will be stopped. So it does not automatically run all the time. </p>
<p>So, you'll want to run this every so often. You can add a file to <code>/etc/cron.d/</code> to run it, for example, every six hours:</p>
<pre class="wp-block-code"><code>#
# cron-jobs for feed2toot
#

MAILTO=root

0 */6 * * *		root	if &#91; -x /root/git/feed2toot/run.sh ]; then /root/git/feed2toot/run.sh &gt;/dev/null; fi</code></pre>
<p>That's it. Should do the trick. It'll now post stuff from your RSS feed onto your timeline. </p>
<p>Oh, and Jeroen has <a rel="noreferrer noopener" href="https://www.forceflow.be/2022/11/11/moving-from-twitter-to-mastodon/" target="_blank">a good post</a> about Mastodon.</p>
]]></content:encoded>
      <category>linux</category><category>software</category><category>virtualisation</category>
      <category>blog</category><category>docker</category><category>fediverse</category><category>mastodon</category>
    </item>
    
  </channel>
</rss>
