<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://things.bleu255.com/runyourown/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rra</id>
	<title>Run Your Own - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://things.bleu255.com/runyourown/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rra"/>
	<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/Special:Contributions/Rra"/>
	<updated>2026-06-05T02:07:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=669</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=669"/>
		<updated>2026-04-21T12:00:50Z</updated>

		<summary type="html">&lt;p&gt;Rra: remove obsolete info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
Sometimes, specially when disk is full, postgresql may have crashed, and mastodon-streaming service will start *but* internally enter a loop of complaining that it cannot connect to the db (super annoying because to see that you need to examine the status of the service), anyway: &lt;br /&gt;
&lt;br /&gt;
 service postgresql restart&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote cache ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # adapted from https://codeberg.org/Windfluechter/mastodon-scripts&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 LD_PRELOAD=libjemalloc.so&lt;br /&gt;
 &lt;br /&gt;
 echo -n &amp;quot;Start: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 BEFORE=`df -h /dev/xvda1`&lt;br /&gt;
 BEFORE_DISK2=`df -h /dev/xvdb1`&lt;br /&gt;
 # This one might be causing people to lose followers etc&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl accounts cull | awk &#039;/The following domains were not available during the check/,0&#039; &amp;gt; ~/crawl-domains-sorted.txt&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl statuses remove --days=20&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=14 --prune-profiles --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl preview_cards remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove-orphans&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl cache clear&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media usage&lt;br /&gt;
 echo -n &amp;quot;End: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 echo &amp;quot;Disk usage before and after:&amp;quot;&lt;br /&gt;
 echo $BEFORE&lt;br /&gt;
 df -h /dev/xvda1&lt;br /&gt;
 echo $BEFORE_DISK2&lt;br /&gt;
 df -h /dev/xvdb1&lt;br /&gt;
&lt;br /&gt;
=== linkdump of bespoke maintenance scripts ===&lt;br /&gt;
&lt;br /&gt;
https://mastodon.zombocloud.com/@staticsafe/103121989384729357&lt;br /&gt;
&lt;br /&gt;
=== Make all the accounts force follow one specific account ===&lt;br /&gt;
Assuming you want everyone to follow &amp;lt;code&amp;gt;@lurk@post.lurk.org&amp;lt;/code&amp;gt; then you would do the following:&lt;br /&gt;
 su mastodon&lt;br /&gt;
 cd ~/live&lt;br /&gt;
 RAILS_ENV=production bin/tootctl accounts follow lurk --verbose&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* It can be ran live while the instance is up and running&lt;br /&gt;
* It takes a while for the command to get going, and it may spit a few warnings, then after that it&#039;s &#039;&#039;&#039;very&#039;&#039;&#039; quick and the &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; flag helps to keep track of progress&lt;br /&gt;
* At time of writing, there&#039;s no way to specify which account(s) will be affected, everyone will be processed&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=668</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=668"/>
		<updated>2026-04-21T11:58:53Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* script for pruning remote cache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
