Self-hosting miniflux on Fly
Gonçalo Cabrita
This week I deployed miniflux, a minimalist and opinionated feed reader, on Fly.
I'd been wanting to stop focusing on HN and Twitter as my biggest source for new reading material. Most content on HN is not what I would call curated. Even my Twitter timeline doesn't feel like it's worth scavenging for reading material.
Self-curated feed readers are the solution to this. The people you already follow on Twitter, waiting for them to drop their new blog post, have RSS feeds. Blog posts that pop up on HN discussing something that interests you, which you open and read, have RSS feeds. You can already subscribe to them.
So this will be a small guide on how to self-host miniflux on Fly. Why Fly? Well, for starters they have a generous free tier which you will likely not exceed when self-hosting miniflux.
Resources included for free on all plans:
- Up to 3 shared-cpu-1x 256mb VMs
- 3GB persistent volume storage (total)
- 160GB outbound data transfer
Besides this, currently if your billing for a given month is under $5 they will not charge you.
Also, both billing and the free allowance are per organization and you can have several of these. This means you can run a bunch of side projects for no cost. Just don't abuse it to scale your one-man startup for free as that goes against their Terms of Service.
Another good reason to pick Fly is they make deploying and running Postgres easy. You can spin up a Postgres app running on a shared-cpu-1x 256mb VM backed by 3GB of persistent storage. You also get daily snapshots for free.
Getting Started
First you'll have to sign up for a Fly account if you don't have one yet. Then install the flyctl
CLI tool and log in using flyctl auth login
.
If you want to, you can create a separate organization for your miniflux instance. You can do so by running flyctl orgs create [name]
.
Make sure to add a debit/credit card to your organization's billing to upgrade from the Trial plan to the Hobby plan.
Setting up
Create a directory where you'll store the fly.toml
file, cd
into this directory and run flyctl launch
.
flyctl
will now ask you a bunch of things. First it'll ask you to pick a name for the app. Then what organization you want to create the app under. And finally, what region you want the app to run on.
After this, an autogenerated fly.toml
file will appear on the directory. It should look like this:
# fly.toml file generated for blue-firefly-8792 on 2022-12-23T15:51:30Z
app = "blue-firefly-8792"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
Deploying Postgres
To deploy a Postgres instance, run flyctl postgres create
and pick an app name, organization, and region for it. For the configuration, pick "Development" then wait for the deployment to finish.
Afterwards, you'll have to attach the Postgres app to your miniflux app. You can do this by running flyctl postgres attach [POSTGRES APP] -a [MINIFLUX APP]
.
Deploying miniflux
Now you'll have to pick your miniflux's admin username and password and set them as app secrets. To do this, run flyctl secrets set ADMIN_USERNAME="username"
and flyctl secrets set ADMIN_PASSWORD="password"
.
Now, open the autogenerated fly.toml
file and add the following onto it:
[build]
# You can pin this to a specific version if you don't trust latest
image = "docker.io/miniflux/miniflux:latest"
[env]
RUN_MIGRATIONS = "true"
CLEANUP_ARCHIVE_READ_DAYS = "30"
CLEANUP_ARCHIVE_UNREAD_DAYS = "90"
HTTPS = "true"
PORT = "8080"
# Only needed on the first deploy, but you can leave it on
CREATE_ADMIN = "true"
# Should be set to whatever your domain is, custom or not
BASE_URL = "https://blue-firefly-8792.fly.dev"
Finally, run flyctl deploy
and wait for the deployment to finish. Your miniflux instance is now up and running!
If you'd like to setup a custom domain look into the documentation. Then, make sure to update the BASE_URL
env in fly.toml
and issue a new deployment.