Categories
Software www

Mastodon server: R2

This is a very short post because to be honest, I didn’t figure much out myself.

My uploads/static files are now saved in R2 under its own URL (part of my enterprise zone) so that my normal caching rules and other settings are applied.

Add these to your application.env file:

3_ENABLED = "true"
S3_BUCKET = "<bucket name>"
S3_ENDPOINT = "https://<some-id>.r2.cloudflarestorage.com"
S3_ALIAS_HOST = "<connected domain>" 
S3_PERMISSION = "private"
AWS_ACCESS_KEY_ID = "<access_key>"
AWS_SECRET_ACCESS_KEY = "<secret_access_key>"

The token/API key is a bit hard to find, but it’s on the top right.

Then (re)deploy your site.

I did set up a new server (my RPi4 started to struggle, and I guess if I'm half serious about Mastodon, I shouldn't host it at home), so I started afresh... But there's a way to migrate existing data to R2 as well, following this guide. 
Categories
Misc Software

Free speech

I specifically disagree with his stance on free speech, because I think that it depends on your interpretation of what free speech means. If you allow the most intolerant voices to be as loud as they want to, you’re going to shut down voices of different opinions as well. So allowing free speech by just allowing all speech is not actually leading to free speech, it just leads to a cesspit of hate.

I think that is a very uniquely American idea of creating this marketplace of ideas where you can say anything you want completely without limits. It is very foreign to the German mindset where we, in our Constitution, our number one priority is maintaining human dignity. And so, hate speech is not part of the German concept of free speech, for example. So I think that when Elon Musk says that everything’s gonna be allowed, or whatever, I generally disagree with that.

Source: Time.com interview with Eugen Rochko
Categories
Software

Heads we win, tails he loses

Regardless of what happens to Twitter, Elon Musk is without a doubt the most interesting man in the world right now. He’s positioned himself at the intersection of so many trends and topics that it’s hard to keep count, and through it all, he’s tweeting memes. It’s the greatest show on earth, no work of fiction could ever hope to compete.

It’s also incredibly divisive. Not since Trump has a single character managed to invoke such extreme levels of love and hate on the world stage for weeks at the time. Nor has anyone been able to play the media like a fiddle with such virtuosity.

Thankfully the stakes are so much lower, though. Musk might be firing rockets into space, but they won’t accidentally have any nuclear warheads on them. His media trolling isn’t coming from within the White House. This reality show is playing out over something as disposable as a struggling social media website.

Furthermore, the world doesn’t need Twitter. In fact, the world would almost certainly be better off without Twitter.

That’s what makes this show so guiltlessly entertaining to watch: Whichever the outcome, the world wins. If Musk manages to fix Twitter, we’re left with a better Twitter. Great! If Musk manages to burn down Twitter, we’re left with a world free of Twitter. Great!

This is a 44 billion dollar gamble where the rest of us will win whatever the outcome.

Source: David Heinemeier from 37signals and Hey
Categories
Errors Software www

Using Mastodon with Cloudflare

If you’re using Mastodon with Cloudflare CDN/protection and minify turned on, you’ll notice the site may look broken (after a few visits, when hitting Cloudflare cache).

Yeah, that’s not how it’s supposed to look.

And you’ll notice errors in the webdev tools similar to Failed to find a valid digest in the 'integrity' attribute, with computed SHA-256 integrity:

Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js' with computed SHA-256 integrity 'YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js' with computed SHA-256 integrity '1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js' with computed SHA-256 integrity 'onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ='. The resource has been blocked.

Basically, the sha256 hash doesn’t match the js or css static files.

This happens because Cloudflare minifies those files and thus the hash has been changed.

To get it to work correctly, you’ll need to create a Page Rule via Rules > Page Rules > Create Page Rule with the following info:

The page rule created; in this screenshot, the rule is still turned off.
  • URL: YourMastodonURL.com/packs/*
  • Settings: Auto Minify: off (do not select anything)
  • Rocket Loader: slider off
Details on the page rule. Save and deploy.

Don’t forget to purge your cache via the dashboard (for the Mastodon domain) via Caching > Custom Purge > Hostname > YourMastodonURL.com.

Categories
Linux Software

Mastodon server: email

Always a hassle to get mail delivery to work.

Had a similar problem with a VoIP (Nexmo SMS/call forwarding) tool that just refused to work using local mail servers without a valid cert. Gave up and started using Mailgun. 

Long story short: use something like Mailgun or another provider.

Using localhost SMTP server support seems to be limited if you don’t have working certs. The documentation is also lacking as to what does what. Didn’t figure out how to have it ignore SSL.

This is what worked for me, using Mailgun server:

SMTP_SERVER=smtp.eu.mailgun.org
SMTP_PORT=465
[email protected]
SMTP_PASSWORD=some-password
[email protected]
SMTP_DELIVERY_METHOD=smtp
SMTP_SSL=true
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none

And it looks like I’m not the only one struggling.