Sometimes, specially when disk is full, postgresql may have crashed, and mastodon-streaming service will start *but* internally enter a loop of complaining that it cannot connect to the db (super annoying because to see that you need to examine the status of the service), anyway: &lt;br /&gt;
&lt;br /&gt;
 service postgresql restart&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote cache ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # adapted from https://codeberg.org/Windfluechter/mastodon-scripts&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 LD_PRELOAD=libjemalloc.so&lt;br /&gt;
 &lt;br /&gt;
 echo -n &amp;quot;Start: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 BEFORE=`df -h /dev/xvda1`&lt;br /&gt;
 BEFORE_DISK2=`df -h /dev/xvdb1`&lt;br /&gt;
 # This one might be causing people to lose followers etc&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl accounts cull | awk &#039;/The following domains were not available during the check/,0&#039; &amp;gt; ~/crawl-domains-sorted.txt&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl statuses remove --days=20&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=14 --prune-profiles --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl preview_cards remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove-orphans&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl cache clear&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media usage&lt;br /&gt;
 echo -n &amp;quot;End: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 echo &amp;quot;Disk usage before and after:&amp;quot;&lt;br /&gt;
 echo $BEFORE&lt;br /&gt;
 df -h /dev/xvda1&lt;br /&gt;
 echo $BEFORE_DISK2&lt;br /&gt;
 df -h /dev/xvdb1&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with] [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Its suuuuuper slow so probably not the best way to do it. Calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB worth of headers and avatars to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== linkdump of bespoke maintenance scripts ===&lt;br /&gt;
&lt;br /&gt;
https://mastodon.zombocloud.com/@staticsafe/103121989384729357&lt;br /&gt;
&lt;br /&gt;
=== Make all the accounts force follow one specific account ===&lt;br /&gt;
Assuming you want everyone to follow &amp;lt;code&amp;gt;@lurk@post.lurk.org&amp;lt;/code&amp;gt; then you would do the following:&lt;br /&gt;
 su mastodon&lt;br /&gt;
 cd ~/live&lt;br /&gt;
 RAILS_ENV=production bin/tootctl accounts follow lurk --verbose&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* It can be ran live while the instance is up and running&lt;br /&gt;
* It takes a while for the command to get going, and it may spit a few warnings, then after that it&#039;s &#039;&#039;&#039;very&#039;&#039;&#039; quick and the &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; flag helps to keep track of progress&lt;br /&gt;
* At time of writing, there&#039;s no way to specify which account(s) will be affected, everyone will be processed&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=667</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=667"/>
		<updated>2026-02-16T13:42:40Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Restrict the backup user in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt; and set longer timeouts for Borg&lt;br /&gt;
&lt;br /&gt;
  Match user lurk&lt;br /&gt;
        X11Forwarding no&lt;br /&gt;
        PasswordAuthentication no&lt;br /&gt;
        AllowTcpForwarding no&lt;br /&gt;
        PubkeyAuthentication yes&lt;br /&gt;
        ClientAliveInterval 10&lt;br /&gt;
        ClientAliveCountMax 30&lt;br /&gt;
&lt;br /&gt;
Copy the public ssh key and add it to &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&#039;s &amp;lt;code&amp;gt;~/.ssh/authorized_keys&amp;lt;/code&amp;gt;. Then restrict the use of that key only to the &amp;lt;code&amp;gt;borg serve&amp;lt;/code&amp;gt; command ([https://borgbackup.readthedocs.io/en/1.1.16/usage/serve.html?highlight=borg%20serve#examples more info]) so that your authorized_keys files looks something like this:&lt;br /&gt;
&lt;br /&gt;
  command=&amp;quot;borg serve --restrict-to-path /data/lurk/agnesbaxter&amp;quot; ecdsa-sha2-nistp521 AAAAasdsad[..]asdsad root@agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
== Inspecting / Restoring ==&lt;br /&gt;
&lt;br /&gt;
To inspect or restore the files from the off-site backups you need to know a few things:&lt;br /&gt;
&lt;br /&gt;
* Where the backup repositories are&lt;br /&gt;
* What key they are encrypted with&lt;br /&gt;
* What the passphrase is for the key&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As of writing Feb 2026 we have the following:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Agnes has one backup repository (agnes-system in ninjahelper) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
* Larix has two backup repositories (larix-system, mastodon-borg) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
&lt;br /&gt;
Agnes&#039; repo has its own passphrase. Larix has another passphrase but its two repos share the same one. &lt;br /&gt;
&lt;br /&gt;
This passphrase needs to be entered every time you interact with the repo (unless you set the &amp;lt;code&amp;gt;BORG_PASSPHRASE&amp;lt;/code&amp;gt; env variable for the duration of the session). &lt;br /&gt;
&lt;br /&gt;
Furthermore, each repo has a unique key, which is not attached to the repo itself. Passphrases and keys are available in the keepass. &lt;br /&gt;
&lt;br /&gt;
=== Inspecting ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; You can find the actual paths and usernames by looking at the appropriate repo config in &amp;lt;code&amp;gt;/usr/local/etc/backup.d/&amp;lt;/code&amp;gt; on either Agnes or Larix.&lt;br /&gt;
&lt;br /&gt;
Get general info on the repository:&lt;br /&gt;
&lt;br /&gt;
 borg info ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This gives you some details such as whether they key is in the repository (that is on the off-site location) or only on the server the backing up happens from. This becomes relevant when you need to restore a backup from any other location than the server you are backing up from.&lt;br /&gt;
&lt;br /&gt;
 Repository ID: f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Location: ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
 Encrypted: Yes (repokey)&lt;br /&gt;
 Cache: /root/.cache/borg/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Security dir: /root/.config/borg/security/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 ------------------------------------------------------------------------------&lt;br /&gt;
                        Original size      Compressed size    Deduplicated size&lt;br /&gt;
 All archives:              259.11 GB            257.04 GB            104.89 GB &lt;br /&gt;
 &lt;br /&gt;
                        Unique chunks         Total chunks&lt;br /&gt;
 Chunk index:                  123440               525923&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List all the repository snapshots:&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This will output all the different snapshots:&lt;br /&gt;
&lt;br /&gt;
 2026-02-14T11:00:08                  Sat, 2026-02-14 11:00:10 [74easd341e160560585bd0eb968163cb1e9b89a0de405c5daa629c370895]&lt;br /&gt;
 2026-02-15T11:00:09                  Sun, 2026-02-15 11:00:10 [48d4gdsd4161293e62e286a1e9a0f6b5c2b0082d0ac8fb665a7ea3e5eccc]&lt;br /&gt;
 2026-02-16T11:00:10                  Mon, 2026-02-16 11:00:11 [dc08d6dqwe6973287f8f932b64474a6e4fcf0fe6950bf7209f1f2efa0068]&lt;br /&gt;
&lt;br /&gt;
Query a specific snapshot from the ones listed above by appending the date (will flood terminal with thousands of file names):&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10&lt;br /&gt;
&lt;br /&gt;
=== Restoring ===&lt;br /&gt;
&lt;br /&gt;
Restore an important file from a specific snapshot:&lt;br /&gt;
&lt;br /&gt;
 borg extract --list --dry-run ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10 home/mastodon/live/.env.production&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; [https://borgbackup.readthedocs.io/en/master/usage/extract.html From the docs]: This command always extracts to (&amp;quot;.&amp;quot;) and will recreate the full folder structure (&amp;lt;code&amp;gt;home/mastodon/live/.env.production&amp;lt;/code&amp;gt; in the example above). So make sure you cd to the right place before calling borg extract. When parent directories are not extracted (because of using file/directory selection or any other reason), Borg cannot restore parent directories’ metadata, e.g., owner, group, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
=== Restoring from other location ===&lt;br /&gt;
&lt;br /&gt;
To restore from a place that does not have the keys, such as from a new server, you first need to import the key for the appropriate repository.&lt;br /&gt;
&lt;br /&gt;
The keys in the keepass are the ones exported by running &amp;lt;code&amp;gt;borg key export ssh://user@10.0.1.5/path/to/repository &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
These can be imported on a new machine by writing them to a file on the new server and importing them from there. Note the structure of the key:&lt;br /&gt;
&lt;br /&gt;
  BORG_KEY f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 hqlhbGdvcml0aG2mc2hhMjU2pGRhdGHaAN4tcXvK6kpfvKnENuufVl3HumRd+ejS+Rw5bp&lt;br /&gt;
 23gYW8qGcnxPECz9BOWau2jcF12OdOyUJE+JlYIreH90p9PDDkXU7SCJ1R70MtR49+063D&lt;br /&gt;
 xsmGpOw6zcJLtVFVVv15lhYC9KQzZUd2ChGwOXnu8jTXA+q0OfMzNHXZymEA6eJTKX/qQS&lt;br /&gt;
 U9z0A+wZqCxwp5w875TITW5/6bDXm4+rmqMDL8P5mgiFsRxZgTHwD3tP4hHuwfG72vqXEx&lt;br /&gt;
 4/2KApRwYp34gLtOc5Y4P7jLKZq/DRC7Qpu4r6f2IQEcs9ktcrmkaGFzaNoAINJleelRBv&lt;br /&gt;
 BWLhh/Iqs27Etba8JaIAArppQbzCBFDZUnqml0ZXJhdGlvbnPOAAGGoKRzYWx02gAgipER&lt;br /&gt;
 XyJdua9isfZGrJ2U8WuHKosRQgC1k/2J9vDcg2CndmVyc2lvbgE=&lt;br /&gt;
&lt;br /&gt;
The header includes the repository id, the key includes linebreaks. &lt;br /&gt;
&lt;br /&gt;
Import the key from a file like so:&lt;br /&gt;
&lt;br /&gt;
 borg key import ssh://user@10.0.1.5/path/to/repository /path/to/keyfile&lt;br /&gt;
&lt;br /&gt;
[[Category:System]] [[Category: backup]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=666</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=666"/>
		<updated>2026-02-16T13:40:09Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Inspecting / Restoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Restrict the backup user in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt; and set longer timeouts for Borg&lt;br /&gt;
&lt;br /&gt;
  Match user lurk&lt;br /&gt;
        X11Forwarding no&lt;br /&gt;
        PasswordAuthentication no&lt;br /&gt;
        AllowTcpForwarding no&lt;br /&gt;
        PubkeyAuthentication yes&lt;br /&gt;
        ClientAliveInterval 10&lt;br /&gt;
        ClientAliveCountMax 30&lt;br /&gt;
&lt;br /&gt;
Copy the public ssh key and add it to &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&#039;s &amp;lt;code&amp;gt;~/.ssh/authorized_keys&amp;lt;/code&amp;gt;. Then restrict the use of that key only to the &amp;lt;code&amp;gt;borg serve&amp;lt;/code&amp;gt; command ([https://borgbackup.readthedocs.io/en/1.1.16/usage/serve.html?highlight=borg%20serve#examples more info]) so that your authorized_keys files looks something like this:&lt;br /&gt;
&lt;br /&gt;
  command=&amp;quot;borg serve --restrict-to-path /data/lurk/agnesbaxter&amp;quot; ecdsa-sha2-nistp521 AAAAasdsad[..]asdsad root@agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
== Inspecting / Restoring ==&lt;br /&gt;
&lt;br /&gt;
To inspect or restore the files from the off-site backups you need to know a few things:&lt;br /&gt;
&lt;br /&gt;
* Where the backup repositories are&lt;br /&gt;
* What key they are encrypted with&lt;br /&gt;
* What the passphrase is for the key&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As of writing Feb 2026 we have the following:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Agnes has one backup repository (agnes-system in ninjahelper) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
* Larix has two backup repositories (larix-system, mastodon-borg) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
&lt;br /&gt;
Agnes&#039; repo has its own passphrase. Larix has another passphrase but its two repos share the same one. &lt;br /&gt;
&lt;br /&gt;
This passphrase needs to be entered every time you interact with the repo (unless you set the &amp;lt;code&amp;gt;BORG_PASSPHRASE&amp;lt;/code&amp;gt; env variable for the duration of the session). &lt;br /&gt;
&lt;br /&gt;
Furthermore, all repos require a key which is not attached to the repo itself. Passphrases and keys are available in the keepass. &lt;br /&gt;
&lt;br /&gt;
=== Inspecting ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; You can find the actual paths and usernames by looking at the appropriate repo config in &amp;lt;code&amp;gt;/usr/local/etc/backup.d/&amp;lt;/code&amp;gt; on either Agnes or Larix.&lt;br /&gt;
&lt;br /&gt;
Get general info on the repository:&lt;br /&gt;
&lt;br /&gt;
 borg info ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This gives you some details such as whether they key is in the repository (that is on the off-site location) or only on the server the backing up happens from. This becomes relevant when you need to restore a backup from any other location than the server you are backing up from.&lt;br /&gt;
&lt;br /&gt;
 Repository ID: f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Location: ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
 Encrypted: Yes (repokey)&lt;br /&gt;
 Cache: /root/.cache/borg/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Security dir: /root/.config/borg/security/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 ------------------------------------------------------------------------------&lt;br /&gt;
                        Original size      Compressed size    Deduplicated size&lt;br /&gt;
 All archives:              259.11 GB            257.04 GB            104.89 GB &lt;br /&gt;
 &lt;br /&gt;
                        Unique chunks         Total chunks&lt;br /&gt;
 Chunk index:                  123440               525923&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List all the repository snapshots:&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This will output all the different snapshots:&lt;br /&gt;
&lt;br /&gt;
 2026-02-14T11:00:08                  Sat, 2026-02-14 11:00:10 [74easd341e160560585bd0eb968163cb1e9b89a0de405c5daa629c370895]&lt;br /&gt;
 2026-02-15T11:00:09                  Sun, 2026-02-15 11:00:10 [48d4gdsd4161293e62e286a1e9a0f6b5c2b0082d0ac8fb665a7ea3e5eccc]&lt;br /&gt;
 2026-02-16T11:00:10                  Mon, 2026-02-16 11:00:11 [dc08d6dqwe6973287f8f932b64474a6e4fcf0fe6950bf7209f1f2efa0068]&lt;br /&gt;
&lt;br /&gt;
Query a specific snapshot from the ones listed above by appending the date (will flood terminal with thousands of file names):&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10&lt;br /&gt;
&lt;br /&gt;
=== Restoring ===&lt;br /&gt;
&lt;br /&gt;
Restore an important file from a specific snapshot:&lt;br /&gt;
&lt;br /&gt;
 borg extract --list --dry-run ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10 home/mastodon/live/.env.production&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; [https://borgbackup.readthedocs.io/en/master/usage/extract.html From the docs]: This command always extracts to (&amp;quot;.&amp;quot;) and will recreate the full folder structure (&amp;lt;code&amp;gt;home/mastodon/live/.env.production&amp;lt;/code&amp;gt; in the example above). So make sure you cd to the right place before calling borg extract. When parent directories are not extracted (because of using file/directory selection or any other reason), Borg cannot restore parent directories’ metadata, e.g., owner, group, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
=== Restoring from other location ===&lt;br /&gt;
&lt;br /&gt;
To restore from a place that does not have the keys, such as from a new server, you first need to import the key for the appropriate repository.&lt;br /&gt;
&lt;br /&gt;
The keys in the keepass are the ones exported by running &amp;lt;code&amp;gt;borg key export ssh://user@10.0.1.5/path/to/repository &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
These can be imported on a new machine by writing them to a file on the new server and importing them from there. Note the structure of the key:&lt;br /&gt;
&lt;br /&gt;
  BORG_KEY f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 hqlhbGdvcml0aG2mc2hhMjU2pGRhdGHaAN4tcXvK6kpfvKnENuufVl3HumRd+ejS+Rw5bp&lt;br /&gt;
 23gYW8qGcnxPECz9BOWau2jcF12OdOyUJE+JlYIreH90p9PDDkXU7SCJ1R70MtR49+063D&lt;br /&gt;
 xsmGpOw6zcJLtVFVVv15lhYC9KQzZUd2ChGwOXnu8jTXA+q0OfMzNHXZymEA6eJTKX/qQS&lt;br /&gt;
 U9z0A+wZqCxwp5w875TITW5/6bDXm4+rmqMDL8P5mgiFsRxZgTHwD3tP4hHuwfG72vqXEx&lt;br /&gt;
 4/2KApRwYp34gLtOc5Y4P7jLKZq/DRC7Qpu4r6f2IQEcs9ktcrmkaGFzaNoAINJleelRBv&lt;br /&gt;
 BWLhh/Iqs27Etba8JaIAArppQbzCBFDZUnqml0ZXJhdGlvbnPOAAGGoKRzYWx02gAgipER&lt;br /&gt;
 XyJdua9isfZGrJ2U8WuHKosRQgC1k/2J9vDcg2CndmVyc2lvbgE=&lt;br /&gt;
&lt;br /&gt;
The header includes the repository id, the key includes linebreaks. &lt;br /&gt;
&lt;br /&gt;
Import the key from a file like so:&lt;br /&gt;
&lt;br /&gt;
 borg key import ssh://user@10.0.1.5/path/to/repository /path/to/keyfile&lt;br /&gt;
&lt;br /&gt;
[[Category:System]] [[Category: backup]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=665</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=665"/>
		<updated>2026-02-16T13:10:58Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Restrict the backup user in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt; and set longer timeouts for Borg&lt;br /&gt;
&lt;br /&gt;
  Match user lurk&lt;br /&gt;
        X11Forwarding no&lt;br /&gt;
        PasswordAuthentication no&lt;br /&gt;
        AllowTcpForwarding no&lt;br /&gt;
        PubkeyAuthentication yes&lt;br /&gt;
        ClientAliveInterval 10&lt;br /&gt;
        ClientAliveCountMax 30&lt;br /&gt;
&lt;br /&gt;
Copy the public ssh key and add it to &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&#039;s &amp;lt;code&amp;gt;~/.ssh/authorized_keys&amp;lt;/code&amp;gt;. Then restrict the use of that key only to the &amp;lt;code&amp;gt;borg serve&amp;lt;/code&amp;gt; command ([https://borgbackup.readthedocs.io/en/1.1.16/usage/serve.html?highlight=borg%20serve#examples more info]) so that your authorized_keys files looks something like this:&lt;br /&gt;
&lt;br /&gt;
  command=&amp;quot;borg serve --restrict-to-path /data/lurk/agnesbaxter&amp;quot; ecdsa-sha2-nistp521 AAAAasdsad[..]asdsad root@agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
== Inspecting / Restoring ==&lt;br /&gt;
&lt;br /&gt;
To inspect or restore the files from the off-site backups you need to know a few things:&lt;br /&gt;
&lt;br /&gt;
* Where the backup repositories are&lt;br /&gt;
* What key they are encrypted with&lt;br /&gt;
* What the passphrase is for the key&lt;br /&gt;
&lt;br /&gt;
As of writing Feb 2026 we have the following:&lt;br /&gt;
&lt;br /&gt;
Agnes has one backup repository (agnes-system in ninjahelper) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
&lt;br /&gt;
Larix has two backup repositories (larix-system, mastodon-borg) sent to [[Tinc Settings for LURK|Manis and Stuff]].&lt;br /&gt;
&lt;br /&gt;
Agnes&#039; repo has its own passphrase and Larix have their own passphrase, which are necessary every time you interact with them (unless you set the &amp;lt;code&amp;gt;BORG_PASSPHRASE&amp;lt;/code&amp;gt; env variable). Furthermore, all repos require a key which is not attached to the repo itself. Passphrases and keys are available in the keepass. &lt;br /&gt;
&lt;br /&gt;
=== Inspecting ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; You can find the actual paths and usernames by looking at the appropriate repo config in &amp;lt;code&amp;gt;/usr/local/etc/backup.d/&amp;lt;/code&amp;gt; on either Agnes or Larix.&lt;br /&gt;
&lt;br /&gt;
Get general info on the repository:&lt;br /&gt;
&lt;br /&gt;
 borg info ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This gives you some details such as whether they key is in the repository (that is on the off-site location) or only on the server the backing up happens from. This becomes relevant when you need to restore a backup from any other location than the server you are backing up from.&lt;br /&gt;
&lt;br /&gt;
 Repository ID: f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Location: ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
 Encrypted: Yes (repokey)&lt;br /&gt;
 Cache: /root/.cache/borg/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 Security dir: /root/.config/borg/security/f80fe7d9b22c3425222a979eb607585bd0eb968163cb1e9b&lt;br /&gt;
 ------------------------------------------------------------------------------&lt;br /&gt;
                        Original size      Compressed size    Deduplicated size&lt;br /&gt;
 All archives:              259.11 GB            257.04 GB            104.89 GB &lt;br /&gt;
 &lt;br /&gt;
                        Unique chunks         Total chunks&lt;br /&gt;
 Chunk index:                  123440               525923&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List all the repository snapshots:&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository&lt;br /&gt;
&lt;br /&gt;
This will output all the different snapshots:&lt;br /&gt;
&lt;br /&gt;
 2026-02-14T11:00:08                  Sat, 2026-02-14 11:00:10 [74easd341e160560585bd0eb968163cb1e9b89a0de405c5daa629c370895]&lt;br /&gt;
 2026-02-15T11:00:09                  Sun, 2026-02-15 11:00:10 [48d4gdsd4161293e62e286a1e9a0f6b5c2b0082d0ac8fb665a7ea3e5eccc]&lt;br /&gt;
 2026-02-16T11:00:10                  Mon, 2026-02-16 11:00:11 [dc08d6dqwe6973287f8f932b64474a6e4fcf0fe6950bf7209f1f2efa0068]&lt;br /&gt;
&lt;br /&gt;
Query a specific snapshot from the ones listed above by appending the date (will flood terminal with thousands of file names):&lt;br /&gt;
&lt;br /&gt;
 borg list ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10&lt;br /&gt;
&lt;br /&gt;
=== Restoring ===&lt;br /&gt;
&lt;br /&gt;
Restore an important file from a specific snapshot:&lt;br /&gt;
&lt;br /&gt;
 borg extract --list --dry-run ssh://user@10.0.1.5/path/to/repository::2026-02-16T11:00:10 home/mastodon/live/.env.production&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;n.b.&#039;&#039;&#039; [https://borgbackup.readthedocs.io/en/master/usage/extract.html From the docs]: This command always extracts to (&amp;quot;.&amp;quot;) and will recreate the full folder structure. So make sure you cd to the right place before calling borg extract. When parent directories are not extracted (because of using file/directory selection or any other reason), Borg cannot restore parent directories’ metadata, e.g., owner, group, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
[[Category:System]] [[Category: backup]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=664</id>
		<title>Tinc Settings for LURK</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=664"/>
		<updated>2026-02-16T11:58:30Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LURK specific settings ==&lt;br /&gt;
&lt;br /&gt;
Tinc is currently installed to connect nodes in the lurk network&lt;br /&gt;
&lt;br /&gt;
 agnesbaxter = 10.0.1.3&lt;br /&gt;
 skattkista = 10.0.1.2 (currently dead)&lt;br /&gt;
 vrijdagmiddagborrel = 10.0.1.4 (gone)&lt;br /&gt;
 manis = 10.0.1.5&lt;br /&gt;
 poplar = 10.0.1.6 (gone)&lt;br /&gt;
 stuff = 10.0.1.7&lt;br /&gt;
 tilia = 10.0.1.8&lt;br /&gt;
 larix = 10.0.1.9&lt;br /&gt;
&lt;br /&gt;
all clients that connect via server agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=663</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=663"/>
		<updated>2026-02-16T11:52:43Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Restrict the backup user in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt; and set longer timeouts for Borg&lt;br /&gt;
&lt;br /&gt;
  Match user lurk&lt;br /&gt;
        X11Forwarding no&lt;br /&gt;
        PasswordAuthentication no&lt;br /&gt;
        AllowTcpForwarding no&lt;br /&gt;
        PubkeyAuthentication yes&lt;br /&gt;
        ClientAliveInterval 10&lt;br /&gt;
        ClientAliveCountMax 30&lt;br /&gt;
&lt;br /&gt;
Copy the public ssh key and add it to &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&#039;s &amp;lt;code&amp;gt;~/.ssh/authorized_keys&amp;lt;/code&amp;gt;. Then restrict the use of that key only to the &amp;lt;code&amp;gt;borg serve&amp;lt;/code&amp;gt; command ([https://borgbackup.readthedocs.io/en/1.1.16/usage/serve.html?highlight=borg%20serve#examples more info]) so that your authorized_keys files looks something like this:&lt;br /&gt;
&lt;br /&gt;
  command=&amp;quot;borg serve --restrict-to-path /data/lurk/agnesbaxter&amp;quot; ecdsa-sha2-nistp521 AAAAasdsad[..]asdsad root@agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:System]] [[Category: backup]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Welcome_to_post.lurk.org&amp;diff=656</id>
		<title>Welcome to post.lurk.org</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Welcome_to_post.lurk.org&amp;diff=656"/>
		<updated>2025-06-17T10:45:43Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is for new users of post.lurk.org. Here we have compiled some information that can help you with the software we use, including resources that explain what the Fediverse is about. If some links are dead, please let us know so we can update this page!&lt;br /&gt;
&lt;br /&gt;
== Micro-blogging on the Fediverse ==&lt;br /&gt;
=== What is an instance? ===&lt;br /&gt;
In brief: the Fediverse is a is an ensemble of interconnected servers that are used for all sort of services (micro-blogging, file hosting, video sharing, etc). An instance is the name given to the server, and sometimes by extension the community, around a particular server that runs software to offer a service as part of an interconnected network of other servers and services available through the Fediverse. https://post.lurk.org is an instance for the LURK community. It runs a modified version of the Mastodon software, which is a FLOSS micro-blogging platform. Generally speaking, users on our instance can interact/follow other users from other instances.&lt;br /&gt;
&lt;br /&gt;
[[File:Fedi-local.png|640px]]&lt;br /&gt;
&lt;br /&gt;
=== Discovering content and people ===&lt;br /&gt;
The Fediverse and Mastodon are not super intuitive. The most difficult thing is to discover content and people you find interesting. For that there are generally two strategies:&lt;br /&gt;
* First, you can post and subscribe to hashtags. This is currently the best way to find particular conversations. For example you could look at or post to #fediverse to find others interested in that topic. Most commonly #introductions is used to describe briefly what you are interested in, that way people can follow you. We recommend that you write such an #introductions post so that some of us can boost you for visibility.&lt;br /&gt;
* The second strategy is to make use of both the &#039;Local&#039; and &#039;Federated&#039;/&#039;Global&#039; timelines. The local one shows all posts written by people on post.lurk.org. The &#039;Global&#039; timeline shows all posts by people followed by people on post.lurk.org but who are themselves on a different part of the network.&lt;br /&gt;
* The third strategy is to make use of external tools. One such option is [https://streetpass.social/ Street Pass], a browser extension that automatically collects profiles of fediverse users as you browse the web. Another option is to use [https://fedidevs.com/starter-packs/ Starter Packs], which are collections of accounts that you can automatically follow.&lt;br /&gt;
&lt;br /&gt;
=== Post visibility ===&lt;br /&gt;
Mastodon has quite granular visibility settings for your posts, you find them in the message compose field. Here is how they work:&lt;br /&gt;
&lt;br /&gt;
[[File:Cas-post-privacy.png|640px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In addition to those we have another option (the chain link) which makes your posts not federate, meaning they are only visible on post.lurk.org. Only people registered and logged in post.lurk.org will see a local, non-federated, post.&#039;&#039;&#039; This is specific to the modified version of Mastodon that we run. This is not a feature that you will find in the vast majority of other Mastodon instances. We think this is an interesting feature because we believe that not all conversations/posts should be broadcasted to the whole network. It helps develop the local subculture within LURK, get to know and trust each other, and provide a safer space for private jokes or difficult conversations.&lt;br /&gt;
&lt;br /&gt;
== Account Settings ==&lt;br /&gt;
* It is possible to switch to different colour themes and even a multi-column layout in your preferences: https://post.lurk.org/settings/preferences/appearance&lt;br /&gt;
* If you want to move to another instance, no problem! You can migrate your social graph here: https://post.lurk.org/settings/profile&lt;br /&gt;
* If you know of other people who could feel at home on post.lurk.org, that you trust, and can clearly identify to the [https://post.lurk.org/about/more#is-this-for-you &amp;quot;Is this for you?&amp;quot;] section of post.lurk.org, then please invite them by generating an invite code. https://post.lurk.org/invites . Make sure you also send them here when you do so!&lt;br /&gt;
&lt;br /&gt;
== post.lurg.org is part of LURK ==&lt;br /&gt;
=== Terms of Service and Server Rules ===&lt;br /&gt;
Super important, if you did not read them yet, please check our terms and rules. https://post.lurk.org/about/more&lt;br /&gt;
&lt;br /&gt;
=== Staying in touch ===&lt;br /&gt;
In case the instance is down, or if you have a problem, you can get in touch via email (see https://lurk.org) or chat by using https://partyline.lurk.org&lt;br /&gt;
&lt;br /&gt;
Due to a recent changes in Mastodon, new users do not follow automatically the admins of the instance by default. This is a an issue for a small community like ours as we were using this feature to keep track of users activity (including boosting some of your initial posts so you can get more visibility across the network at first), and also use our own personal account to communicate about server maintenance and general LURK news. Therefore please do follow our shared admin account [https://post.lurk.org/@lurk @lurk]. From time to time we also run a server side command to make sure all users are still following this account, so no, there&#039;s no escape :)&lt;br /&gt;
&lt;br /&gt;
Please send us a direct message to [https://post.lurk.org/@lurk @lurk] if you have any questions or issues that you&#039;d like to address, if you are feeling unsafe and/or if you think there might be a breach of the terms of service and you&#039;d like to discuss this with us before taking action.&lt;br /&gt;
&lt;br /&gt;
Of course you can also follow our personal accounts, if what we post is relevant to your insterests: [https://post.lurk.org/@320x200 @320x200], [https://post.lurk.org/@lidia_p @lidia_p], and [https://post.lurk.org/@rra @rra].&lt;br /&gt;
&lt;br /&gt;
=== Support the infrastructure! ===&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FFFFFF; background:#0000FF&amp;quot;&amp;gt;&#039;&#039;&#039;Last but not least, LURK can only run such services thanks to its community. If you are in a privileged enough position in which you can afford supporting us financially, please consider chipping in to make LURK sustainable in the long run! We need to break the free-as-in-beer culture of surveillance capitalism.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
https://opencollective.com/lurk&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
If you wanna do some serious reading on what else is possible, and perspectives on the Fediverse, here are some pointers:&lt;br /&gt;
* https://github.com/joyeusenoelle/GuideToMastodon&lt;br /&gt;
* https://monoskop.org/images/c/cc/Mansoux_Aymeric_Abbing_Roel_Roscam_2020_Seven_Theses_on_the_Fediverse_and_the_Becoming_of_FLOSS.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=640</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=640"/>
		<updated>2025-02-04T10:01:59Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* script for pruning remote cache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
Sometimes, specially when disk is full, postgresql may have crashed, and mastodon-streaming service will start *but* internally enter a loop of complaining that it cannot connect to the db (super annoying because to see that you need to examine the status of the service), anyway: &lt;br /&gt;
&lt;br /&gt;
 service postgresql restart&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote cache ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 LD_PRELOAD=libjemalloc.so&lt;br /&gt;
 &lt;br /&gt;
 echo -n &amp;quot;Start: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 BEFORE=`df -h /dev/xvda1`&lt;br /&gt;
 BEFORE_DISK2=`df -h /dev/xvdb1`&lt;br /&gt;
 # This one might be causing people to lose followers etc&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl accounts cull | awk &#039;/The following domains were not available during the check/,0&#039; &amp;gt; ~/crawl-domains-sorted.txt&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl statuses remove --days=20&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=14 --prune-profiles --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl preview_cards remove --days=2 --concurrency=8&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media remove-orphans&lt;br /&gt;
 #ionice -c 3 /home/mastodon/live/bin/tootctl cache clear&lt;br /&gt;
 ionice -c 3 /home/mastodon/live/bin/tootctl media usage&lt;br /&gt;
 echo -n &amp;quot;End: &amp;quot;&lt;br /&gt;
 date&lt;br /&gt;
 echo &amp;quot;Disk usage before and after:&amp;quot;&lt;br /&gt;
 echo $BEFORE&lt;br /&gt;
 df -h /dev/xvda1&lt;br /&gt;
 echo $BEFORE_DISK2&lt;br /&gt;
 df -h /dev/xvdb1&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with] [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Its suuuuuper slow so probably not the best way to do it. Calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB worth of headers and avatars to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== linkdump of bespoke maintenance scripts ===&lt;br /&gt;
&lt;br /&gt;
https://mastodon.zombocloud.com/@staticsafe/103121989384729357&lt;br /&gt;
&lt;br /&gt;
=== Make all the accounts force follow one specific account ===&lt;br /&gt;
Assuming you want everyone to follow &amp;lt;code&amp;gt;@lurk@post.lurk.org&amp;lt;/code&amp;gt; then you would do the following:&lt;br /&gt;
 su mastodon&lt;br /&gt;
 cd ~/live&lt;br /&gt;
 RAILS_ENV=production bin/tootctl accounts follow lurk --verbose&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* It can be ran live while the instance is up and running&lt;br /&gt;
* It takes a while for the command to get going, and it may spit a few warnings, then after that it&#039;s &#039;&#039;&#039;very&#039;&#039;&#039; quick and the &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; flag helps to keep track of progress&lt;br /&gt;
* At time of writing, there&#039;s no way to specify which account(s) will be affected, everyone will be processed&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=639</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=639"/>
		<updated>2025-02-04T10:00:53Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
Sometimes, specially when disk is full, postgresql may have crashed, and mastodon-streaming service will start *but* internally enter a loop of complaining that it cannot connect to the db (super annoying because to see that you need to examine the status of the service), anyway: &lt;br /&gt;
&lt;br /&gt;
 service postgresql restart&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote cache ===&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
export RAILS_ENV=production&lt;br /&gt;
LD_PRELOAD=libjemalloc.so&lt;br /&gt;
&lt;br /&gt;
echo -n &amp;quot;Start: &amp;quot;&lt;br /&gt;
date&lt;br /&gt;
BEFORE=`df -h /dev/xvda1`&lt;br /&gt;
BEFORE_DISK2=`df -h /dev/xvdb1`&lt;br /&gt;
# This one might be causing people to lose followers etc&lt;br /&gt;
#ionice -c 3 /home/mastodon/live/bin/tootctl accounts cull | awk &#039;/The following domains were not available during the check/,0&#039; &amp;gt; ~/crawl-domains-sorted.txt&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl statuses remove --days=20&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=2 --concurrency=8&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl media remove --days=14 --prune-profiles --concurrency=8&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl preview_cards remove --days=2 --concurrency=8&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl media remove-orphans&lt;br /&gt;
#ionice -c 3 /home/mastodon/live/bin/tootctl cache clear&lt;br /&gt;
ionice -c 3 /home/mastodon/live/bin/tootctl media usage&lt;br /&gt;
echo -n &amp;quot;End: &amp;quot;&lt;br /&gt;
date&lt;br /&gt;
echo &amp;quot;Disk usage before and after:&amp;quot;&lt;br /&gt;
echo $BEFORE&lt;br /&gt;
df -h /dev/xvda1&lt;br /&gt;
echo $BEFORE_DISK2&lt;br /&gt;
df -h /dev/xvdb1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with] [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Its suuuuuper slow so probably not the best way to do it. Calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB worth of headers and avatars to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== linkdump of bespoke maintenance scripts ===&lt;br /&gt;
&lt;br /&gt;
https://mastodon.zombocloud.com/@staticsafe/103121989384729357&lt;br /&gt;
&lt;br /&gt;
=== Make all the accounts force follow one specific account ===&lt;br /&gt;
Assuming you want everyone to follow &amp;lt;code&amp;gt;@lurk@post.lurk.org&amp;lt;/code&amp;gt; then you would do the following:&lt;br /&gt;
 su mastodon&lt;br /&gt;
 cd ~/live&lt;br /&gt;
 RAILS_ENV=production bin/tootctl accounts follow lurk --verbose&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* It can be ran live while the instance is up and running&lt;br /&gt;
* It takes a while for the command to get going, and it may spit a few warnings, then after that it&#039;s &#039;&#039;&#039;very&#039;&#039;&#039; quick and the &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; flag helps to keep track of progress&lt;br /&gt;
* At time of writing, there&#039;s no way to specify which account(s) will be affected, everyone will be processed&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Welcome_to_post.lurk.org&amp;diff=638</id>
		<title>Welcome to post.lurk.org</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Welcome_to_post.lurk.org&amp;diff=638"/>
		<updated>2025-01-21T11:40:52Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is for new users of post.lurk.org. Here we have compiled some information that can help you with the software we use, including resources that explain what the Fediverse is about. If some links are dead, please let us know so we can update this page!&lt;br /&gt;
&lt;br /&gt;
== Micro-blogging on the Fediverse ==&lt;br /&gt;
=== What is an instance? ===&lt;br /&gt;
In brief: the Fediverse is a is an ensemble of interconnected servers that are used for all sort of services (micro-blogging, file hosting, video sharing, etc). An instance is the name given to the server, and sometimes by extension the community, around a particular server that runs software to offer a service as part of an interconnected network of other servers and services available through the Fediverse. https://post.lurk.org is an instance for the LURK community. It runs a modified version of the Mastodon software, which is a FLOSS micro-blogging platform. Generally speaking, users on our instance can interact/follow other users from other instances.&lt;br /&gt;
&lt;br /&gt;
[[File:Fedi-local.png|640px]]&lt;br /&gt;
&lt;br /&gt;
=== Discovering content and people ===&lt;br /&gt;
The Fediverse and Mastodon are not super intuitive. The most difficult thing is to discover content and people you find interesting. For that there are generally two strategies:&lt;br /&gt;
* First, you can post and subscribe to hashtags. This is currently the best way to find particular conversations. For example you could look at or post to #fediverse to find others interested in that topic. Most commonly #introductions is used to describe briefly what you are interested in, that way people can follow you. We recommend that you write such an #introductions post so that some of us can boost you for visibility.&lt;br /&gt;
* The second strategy is to make use of both the &#039;Local&#039; and &#039;Federated&#039;/&#039;Global&#039; timelines. The local one shows all posts written by people on post.lurk.org. The &#039;Global&#039; timeline shows all posts by people followed by people on post.lurk.org but who are themselves on a different part of the network.&lt;br /&gt;
* The third strategy is to make use of external tools. One such option is [https://streetpass.social/ Street Pass], a browser extension that automatically collects profiles of fediverse users as you browse the web. Another option is to use [https://fedidevs.com/starter-packs/ Starter Packs], which are collections of accounts that you can automatically follow.&lt;br /&gt;
&lt;br /&gt;
=== Post visibility ===&lt;br /&gt;
Mastodon has quite granular visibility settings for your posts, you find them in the message compose field. Here is how they work:&lt;br /&gt;
&lt;br /&gt;
[[File:Cas-post-privacy.png|640px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In addition to those we have another option (the chain link) which makes your posts not federate, meaning they are only visible on post.lurk.org. Only people registered and logged in post.lurk.org will see a local, non-federated, post.&#039;&#039;&#039; This is specific to the modified version of Mastodon that we run. This is not a feature that you will find in the vast majority of other Mastodon instances. We think this is an interesting feature because we believe that not all conversations/posts should be broadcasted to the whole network. It helps develop the local subculture within LURK, get to know and trust each other, and provide a safer space for private jokes or difficult conversations.&lt;br /&gt;
&lt;br /&gt;
== Account Settings ==&lt;br /&gt;
* It is possible to switch to different colour themes and even a multi-column layout in your preferences: https://post.lurk.org/settings/preferences/appearance&lt;br /&gt;
* If you want to move to another instance, no problem! You can migrate your social graph here: https://post.lurk.org/settings/profile&lt;br /&gt;
* If you know of other people who could feel at home on post.lurk.org, that you trust, and can clearly identify to the [https://post.lurk.org/about/more#is-this-for-you &amp;quot;Is this for you?&amp;quot;] section of post.lurk.org, then please invite them by generating an invite code. https://post.lurk.org/invites . Make sure you also send them here when you do so!&lt;br /&gt;
&lt;br /&gt;
== post.lurg.org is part of LURK ==&lt;br /&gt;
=== Terms of Service and Server Rules ===&lt;br /&gt;
Super important, if you did not read them yet, please check our terms and rules. https://post.lurk.org/about/more&lt;br /&gt;
&lt;br /&gt;
=== Staying in touch ===&lt;br /&gt;
In case the instance is down, or if you have a problem, you can get in touch via email (see https://lurk.org) or chat by using https://partyline.lurk.org&lt;br /&gt;
&lt;br /&gt;
Due to a recent changes in Mastodon, new users do not follow automatically the admins of the instance by default. This is a an issue for a small community like ours as we were using this feature to keep track of users activity (including boosting some of your initial posts so you can get more visibility across the network at first), and also use our own personal account to communicate about server maintenance and general LURK news. Therefore please do follow our shared admin account [https://post.lurk.org/@lurk @lurk]. From time to time we also run a server side command to make sure all users are still following this account, so no, there&#039;s no escape :)&lt;br /&gt;
&lt;br /&gt;
Please send us a direct message to [https://post.lurk.org/@lurk @lurk] if you have any questions or issues that you&#039;d like to address, if you are feeling unsafe and/or if you think there might be a breach of the terms of service and you&#039;d like to discuss this with us before taking action.&lt;br /&gt;
&lt;br /&gt;
Of course you can also follow our personal accounts, if what we post is relevant to your insterests: [https://post.lurk.org/@320x200 @320x200], [https://post.lurk.org/@lidia_p @lidia_p], and [https://post.lurk.org/@rra @rra].&lt;br /&gt;
&lt;br /&gt;
=== Support the infrastructure! ===&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FFFFFF; background:#0000FF&amp;quot;&amp;gt;&#039;&#039;&#039;Last but not least, LURK can only run such services thanks to its community. If you are in a privileged enough position in which you can afford supporting us financially, please consider chipping in to make LURK sustainable in the long run! We need to break the free-as-in-beer culture of surveillance capitalism.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
https://opencollective.com/lurk&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
If you wanna do some serious reading on what else is possible, and perspectives on the Fediverse, here are some pointers:&lt;br /&gt;
* https://github.com/joyeusenoelle/GuideToMastodon&lt;br /&gt;
* https://monoskop.org/images/c/cc/Mansoux_Aymeric_Abbing_Roel_Roscam_2020_Seven_Theses_on_the_Fediverse_and_the_Becoming_of_FLOSS.pdf&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=517</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=517"/>
		<updated>2023-07-05T08:45:58Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Restrict the backup user in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt; and set longer timeouts for Borg&lt;br /&gt;
&lt;br /&gt;
  Match user lurk&lt;br /&gt;
        X11Forwarding no&lt;br /&gt;
        PasswordAuthentication no&lt;br /&gt;
        AllowTcpForwarding no&lt;br /&gt;
        PubkeyAuthentication yes&lt;br /&gt;
        ClientAliveInterval 10&lt;br /&gt;
        ClientAliveCountMax 30&lt;br /&gt;
&lt;br /&gt;
Copy the public ssh key and add it to &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&#039;s &amp;lt;code&amp;gt;~/.ssh/authorized_keys&amp;lt;/code&amp;gt;. Then restrict the use of that key only to the &amp;lt;code&amp;gt;borg serve&amp;lt;/code&amp;gt; command ([https://borgbackup.readthedocs.io/en/1.1.16/usage/serve.html?highlight=borg%20serve#examples more info]) so that your authorized_keys files looks something like this:&lt;br /&gt;
&lt;br /&gt;
  command=&amp;quot;borg serve --restrict-to-path /data/lurk/agnesbaxter&amp;quot; ecdsa-sha2-nistp521 AAAAasdsad[..]asdsad root@agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:System]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=516</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=516"/>
		<updated>2023-07-04T13:09:20Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Borg Backup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption by setting &amp;lt;code&amp;gt;encryption = keyfile&amp;lt;/code&amp;gt; and choosing a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
[[Category:System]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=513</id>
		<title>Tinc Settings for LURK</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=513"/>
		<updated>2022-05-06T07:28:09Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LURK specific settings ==&lt;br /&gt;
&lt;br /&gt;
Tinc is currently installed to connect nodes in the lurk network&lt;br /&gt;
&lt;br /&gt;
 agnesbaxter = 10.0.1.3&lt;br /&gt;
 skattkista = 10.0.1.2&lt;br /&gt;
 vrijdagmiddagborrel = 10.0.1.4&lt;br /&gt;
 manis = 10.0.1.5&lt;br /&gt;
&lt;br /&gt;
both skattkista, vmb, manis connect to agnesbaxter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Wildcard_Certificates_with_acme.sh&amp;diff=469</id>
		<title>Wildcard Certificates with acme.sh</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Wildcard_Certificates_with_acme.sh&amp;diff=469"/>
		<updated>2020-12-26T11:31:58Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Using acme.sh ==&lt;br /&gt;
&lt;br /&gt;
Since the certbot gandi dns plugin has been giving issues over the past months (no smooth renewal, leading to unavailability of sites) we started moving things to acme.sh. Seems to work better, easier to setup etc.&lt;br /&gt;
&lt;br /&gt;
=== Install the bash script ===&lt;br /&gt;
&lt;br /&gt;
 wget https://get.acme.sh &lt;br /&gt;
&lt;br /&gt;
As root:&lt;br /&gt;
&lt;br /&gt;
 sh acme.sh&lt;br /&gt;
&lt;br /&gt;
This will install the script to /root/ and add it to path &lt;br /&gt;
&lt;br /&gt;
=== Request a wildcard cert for lurk.org ===&lt;br /&gt;
&lt;br /&gt;
first find and export the gandi dns key:&lt;br /&gt;
&lt;br /&gt;
 export GANDI_LIVEDNS_KEY=&amp;quot;fdmlfsdklmfdkmqsdfk&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Then request a wildcard cert. (the dns key is added to a config file automatically for future renewals)&lt;br /&gt;
&lt;br /&gt;
 acme.sh --issue --dns dns_gandi_livedns --nginx -d *.lurk.org&lt;br /&gt;
&lt;br /&gt;
Find the certs in:&lt;br /&gt;
&lt;br /&gt;
 /root/.acme.sh/\*.lurk.org/&lt;br /&gt;
&lt;br /&gt;
== Migration status ==&lt;br /&gt;
&lt;br /&gt;
Done: &lt;br /&gt;
&lt;br /&gt;
* VMB (nginx, masto, icecast)&lt;br /&gt;
&lt;br /&gt;
To do:&lt;br /&gt;
&lt;br /&gt;
* agnes (nginx, prosody, mm3)&lt;br /&gt;
* douglas (???)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= N.B. everything below is for archival reference =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Base installation ==&lt;br /&gt;
&lt;br /&gt;
 apt install python-pip&lt;br /&gt;
 pip install wheel&lt;br /&gt;
 pip install certbot&lt;br /&gt;
&lt;br /&gt;
== DNS plugins ==&lt;br /&gt;
=== Gandi ===&lt;br /&gt;
&#039;&#039;&#039;NOTE: At time of writing, only an API key from the domain owner will work. So another account, even if listed technical contact, will not able to use the live DNS API, just the live DNS web interface. Since the writing of this HOWTO, there is now this as well https://github.com/obynio/certbot-plugin-gandi TODO&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Get API key from Gandi (somewhere in account settings)&lt;br /&gt;
* install certbot-plugin-gandi&lt;br /&gt;
 pip install &#039;git+https://gitlab.com/cspublic/certbot-plugin-gandi.git&#039;&lt;br /&gt;
 mkdir /etc/certbot-plugin-gandi&lt;br /&gt;
* create /etc/certbot-plugin-gandi/gandi.ini with the following:&lt;br /&gt;
 certbot_plugin_gandi:dns_api_key=APIKEY&lt;br /&gt;
* a bit of paranoia&lt;br /&gt;
 chmod 600 /etc/certbot-plugin-gandi/gandi.ini&lt;br /&gt;
* request certificate for both mydomain.blabla &#039;&#039;&#039;and&#039;&#039;&#039; *.mydomain.blabla&lt;br /&gt;
&#039;&#039;&#039;NOTE: At time of writing, the default sever end point used by cerbot (0.22) is not compatible with ACME v2, as a workaround --server must be passed manually. Next version of certbot should point to the right server&#039;&#039;&#039;&lt;br /&gt;
 /usr/local/bin/certbot certonly -a certbot-plugin-gandi:dns --certbot-plugin-gandi:dns-credentials /etc/certbot-plugin-gandi/gandi.ini -d mydomain.blabla -d *.mydomain.blabla --server https://acme-v02.api.letsencrypt.org/directory&lt;br /&gt;
* If all goes well certs will be there:&lt;br /&gt;
&#039;&#039;&#039;NOTE: At time of writing, certbot-plugin-gandi seems to behave a bit funnily when asked to request a challenge for a wildcard cert (it works flawslessly for regular domains). It might be needed to run the command several times to get the infamous CONGRATULATION message from certbot.&#039;&#039;&#039;&lt;br /&gt;
 /etc/letsencrypt/live/mydomain.blabla/fullchain.pem&lt;br /&gt;
 /etc/letsencrypt/live/mydomain.blabla/privkey.pem&lt;br /&gt;
&lt;br /&gt;
== Renewal ==&lt;br /&gt;
To non-interactively renew *all* of your certificates:&lt;br /&gt;
 /usr/local/bin/certbot renew&lt;br /&gt;
&lt;br /&gt;
=== douglas ===&lt;br /&gt;
=== agnes ===&lt;br /&gt;
&#039;&#039;&#039;TODO: hooks!&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service nginx restart&lt;br /&gt;
prosodyctl reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Certificates]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=372</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=372"/>
		<updated>2019-11-13T11:17:18Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with] [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Its suuuuuper slow so probably not the best way to do it. Calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB worth of headers and avatars to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== linkdump of bespoke maintenance scripts ===&lt;br /&gt;
&lt;br /&gt;
https://mastodon.zombocloud.com/@staticsafe/103121989384729357&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=371</id>
		<title>Tinc Settings for LURK</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=371"/>
		<updated>2019-10-08T09:00:47Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LURK specific settings ==&lt;br /&gt;
&lt;br /&gt;
Tinc is currently installed to connect nodes in the lurk network&lt;br /&gt;
&lt;br /&gt;
 douglas = 10.0.1.1&lt;br /&gt;
 agnesbaxter = 10.0.1.3&lt;br /&gt;
 skattkista = 10.0.1.2&lt;br /&gt;
 vrijdagmiddagborrel = 10.0.1.4&lt;br /&gt;
&lt;br /&gt;
both skattkista and agnesbaxter connect to douglas&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=363</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=363"/>
		<updated>2019-09-09T12:05:05Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* deleting remote inactive account and their associated avatars and headers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with] [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Its suuuuuper slow so probably not the best way to do it. Calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB worth of headers and avatars to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=360</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=360"/>
		<updated>2019-09-05T12:10:29Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
=== deleting remote inactive account and their associated avatars and headers ===&lt;br /&gt;
&lt;br /&gt;
Deleting media attachments is not enough! Since Mastodon builds a local copy of every account it knows in the fediverse you will see the folders &amp;lt;code&amp;gt;/home/mastodon/live/public/system&amp;lt;/code&amp;gt; balloon over time. Many instance admins [https://discourse.joinmastodon.org/t/clean-instance-unused-accounts-older-media/1182/6 are] [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/4 dealing] [https://github.com/tootsuite/mastodon/issues/9567 with [https://mathstodon.xyz/@christianp/102655520448724916 this issue] and the prevailing attitude to solving it is to get more storage, which is bs.&lt;br /&gt;
&lt;br /&gt;
So here is an interim solution based on [https://discourse.joinmastodon.org/t/ballooning-avatars-and-headers-folders/2049/5 this]:&lt;br /&gt;
&lt;br /&gt;
First query the &amp;lt;code&amp;gt;mastodon_production&amp;lt;/code&amp;gt; database to find out which accounts haven&#039;t been active for 6 months or more:&lt;br /&gt;
&lt;br /&gt;
 sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;6 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you have that list use a scripting language to parse it. The below example is in python. Probably very flawed since its suuuuuper slow, calling rails like this is not so smart I guess. But hey it works. It went from 11.5GB of headers and avatrs to 7.5GB. &lt;br /&gt;
&lt;br /&gt;
 mastodon@server:~$ cat del_stale_users.py &lt;br /&gt;
&lt;br /&gt;
 mastodon@douglas:~$ cat del_stale_users.py &lt;br /&gt;
 #get the output from: &lt;br /&gt;
 #sudo -i -u postgres /bin/bash -l -c &amp;quot;psql -A -d mastodon_production -c \&amp;quot;SELECT username||&#039;@&#039;||domain FROM public.accounts WHERE last_webfingered_at &amp;lt; (CURRENT_TIMESTAMP - interval &#039;12 months&#039;) AND id NOT IN (SELECT target_account_id FROM public.follows)\&amp;quot;&amp;quot; | tail -n +2 | head -n -1 &amp;gt; stale.txt&lt;br /&gt;
 #and delete them&lt;br /&gt;
 &lt;br /&gt;
 import os&lt;br /&gt;
 &lt;br /&gt;
 stale_users=open(&#039;stale.txt&#039;).read().split(&#039;\n&#039;)&lt;br /&gt;
 &lt;br /&gt;
 os.chdir(&#039;/home/mastodon/live&#039;)&lt;br /&gt;
 &lt;br /&gt;
 command = &amp;quot;&amp;quot;&amp;quot;RAILS_ENV=production bundle exec rails r &#039;&lt;br /&gt;
 begin&lt;br /&gt;
     a = Account.find_by(username: &amp;quot;{}&amp;quot;, domain: &amp;quot;{}&amp;quot;)&lt;br /&gt;
     a.destroy&lt;br /&gt;
 rescue =&amp;gt; err&lt;br /&gt;
 end&#039;&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 for user in stale_users:&lt;br /&gt;
     if user:&lt;br /&gt;
         username, domain = user.split(&#039;@&#039;)&lt;br /&gt;
         os.system(command.format(username,domain))&lt;br /&gt;
         print(&#039;deleted&#039;, user)&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=332</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=332"/>
		<updated>2019-07-31T19:45:19Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Increasing character limit on posts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Next, we probably want to let the world know, too. Currently there’s no official way to include your character length in the API, but unofficially, you’ll need to set the &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt; attribute in your instance’s API response.&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;app/serializers/rest/instance_serializer.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change line 8 from &amp;lt;code&amp;gt;:languages, :registrations, :approval_required&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;:languages, :registrations, :approval_required, :max_toot_chars&amp;lt;/code&amp;gt; (don’t forget the comma).&lt;br /&gt;
&lt;br /&gt;
Change line 65, after the &amp;lt;code&amp;gt;approval_required&amp;lt;/code&amp;gt; block, and add a definition for &amp;lt;code&amp;gt;max_toot_chars&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def max_toot_chars&lt;br /&gt;
      1500&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
from https://indented.space/2019/07/28/change-max-character-limit-for-mastodon-instance/&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=331</id>
		<title>Off-site Backup with Backupninja</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Off-site_Backup_with_Backupninja&amp;diff=331"/>
		<updated>2019-07-25T07:26:49Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Goal:&#039;&#039;&#039; Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This document assumes you already have:&lt;br /&gt;
* A configure Linux/BSD machine to work as off-site backup&lt;br /&gt;
* A &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; user created on the off-site backup that will be used specifically by the backup scripts&lt;br /&gt;
* Debian based servers (not sure Backupninja will run otherwise without some slight modifications)&lt;br /&gt;
* All the machines (servers and the backup machine) on a working [[VPN_with_Tinc | Tinc VPN]]&lt;br /&gt;
* Enough space on the off-site backup machine :)&lt;br /&gt;
&lt;br /&gt;
== On the Off-site machine ==&lt;br /&gt;
* As &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt; create directories for each server&lt;br /&gt;
 mkdir /data/lurk/douglas /data/lurk/agnesbaxter&lt;br /&gt;
&lt;br /&gt;
== On each server ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Clone Backupninja from https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/ &amp;amp;&amp;amp; git clone https://0xacab.org/riseuplabs/backupninja&lt;br /&gt;
 cd /usr/src/backupninja&lt;br /&gt;
&lt;br /&gt;
 ./autogen.sh&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
note that by running the above all configurations will be in &amp;lt;code&amp;gt;/usr/local/etc/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
==== /etc/backupninja.conf ====&lt;br /&gt;
Some changes:&lt;br /&gt;
 reportemail = some@where.nice&lt;br /&gt;
 when = everyday at 05:55&lt;br /&gt;
&lt;br /&gt;
==== MySQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* mysql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/mysql # adjust if this location does not have much free space&lt;br /&gt;
* all the databases to backup.&lt;br /&gt;
* select the debian maintenance user for access&lt;br /&gt;
* compress the sql output file&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== PostgreSQL local backups ====&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run the command:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action&lt;br /&gt;
* postgresql database backup&lt;br /&gt;
* path:&lt;br /&gt;
 /var/backups/postgres # adjust if this location does not have much free space&lt;br /&gt;
* backup the whole cluster&lt;br /&gt;
* compress the backups&lt;br /&gt;
* custom&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* leave ninjahelper&lt;br /&gt;
&lt;br /&gt;
==== Borg Backup ====&lt;br /&gt;
This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!&lt;br /&gt;
&lt;br /&gt;
* make sure you have &amp;lt;code&amp;gt;borgbackup&amp;lt;/code&amp;gt; installed:&lt;br /&gt;
 apt install borgbackup&lt;br /&gt;
&lt;br /&gt;
* As &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; run:&lt;br /&gt;
 ninjahelper&lt;br /&gt;
* create a new backup action, choose borg&lt;br /&gt;
* choose file to include &amp;amp; exclude, add paths, wildcard accepted&lt;br /&gt;
* configure backup destination:&lt;br /&gt;
** dest_directory &amp;lt;code&amp;gt;/data/lurk/name-of-server-to-backup&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_host &amp;lt;code&amp;gt;10.0.1.2&amp;lt;/code&amp;gt; Adjust to the Tinc IP of the off-site backup machine.&lt;br /&gt;
** dest_user &amp;lt;code&amp;gt;lurk&amp;lt;/code&amp;gt;&lt;br /&gt;
** dest_type &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt;&lt;br /&gt;
* set up ssh keys and test remote connection&lt;br /&gt;
* enable encryption, choose a nice long passphrase&lt;br /&gt;
* enable pruning, keep &amp;lt;code&amp;gt;120D&amp;lt;/code&amp;gt; (you can adjust if you will run out of space! Keep in mind this is incremental though, so don&#039;t panic)&lt;br /&gt;
* &#039;&#039;&#039;select the action and test/run/review the config&#039;&#039;&#039;&lt;br /&gt;
* check that everything is showing up nicely on the backup server in the destination directory!&lt;br /&gt;
&lt;br /&gt;
== Fine tuning ==&lt;br /&gt;
=== Edit/Change the local filesystem path to include/exclude ===&lt;br /&gt;
By default Babckupninja will backup some folder and exclude some others. This can be changed during the initial configuration of the borg action but can also be done later.&lt;br /&gt;
&lt;br /&gt;
* As root, edit &amp;lt;code&amp;gt;/etc/backup.d/90.borg&amp;lt;/code&amp;gt;&lt;br /&gt;
* Make changes in the section &amp;lt;code&amp;gt;# files to include in the backup&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Optional:&#039;&#039;&#039; run &amp;lt;code&amp;gt;ninjahelper&amp;lt;/code&amp;gt;, select the &amp;lt;code&amp;gt;90.borg&amp;lt;/code&amp;gt; action and &amp;lt;code&amp;gt;run&amp;lt;/code&amp;gt; it to make sure it&#039;s being sent to the off-site machine. If you&#039;re sure of your changes, you can also wait the next backup to happen to see if it worked.&lt;br /&gt;
&lt;br /&gt;
[[Category:System]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=330</id>
		<title>Tinc Settings for LURK</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=330"/>
		<updated>2019-07-09T14:50:54Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LURK specific settings ==&lt;br /&gt;
&lt;br /&gt;
Tinc is currently installed to connect nodes in the lurk network&lt;br /&gt;
&lt;br /&gt;
 douglas = 10.0.1.1&lt;br /&gt;
 agnesbaxter = 10.0.1.3&lt;br /&gt;
 skattkista = 10.0.1.2&lt;br /&gt;
&lt;br /&gt;
both skattkista and agnesbaxter connect to douglas&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=329</id>
		<title>VPN with Tinc</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=329"/>
		<updated>2019-07-09T11:49:12Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* GNU/Linux (Debian based) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FIXME: What&#039;s a VPN, what&#039;s Tinc&lt;br /&gt;
&lt;br /&gt;
== Installation on Server(s) and Client(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Install tinc 1.1 pre from ports&lt;br /&gt;
 sudo pkg install tinc-devel               # binary&lt;br /&gt;
 sudo portmaster -iB security/tinc-devel   # source&lt;br /&gt;
&lt;br /&gt;
=== GNU/Linux (Debian based) ===&lt;br /&gt;
* Install tinc 1.1 pre from source&lt;br /&gt;
 sudo apt install -y build-essential libncurses5-dev libreadline6-dev libzlcore-dev zlib1g-dev liblzo2-dev libssl-dev&lt;br /&gt;
&lt;br /&gt;
Compile Tinc 1.1pre :&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/&lt;br /&gt;
&lt;br /&gt;
 wget https://www.tinc-vpn.org/packages/tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 tar xvf tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 cd tinc-1.1pre17&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Once installed the configuration dir should be in:&lt;br /&gt;
 /usr/local/etc/tinc/&lt;br /&gt;
&lt;br /&gt;
And tinc is installed in &lt;br /&gt;
 /usr/local/sbin/tinc&lt;br /&gt;
&lt;br /&gt;
Make a directory for pidfile and socket&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir -p /usr/local/var/run/&lt;br /&gt;
&lt;br /&gt;
==== Set up systemd serivces ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc VPN&lt;br /&gt;
 After=network.target&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=oneshot&lt;br /&gt;
 RemainAfterExit=yes&lt;br /&gt;
 ExecStart=/bin/true&lt;br /&gt;
 ExecReload=/bin/true&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc@.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc net %i&lt;br /&gt;
 PartOf=tinc.service&lt;br /&gt;
 ReloadPropagatedFrom=tinc.service&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=simple&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc/%i&lt;br /&gt;
 ExecStart=/usr/local/sbin/tincd -n %i -D&lt;br /&gt;
 ExecReload=/usr/local/sbin/tincd -n %i -kHUP&lt;br /&gt;
 KillMode=mixed&lt;br /&gt;
 TimeoutStopSec=5&lt;br /&gt;
 Restart=always&lt;br /&gt;
 RestartSec=60&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable them on boot:&lt;br /&gt;
&lt;br /&gt;
 systemctl enable tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start / stop at will:&lt;br /&gt;
&lt;br /&gt;
 sudo systemctl start tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
 sudo systemctl stop tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Configure Server ====&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet init servername&lt;br /&gt;
&lt;br /&gt;
 sudo tincd -n lurknet&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add subnet 10.0.1.1&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add address=public.IP.address&lt;br /&gt;
&lt;br /&gt;
==== Set up interface scripts ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim  /usr/local/etc/tinc/lurknet/tinc-up&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip addr add 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ip link set $INTERFACE up&lt;br /&gt;
&lt;br /&gt;
 sudo vim /usr/local/etc/tinc/VPNNAME/tinc-down &lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip route del 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ifconfig $INTERFACE down&lt;br /&gt;
&lt;br /&gt;
Make them executable&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/etc/tinc/lurknet/ &amp;amp;&amp;amp; chmod +x tinc-*&lt;br /&gt;
&lt;br /&gt;
==== Configure client ====&lt;br /&gt;
&lt;br /&gt;
For the client (given gnu/linux) compile the software as instructed above. Also make the systemD scripts and set up the interface scripts (using a different IP-address).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On the server&#039;&#039;&#039; then generate an invitation url:&lt;br /&gt;
&lt;br /&gt;
 tinc -n lurknet invite $CLIENTHOSTNAME&lt;br /&gt;
&lt;br /&gt;
This will give you an invite URL so you can join the network &#039;&#039;&#039;on the client&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 tinc join $INVITEURL&lt;br /&gt;
&lt;br /&gt;
 tinc -n lurknet add subnet 10.0.1.3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Further reading ====&lt;br /&gt;
&lt;br /&gt;
The above is an amalgam from and may provide further details:&lt;br /&gt;
&lt;br /&gt;
https://zingmars.info/2018/07/14/Tinc-1.1-setup-instructions/&lt;br /&gt;
&lt;br /&gt;
https://www.tinc-vpn.org/documentation-1.1/&lt;br /&gt;
&lt;br /&gt;
http://pzwiki.wdka.nl/mediadesign/Tinc&lt;br /&gt;
&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
&#039;&#039;&#039;FIXME&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* Install tinc 1.1 pre win binaries from upstream at https://tinc-vpn.org/download/&lt;br /&gt;
&lt;br /&gt;
== Setup Server(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Initialize new VPN&lt;br /&gt;
 sudo tinc -n beernet init server&lt;br /&gt;
* Configure the host&#039;s own interface&lt;br /&gt;
 sudo tinc -n beernet add subnet 10.10.10.1&lt;br /&gt;
* Configure the host&#039;s public IP, or domain if you have one for the host&lt;br /&gt;
 sudo tinc -n beernet add address=super.domain.xxx  # if you have a domain ...&lt;br /&gt;
 sudo tinc -n beernet add address=1.1.1.1           # or if you just have a public IP&lt;br /&gt;
* edit &amp;lt;code&amp;gt;/usr/local/etc/tinc/beernet/tinc-up&amp;lt;/code&amp;gt;, so that your network interface is brought up correctly, for instance with:&lt;br /&gt;
 ifconfig $INTERFACE 10.10.10.1 netmask 255.255.255.0  # leave $INTERFACE as it is&lt;br /&gt;
* test if your VPN works nicely for the time being by running it directly in a shell with extra verbose options:&lt;br /&gt;
 tincd -n beernet -D -d3&lt;br /&gt;
&lt;br /&gt;
== Setup Client ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=328</id>
		<title>VPN with Tinc</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=328"/>
		<updated>2019-07-09T11:47:41Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* GNU/Linux (Debian based) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FIXME: What&#039;s a VPN, what&#039;s Tinc&lt;br /&gt;
&lt;br /&gt;
== Installation on Server(s) and Client(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Install tinc 1.1 pre from ports&lt;br /&gt;
 sudo pkg install tinc-devel               # binary&lt;br /&gt;
 sudo portmaster -iB security/tinc-devel   # source&lt;br /&gt;
&lt;br /&gt;
=== GNU/Linux (Debian based) ===&lt;br /&gt;
* Install tinc 1.1 pre from source&lt;br /&gt;
 sudo apt install -y build-essential libncurses5-dev libreadline6-dev libzlcore-dev zlib1g-dev liblzo2-dev libssl-dev&lt;br /&gt;
&lt;br /&gt;
Compile Tinc 1.1pre :&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/&lt;br /&gt;
&lt;br /&gt;
 wget https://www.tinc-vpn.org/packages/tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 tar xvf tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 cd tinc-1.1pre17&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Once installed the configuration dir should be in:&lt;br /&gt;
 /usr/local/etc/tinc/&lt;br /&gt;
&lt;br /&gt;
And tinc is installed in &lt;br /&gt;
 /usr/local/sbin/tinc&lt;br /&gt;
&lt;br /&gt;
Make a directory for pidfile and socket&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir -p /usr/local/var/run/&lt;br /&gt;
&lt;br /&gt;
==== Set up systemd serivces ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc VPN&lt;br /&gt;
 After=network.target&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=oneshot&lt;br /&gt;
 RemainAfterExit=yes&lt;br /&gt;
 ExecStart=/bin/true&lt;br /&gt;
 ExecReload=/bin/true&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc@.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc net %i&lt;br /&gt;
 PartOf=tinc.service&lt;br /&gt;
 ReloadPropagatedFrom=tinc.service&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=simple&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc/%i&lt;br /&gt;
 ExecStart=/usr/local/sbin/tincd -n %i -D&lt;br /&gt;
 ExecReload=/usr/local/sbin/tincd -n %i -kHUP&lt;br /&gt;
 KillMode=mixed&lt;br /&gt;
 TimeoutStopSec=5&lt;br /&gt;
 Restart=always&lt;br /&gt;
 RestartSec=60&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable them on boot:&lt;br /&gt;
&lt;br /&gt;
 systemctl enable tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start / stop at will:&lt;br /&gt;
&lt;br /&gt;
 sudo systemctl start tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
 sudo systemctl stop tinc@lurknet&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Configure Server ====&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet init servername&lt;br /&gt;
&lt;br /&gt;
 sudo tincd -n lurknet&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add subnet 10.0.1.1&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add address=public.IP.address&lt;br /&gt;
&lt;br /&gt;
==== Set up interface scripts ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim  /usr/local/etc/tinc/lurknet/tinc-up&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip addr add 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ip link set $INTERFACE up&lt;br /&gt;
&lt;br /&gt;
 sudo vim /usr/local/etc/tinc/VPNNAME/tinc-down &lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip route del 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ifconfig $INTERFACE down&lt;br /&gt;
&lt;br /&gt;
Make them executable&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/etc/tinc/lurknet/ &amp;amp;&amp;amp; chmod +x tinc-*&lt;br /&gt;
&lt;br /&gt;
==== Configure client ====&lt;br /&gt;
&lt;br /&gt;
For the client (given gnu/linux) compile the software as instructed above. Also make the systemD scripts and set up the interface scripts (using a different IP-address).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On the server&#039;&#039;&#039; then generate an invitation url:&lt;br /&gt;
&lt;br /&gt;
 tinc -n lurknet invite $CLIENTHOSTNAME&lt;br /&gt;
&lt;br /&gt;
This will give you an invite URL so you can join the network &#039;&#039;&#039;on the client&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 tinc join $INVITEURL&lt;br /&gt;
&lt;br /&gt;
 tinc -n lurknet add subnet 10.0.1.3&lt;br /&gt;
&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
&#039;&#039;&#039;FIXME&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* Install tinc 1.1 pre win binaries from upstream at https://tinc-vpn.org/download/&lt;br /&gt;
&lt;br /&gt;
== Setup Server(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Initialize new VPN&lt;br /&gt;
 sudo tinc -n beernet init server&lt;br /&gt;
* Configure the host&#039;s own interface&lt;br /&gt;
 sudo tinc -n beernet add subnet 10.10.10.1&lt;br /&gt;
* Configure the host&#039;s public IP, or domain if you have one for the host&lt;br /&gt;
 sudo tinc -n beernet add address=super.domain.xxx  # if you have a domain ...&lt;br /&gt;
 sudo tinc -n beernet add address=1.1.1.1           # or if you just have a public IP&lt;br /&gt;
* edit &amp;lt;code&amp;gt;/usr/local/etc/tinc/beernet/tinc-up&amp;lt;/code&amp;gt;, so that your network interface is brought up correctly, for instance with:&lt;br /&gt;
 ifconfig $INTERFACE 10.10.10.1 netmask 255.255.255.0  # leave $INTERFACE as it is&lt;br /&gt;
* test if your VPN works nicely for the time being by running it directly in a shell with extra verbose options:&lt;br /&gt;
 tincd -n beernet -D -d3&lt;br /&gt;
&lt;br /&gt;
== Setup Client ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=327</id>
		<title>VPN with Tinc</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=327"/>
		<updated>2019-07-09T11:30:05Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* GNU/Linux (Debian based) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FIXME: What&#039;s a VPN, what&#039;s Tinc&lt;br /&gt;
&lt;br /&gt;
== Installation on Server(s) and Client(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Install tinc 1.1 pre from ports&lt;br /&gt;
 sudo pkg install tinc-devel               # binary&lt;br /&gt;
 sudo portmaster -iB security/tinc-devel   # source&lt;br /&gt;
&lt;br /&gt;
=== GNU/Linux (Debian based) ===&lt;br /&gt;
* Install tinc 1.1 pre from source&lt;br /&gt;
 sudo apt install -y build-essential libncurses5-dev libreadline6-dev libzlcore-dev zlib1g-dev liblzo2-dev libssl-dev&lt;br /&gt;
&lt;br /&gt;
Compile Tinc 1.1pre :&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/&lt;br /&gt;
&lt;br /&gt;
 wget https://www.tinc-vpn.org/packages/tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 tar xvf tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 cd tinc-1.1pre17&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Once installed the configuration dir should be in:&lt;br /&gt;
 /usr/local/etc/tinc/&lt;br /&gt;
&lt;br /&gt;
And tinc is installed in &lt;br /&gt;
 /usr/local/sbin/tinc&lt;br /&gt;
&lt;br /&gt;
Make a directory for pidfile and socket&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir -p /usr/local/var/run/&lt;br /&gt;
&lt;br /&gt;
==== Set up systemd serivces ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc VPN&lt;br /&gt;
 After=network.target&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=oneshot&lt;br /&gt;
 RemainAfterExit=yes&lt;br /&gt;
 ExecStart=/bin/true&lt;br /&gt;
 ExecReload=/bin/true&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 sudo vim /lib/systemd/system/tinc@.service&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Tinc net %i&lt;br /&gt;
 PartOf=tinc.service&lt;br /&gt;
 ReloadPropagatedFrom=tinc.service&lt;br /&gt;
 &lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=simple&lt;br /&gt;
 WorkingDirectory=/usr/local/etc/tinc/%i&lt;br /&gt;
 ExecStart=/usr/local/sbin/tincd -n %i -D&lt;br /&gt;
 ExecReload=/usr/local/sbin/tincd -n %i -kHUP&lt;br /&gt;
 KillMode=mixed&lt;br /&gt;
 TimeoutStopSec=5&lt;br /&gt;
 Restart=always&lt;br /&gt;
 RestartSec=60&lt;br /&gt;
 &lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Configure Server ====&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet init servername&lt;br /&gt;
&lt;br /&gt;
 sudo tincd -n lurknet&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add subnet 10.0.1.1&lt;br /&gt;
&lt;br /&gt;
 sudo tinc -n lurknet add address=public.IP.address&lt;br /&gt;
&lt;br /&gt;
==== Set up interface scripts ====&lt;br /&gt;
&lt;br /&gt;
 sudo vim  /usr/local/etc/tinc/lurknet/tinc-up&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip addr add 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ip link set $INTERFACE up&lt;br /&gt;
&lt;br /&gt;
 sudo vim /usr/local/etc/tinc/VPNNAME/tinc-down &lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ip route del 10.0.1.1/24 dev $INTERFACE&lt;br /&gt;
 ifconfig $INTERFACE down&lt;br /&gt;
&lt;br /&gt;
Make them executable&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/etc/tinc/lurknet/ &amp;amp;&amp;amp; chmod +x tinc-*&lt;br /&gt;
&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
&#039;&#039;&#039;FIXME&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* Install tinc 1.1 pre win binaries from upstream at https://tinc-vpn.org/download/&lt;br /&gt;
&lt;br /&gt;
== Setup Server(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Initialize new VPN&lt;br /&gt;
 sudo tinc -n beernet init server&lt;br /&gt;
* Configure the host&#039;s own interface&lt;br /&gt;
 sudo tinc -n beernet add subnet 10.10.10.1&lt;br /&gt;
* Configure the host&#039;s public IP, or domain if you have one for the host&lt;br /&gt;
 sudo tinc -n beernet add address=super.domain.xxx  # if you have a domain ...&lt;br /&gt;
 sudo tinc -n beernet add address=1.1.1.1           # or if you just have a public IP&lt;br /&gt;
* edit &amp;lt;code&amp;gt;/usr/local/etc/tinc/beernet/tinc-up&amp;lt;/code&amp;gt;, so that your network interface is brought up correctly, for instance with:&lt;br /&gt;
 ifconfig $INTERFACE 10.10.10.1 netmask 255.255.255.0  # leave $INTERFACE as it is&lt;br /&gt;
* test if your VPN works nicely for the time being by running it directly in a shell with extra verbose options:&lt;br /&gt;
 tincd -n beernet -D -d3&lt;br /&gt;
&lt;br /&gt;
== Setup Client ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=326</id>
		<title>VPN with Tinc</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=VPN_with_Tinc&amp;diff=326"/>
		<updated>2019-07-08T18:19:08Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* GNU/Linux (Debian based) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FIXME: What&#039;s a VPN, what&#039;s Tinc&lt;br /&gt;
&lt;br /&gt;
== Installation on Server(s) and Client(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Install tinc 1.1 pre from ports&lt;br /&gt;
 sudo pkg install tinc-devel               # binary&lt;br /&gt;
 sudo portmaster -iB security/tinc-devel   # source&lt;br /&gt;
&lt;br /&gt;
=== GNU/Linux (Debian based) ===&lt;br /&gt;
* Install tinc 1.1 pre from source&lt;br /&gt;
 sudo apt install -y build-essential libncurses5-dev libreadline6-dev libzlcore-dev zlib1g-dev liblzo2-dev libssl-dev&lt;br /&gt;
&lt;br /&gt;
Compile Tinc 1.1pre :&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/&lt;br /&gt;
&lt;br /&gt;
 wget https://www.tinc-vpn.org/packages/tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 tar xvf tinc-1.1pre17.tar.gz&lt;br /&gt;
&lt;br /&gt;
 cd tinc-1.1pre17&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Once installed the configuration dir should be in:&lt;br /&gt;
 /usr/local/etc/tinc/&lt;br /&gt;
&lt;br /&gt;
And tinc is installed in &lt;br /&gt;
 /usr/local/sbin/tinc&lt;br /&gt;
&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
&#039;&#039;&#039;FIXME&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* Install tinc 1.1 pre win binaries from upstream at https://tinc-vpn.org/download/&lt;br /&gt;
&lt;br /&gt;
== Setup Server(s) ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
* Initialize new VPN&lt;br /&gt;
 sudo tinc -n beernet init server&lt;br /&gt;
* Configure the host&#039;s own interface&lt;br /&gt;
 sudo tinc -n beernet add subnet 10.10.10.1&lt;br /&gt;
* Configure the host&#039;s public IP, or domain if you have one for the host&lt;br /&gt;
 sudo tinc -n beernet add address=super.domain.xxx  # if you have a domain ...&lt;br /&gt;
 sudo tinc -n beernet add address=1.1.1.1           # or if you just have a public IP&lt;br /&gt;
* edit &amp;lt;code&amp;gt;/usr/local/etc/tinc/beernet/tinc-up&amp;lt;/code&amp;gt;, so that your network interface is brought up correctly, for instance with:&lt;br /&gt;
 ifconfig $INTERFACE 10.10.10.1 netmask 255.255.255.0  # leave $INTERFACE as it is&lt;br /&gt;
* test if your VPN works nicely for the time being by running it directly in a shell with extra verbose options:&lt;br /&gt;
 tincd -n beernet -D -d3&lt;br /&gt;
&lt;br /&gt;
== Setup Client ==&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
=== MacOs ===&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: VPN]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=320</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=320"/>
		<updated>2019-05-13T02:49:32Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Backups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
  &lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=319</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=319"/>
		<updated>2019-05-13T02:49:19Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Backups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/cp /home/mastodon/live/.env.production /var/backups/mastodon/${today}/&lt;br /&gt;
&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=318</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=318"/>
		<updated>2019-05-12T16:39:06Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* script for pruning remote / old media */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
 &lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=317</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=317"/>
		<updated>2019-05-12T16:38:20Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
=== script for pruning remote / old media ===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 export PATH=&amp;quot;$HOME/.rbenv/bin:$PATH&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(rbenv init -)&amp;quot;&lt;br /&gt;
 export RAILS_ENV=production&lt;br /&gt;
&lt;br /&gt;
 /home/mastodon/live/bin/tootctl statuses remove&lt;br /&gt;
 /home/mastodon/live/bin/tootctl media remove --days=3&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=227</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=227"/>
		<updated>2019-01-21T09:58:33Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache clean&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=226</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=226"/>
		<updated>2019-01-21T09:27:25Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
=== reduce disk space usage by cleaning out old versions of ruby, yarn etc after upgrades ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
rm the cache of yarn (nodejs package manager):&lt;br /&gt;
&lt;br /&gt;
 yarn cache delete&lt;br /&gt;
&lt;br /&gt;
rm old versions of ruby you no longer need:&lt;br /&gt;
&lt;br /&gt;
 rbenv uninstall 2.5.3 &lt;br /&gt;
&lt;br /&gt;
source:&lt;br /&gt;
https://toot.cafe/@nolan/101450836285521185&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=205</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=205"/>
		<updated>2018-12-14T06:14:27Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
=== Removing federated media attachments ===&lt;br /&gt;
&lt;br /&gt;
 RAILS_ENV=production ./bin/tootctl media remove&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=170</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=170"/>
		<updated>2018-11-12T05:37:03Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Increasing character limit on posts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
Make sure you recompile the web assets afterwards:&lt;br /&gt;
 RAILS_ENV=production bundle exec rails assets:precompile&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=169</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=169"/>
		<updated>2018-10-08T20:49:08Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shell script:&lt;br /&gt;
 &lt;br /&gt;
  today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
  expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
  &lt;br /&gt;
  /bin/mkdir  /var/backups/mastodon/${today}/&lt;br /&gt;
  /usr/bin/pg_dump mastodon_production &amp;gt; /var/backups/mastodon/${today}/mastodon_production_${today}.sql&lt;br /&gt;
  /bin/tar -cvzf /var/backups/mastodon/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
  /bin/rm -rf /var/backups/mastodon/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Two weeks worth of backups are stored remotely using a shell script:&lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-14 days&amp;quot;`)&lt;br /&gt;
 expiry_path=(/media/lurk_backup/mastodon/${expiry})&lt;br /&gt;
 &lt;br /&gt;
 rsync -auv /var/backups/mastodon/${today} x@x.x.x.x:/media/lurk_backup/mastodon/&lt;br /&gt;
 ssh x@x.x.x.x rm -rf $expiry_path&lt;br /&gt;
&lt;br /&gt;
This is called in cron like so:&lt;br /&gt;
30 03 * * * /bin/bash /home/mastodon/backup_backup.sh &amp;gt; /home/mastodon/backups/backup_copy.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=150</id>
		<title>Tinc Settings for LURK</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Tinc_Settings_for_LURK&amp;diff=150"/>
		<updated>2018-07-25T15:04:10Z</updated>

		<summary type="html">&lt;p&gt;Rra: Created page with &amp;quot;Tinc is currently installed to connect nodes in the lurk network   douglas = 10.0.1.1  agnesbaxter = 10.0.1.3  rra_backup = 10.0.1.2  both rra_backup and agnesbaxter connect t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tinc is currently installed to connect nodes in the lurk network&lt;br /&gt;
&lt;br /&gt;
 douglas = 10.0.1.1&lt;br /&gt;
 agnesbaxter = 10.0.1.3&lt;br /&gt;
 rra_backup = 10.0.1.2&lt;br /&gt;
&lt;br /&gt;
both rra_backup and agnesbaxter connect to douglas&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=96</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=96"/>
		<updated>2018-06-18T11:15:27Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Backups */  backups only kept three days..&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shellscript:&lt;br /&gt;
 &lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 expiry=(`date +&#039;%F&#039; -d &amp;quot;-3 days&amp;quot;`)&lt;br /&gt;
&lt;br /&gt;
 /bin/mkdir  /home/mastodon/backups/${today}/&lt;br /&gt;
 /usr/bin/pg_dump mastodon_production &amp;gt; /home/mastodon/backups/${today}/mastodon_production_${today}.sql&lt;br /&gt;
 /bin/tar -cvzf /home/mastodon/backups/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
 /bin/rm -rf /home/mastodon/backups/${expiry}/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=95</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=95"/>
		<updated>2018-06-13T12:00:58Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Backups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shellscript:&lt;br /&gt;
 &lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 /bin/mkdir  /home/mastodon/backups/${today}/&lt;br /&gt;
 /usr/bin/pg_dump mastodon_production &amp;gt; /home/mastodon/backups/${today}/mastodon_production_${today}.sql&lt;br /&gt;
 /bin/tar -cvzf /home/mastodon/backups/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
 30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=94</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=94"/>
		<updated>2018-06-13T12:00:46Z</updated>

		<summary type="html">&lt;p&gt;Rra: /* Backups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following shellscript:&lt;br /&gt;
 &lt;br /&gt;
 today=(`date +&amp;quot;%F&amp;quot;`)&lt;br /&gt;
 /bin/mkdir  /home/mastodon/backups/${today}/&lt;br /&gt;
 /usr/bin/pg_dump mastodon_production &amp;gt; /home/mastodon/backups/${today}/mastodon_production_${today}.sql&lt;br /&gt;
 /bin/tar -cvzf /home/mastodon/backups/${today}/system${today}.tar.gz /home/mastodon/live/public/system&lt;br /&gt;
&lt;br /&gt;
Which is called in cron like so:&lt;br /&gt;
30 02 * * * /bin/bash /home/mastodon/backup_mastodon.sh &amp;gt; /home/mastodon/backups/backup.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=93</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=93"/>
		<updated>2018-06-11T19:42:23Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Increasing character limit on posts ===&lt;br /&gt;
Search and replace &#039;500&#039; by whatever you want in these two files:&lt;br /&gt;
&lt;br /&gt;
 modified:   app/javascript/mastodon/features/compose/components/compose_form.js&lt;br /&gt;
 modified:   app/validators/status_length_validator.rb&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following crontab entries:&lt;br /&gt;
 5 1 * * * pg_dump mastodon_production &amp;gt; /home/mastodon/backups/`date +&amp;quot;%F&amp;quot;`/mastodon_production_`date +&amp;quot;%F&amp;quot;`.sql #postgres db&lt;br /&gt;
 5 1 * * * tar -cvzf /home/mastodon/backups/`date +&amp;quot;%F&amp;quot;`/system`date +&amp;quot;%F&amp;quot;`.tar.gz /home/mastodon/live/public/system # assets&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=92</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=92"/>
		<updated>2018-06-06T07:42:28Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Backups =&lt;br /&gt;
&lt;br /&gt;
the Mastodon project [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md advises] to back up the following things:&lt;br /&gt;
* Postgres database&lt;br /&gt;
* Assets (avatars, uploaded files etc)&lt;br /&gt;
* Application secrets&lt;br /&gt;
&lt;br /&gt;
We do so using the following crontab entries:&lt;br /&gt;
 5 1 * * * pg_dump mastodon_production &amp;gt; /home/mastodon/backups/`date +&amp;quot;%F&amp;quot;`/mastodon_production_`date +&amp;quot;%F&amp;quot;`.sql #postgres db&lt;br /&gt;
 5 1 * * * tar -cvzf /home/mastodon/backups/`date +&amp;quot;%F&amp;quot;`/system`date +&amp;quot;%F&amp;quot;`.tar.gz /home/mastodon/live/public/system # assets&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Statistics ==&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=90</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=90"/>
		<updated>2018-05-31T12:20:44Z</updated>

		<summary type="html">&lt;p&gt;Rra: update to newest CSP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;;&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;;&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;;&lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;none&#039;; script-src &#039;self&#039;; object-src &#039;self&#039;; style-src &#039;self&#039;; img-src &#039;self&#039; data: https: blob:; media-src &#039;self&#039;; frame-src &#039;none&#039;; font-src &#039;self&#039; data: https://post.lurk.org; upgrade-insecure-requests; frame-ancestors &#039;self&#039;; form-action &#039;self&#039;; base-uri &#039;self&#039;; connect-src &#039;self&#039; blob: wss://post.lurk.org *.lurk.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Statistics ==&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=51</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=51"/>
		<updated>2018-05-09T10:13:43Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
==== content security policy, xss etc ====&lt;br /&gt;
In order to get A+ one hast to set explicit policies the sources and origins of where post.lurk.org gets loaded. The [https://observatory.mozilla.org/analyze.html?host=post.lurk.org mozilla observatory] has a lot of documentation on these topics. Because it is unclear how mastodon loads all of its resources it was a bit of fiddling to find out how strict we could be without breaking the site. This is done by adding headers in the nginx config:&lt;br /&gt;
&lt;br /&gt;
  add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubdomains; preload&amp;quot;; #this page is only allowed to be loaded over HTTPS&lt;br /&gt;
  add_header X-Frame-Options &amp;quot;DENY&amp;quot;; #post.lurk.org can&#039;t be loaded inside an iframe&lt;br /&gt;
  add_header Referrer-Policy &amp;quot;strict-origin-when-cross-origin&amp;quot;; &lt;br /&gt;
  add_header Content-Security-Policy &amp;quot;default-src &#039;self&#039;; script-src &#039;self&#039;; img-src &#039;self&#039; data:; style-src &#039;self&#039;; font-src &#039;self&#039; data:; frame-src &#039;self&#039;; object-src &#039;none&#039;;frame-ancestors &#039;none&#039;&amp;quot;; #only load sources from post.lurk.org, not externally.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Statistics ==&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=50</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=50"/>
		<updated>2018-05-09T05:29:47Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Performance tweaks ==&lt;br /&gt;
&lt;br /&gt;
=== Getting high scores on ssl comparison sites ===&lt;br /&gt;
&lt;br /&gt;
[https://instances.social instances.social] automatically rates each fediverse instance using two different SSL testing sites: &lt;br /&gt;
* [https://tls.imirhil.fr/https/post.lurk.org https://tls.imirhil.fr/https/post.lurk.org]&lt;br /&gt;
* [https://observatory.mozilla.org/analyze.html?host=post.lurk.org https://observatory.mozilla.org/analyze.html?host=post.lurk.org]. &lt;br /&gt;
&lt;br /&gt;
At the time of writing we got A and B (untweaked mastodon config). We are good boys and want to get A+ grades.&lt;br /&gt;
&lt;br /&gt;
==== weak DH primes ====&lt;br /&gt;
The first is the weak Diffie-Hellman key primes described [https://weakdh.org/sysadmin.html here] and [https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html#Forward_Secrecy_&amp;amp;_Diffie_Hellman_Ephemeral_Parameters here].&lt;br /&gt;
&lt;br /&gt;
Generate like so (this take a looong time):&lt;br /&gt;
 cd /etc/ssl/certs&lt;br /&gt;
 openssl dhparam -out dhparam.pem 4096&lt;br /&gt;
&lt;br /&gt;
in the post.lurk.org nginx config we point to this new prime by adding this line:&lt;br /&gt;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
&lt;br /&gt;
== Statistics ==&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;br /&gt;
&lt;br /&gt;
[[Category: Fediverse]]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=45</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=45"/>
		<updated>2018-05-03T13:17:55Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;br /&gt;
&lt;br /&gt;
== Statistics ==&lt;br /&gt;
Via the public API one can see the amount activity per week:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/activity https://post.lurk.org/api/v1/instance/activity]&lt;br /&gt;
&lt;br /&gt;
and the amount of instances in the federation a server is connected to:&lt;br /&gt;
&lt;br /&gt;
[https://post.lurk.org/api/v1/instance/peers https://post.lurk.org/api/v1/instance/peers]&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=44</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=44"/>
		<updated>2018-05-03T10:15:42Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one-to-one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up during install, the smtp address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles up all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=43</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=43"/>
		<updated>2018-05-03T10:12:41Z</updated>

		<summary type="html">&lt;p&gt;Rra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
== admin resources ==&lt;br /&gt;
&lt;br /&gt;
=== Useful pages from the mastodon documentation === &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
=== Admin community / help === &lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
post.lurk.org followed the mastodon install almost literally since it was one to one applicable on debian stretch. Quite boring really.&lt;br /&gt;
&lt;br /&gt;
This means that mastodon runs as the user mastodon. All the mastodon files live in:&lt;br /&gt;
 /home/mastodon/live/&lt;br /&gt;
&lt;br /&gt;
Differences are:&lt;br /&gt;
* When running the interactive set up the smpt address is set as localhost and the [[Postfix_Relay|postfix relay]] takes care of the rest.&lt;br /&gt;
* Mastodon-web runs on port 3001 instead of 3000, the changes to this are reflected in the systemd service files and in the nginx virtualhost config&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s a beast that gobbles all the ram. Something to take into account.&lt;br /&gt;
&lt;br /&gt;
For now I&#039;ve added the mastodon user to a [[cgroup]] TODO&lt;br /&gt;
&lt;br /&gt;
Mastodon can be (re)started by:&lt;br /&gt;
 systemctl stop mastodon-*.service&lt;br /&gt;
 systemctl start mastodon-web.service&lt;br /&gt;
 systemctl start mastodon-sidekiq.service&lt;br /&gt;
 systemctl start mastodon-streaming.service&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
	<entry>
		<id>https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=42</id>
		<title>Mastodon</title>
		<link rel="alternate" type="text/html" href="https://things.bleu255.com/runyourown/index.php?title=Mastodon&amp;diff=42"/>
		<updated>2018-05-03T09:56:31Z</updated>

		<summary type="html">&lt;p&gt;Rra: added docs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://post.lurk.org is a mastodon service. [https://joinmastodon.org/ Mastodon] is a federated microblogging software that speaks both [http://www.activitypub.rocks/ ActivityPub] and [https://en.wikipedia.org/wiki/OStatus OStatus] and can thus communicate with other microblogging softwares like [https://gnu.io/ GnuSocial], [https://pleroma.social/ Pleroma], [https://github.com/pump-io/pump.io Pump.io] etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== official docs ==&lt;br /&gt;
&lt;br /&gt;
Useful pages from the mastodon documentation&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md Installing Mastodon] the guide is meant for Ubuntu 16.04 but it worked flawlessly on Debian Stretch&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Tuning.md Tuning mastodon performance] TODO&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/List-of-Rake-tasks.md  Mastodon admin commands from ruby terminal]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Maintaining-Mastodon/Backups-Guide.md What and how to back up in Mastodon]&lt;br /&gt;
* [https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Updating-Mastodon-Guide.md Updating to newer versions]&lt;br /&gt;
&lt;br /&gt;
Admin community / help&lt;br /&gt;
&lt;br /&gt;
* [https://discourse.joinmastodon.org/ Mastodon forum] some discussions happen here&lt;br /&gt;
* [https://github.com/tootsuite/mastodon/issues Mastodon git issues] some happen there&lt;/div&gt;</summary>
		<author><name>Rra</name></author>
	</entry>
</feed>