Run a Pleroma server on Fly.io’s free tier. Pleroma can use Mastodon apps and federate with Mastodon servers.
I wanted to run my own ActivityPub server. I like self hosting. I don’t like spending money. For a while I had tried setting up Mastodon but I didn’t get super far. I had a pretty rough cold for the last two days and suddenly I had a free schedule to figure this out. I ended up pounding my head on the wall a bit, but here we go!
This assumes you have the flyctl (aka “fly”) command line tool and you’ve already run
fly auth signup or
fly auth login. Also, this uses the command line (Terminal on macOS).
1. Initiate the Fly.io app 🐣
Create an application. We’ll be using Pleroma because it’s light-weight enough to run in the free tier constraints. When prompted with the command below, you’ll need to launch:
- 🐘 with a Postgres instance
- 🧑💻 “Development - Single node” configuration
- 👎 without Redis
- 🏃 Yes, deploy! It’ll take ~2 minutes.
This will generate a
fly.toml. When you run the
fly command make sure the
fly.toml is in the same directory.
Save the Postgres configuration information! Once you’ve done that, treat yourself with a “hello world”.
If you don’t want to purchase a domain, the one you see in the browser will work (e.g.
2. (Optional) Configure DNS and Certs 🏷
If you’re happy with
your-app-1234.fly.dev, go to the “Create storage” step.
Create your (one free) IPv4 and IPv6 addresses.
Add the IPv4 and IPv6 address to the A and AAAA records respectively to your DNS. Do not proxy.
Whenever you want to see the status run
fly certs check <your-domain>. This should go quickly, but you can continue with these instructions on if you’re in a hurry.
3. Create storage 📦
The data in the volume stays between deployments. It needs to be in the same region as step 1.
fly.toml file, add the following environment variable and volume information.
Publish the changes.
4. Generate your configs 🧙
Connect to your server as the
You’ll need to make some choices about your server. Have the following Postgres configuration info ready.
- hostname of your database (e.g.
- password used to connect to your database (e.g. ao09u87ao0e9u)
5. Configure the database 🗄
ssl: false and
socket_options: [:inet6] to the
Pleroma.Repo section using vim. You’ll mainly need
i to get to insert mode, arrow keys to navigate, and write/quitting vim by hitting the ESC key and then typing
It should look like this before…
… and this afterwards.
Once you’ve updated the
config.exs file, run the database migration and exit the shell.
Download and save your
config.exs in a safe place.
6. Launch the (empty) Pleroma instance! 🚀
START_PLEROMA to the environment variable of your
Push up the changes and see the progress!
7. Add yourself and configure 🪞
ssh back into the app and add your account as an admin.
You’ll get a reset password URL. If you’re setting up your own domain, and your certs have not been issued
fly certs check <your domain>, then you might need to manually update the URL to use your Fly.io domain (
your-app-1234.fly.dev) for now.
8. Celebrate! 🎉
You have a running Pleroma instance! Feel free to follow me by putting
@[email protected] in the Pleroma search box.
You can also use Fedifinder to get your Twitter contacts and populate your feed.
A lot of these are codified in the
- “Open registration” is on by default. I recommend turning it off first.
- Fly.io limits you to 1 volume per app. You can’t run the app in multiple regions because of the volume.
- The volume is mounted at
- static files are in
- uploads are in
- configs are in
- static files are in
Resources I found helpful
- Installing on Linux using OTP releases and all the other official documentation
- Stanislas Lange’s prior art on GitHub
- Fly.io community answer for setting up the database.
- One line bash server
- Bash text blocks in Docker on StackOverflow
If you want more control over your Docker image, you can clone it and run
fly launch from inside the folder.
If you want to host Pleroma at
subdomain.example.com but want to use
[email protected], here’s the guide. If you get it to work, let me know.
There’s probably a way to use s3fs with Cloudflare’s R2 (that comes with 10GB free) instead of using a Fly.io volume. I tried but couldn’t get it working. If you get that to work, definitely let me know.