DEV Community

Sathyajith Bhat
Sathyajith Bhat

Posted on • Originally published at sathyasays.com on

Self-hosting FreshRSS (for free) on Fly.io in under 10 minutes

FreshRSS is a free, self-hostable RSS feeds aggregator. Fly.io is a super amazing platform that runs application servers close to end users.

Fly.io can take Docker images (or Dockerfiles, or buildpacks) and boot them into Firecracker powered microVMs. When you deploy with Fly.io, you get an Anycast IP, along with TLS offloading by them. The Firecracker microVMs can scale up & down per traffic, and it comes with a pretty generous free tier that includes

  • Up to 3 shared-cpu-1x 256MB VMs
  • 3GB of total persistent volume storage
  • 160GB outbound data transfer

Since FreshRSS comes with a Docker image, adapting it to fly.io was as straightforward as pointing to FreshRSS' Docker image. These are the steps if you wish to run FreshRSS on your fly.io account

  • Sign up for Fly.io or sign-in
  • Install flyctl
  • Sign into your Fly.io account by typing flyctl auth login
  • Create a fly.toml file similar to the one in my repo. Make sure to update the appname to a unique name.
  • Review the environment variables listed in the [env] section and update if required. You can check FreshRSS' docs on the environment variables that can be updated
  • Create a volume for persisting data using the command fly volumes create freshrss_data --size 1
    • In this command, we create a volume of size 1GB. This can be increased later, so I selected the lowest possible number, as flyctl expects size in GB and doesn't accept fractional numbers.
  • Save the fly.toml file. From the same directory where fly.toml is present, deploy FreshRSS the application using fly launch. Fly.io will pull the Docker image and launch the VM. The output should be as shown below:

fly launch
An existing fly.toml file was found for app freshrss
App is not running, deploy...
Deploying freshrss
==> Validating app configuration
--> Validating app configuration done
Services
TCP 80/443 ⇢ 80
Searching for image 'freshrss/freshrss' remotely...
image found: img_lj9x4d7jkwe4wo1k
Image: registry-1.docker.io/freshrss/freshrss:latest
Image size: 75 MB
==> Creating release
Release v1 created

You can detach the terminal anytime without stopping the deployment
Monitoring Deployment

1 desired, 1 placed, 1 healthy, 0 unhealthy
--> v1 deployed successfully
Enter fullscreen mode Exit fullscreen mode

That's it! FreshRSS should be accessible from the URL <appname>.fly.dev. You can front a custom domain as well. Head over to the Certificates tab from Fly.io's dashboard, or use the flyctl tool to provision a certificate by typing flyctl certs add <domain>. Add the CNAME that Fly tells you about, and then add an A record for the (sub)domain, pointing to the Anycast IP you get from deploying FreshRSS. See Fly.io's docs on how to do this.

Caveats

  • FreshRSS extensions need to be available on /var/www/FreshRSS/extensions, however - Fly.io doesn't support having same mount for mulitple directories, or having multiple mounts.
    • Trying to mount just /var/www/FreshRSS caused the microVM to throw kernel panics, mainly because the underlying Docker container expects something there - probably the webserver config and mounting an empty VM causes errors
    • You could try to play with Fly's internal networking, including setting up a wireguard tunnel, but I didn't try.
    • Another icky way is to build a custom Dockerfile copying the required extensions into the image during the build step..
  • I haven't run this for long, will update if I run into issues

Automated updates and deploys

Fly.io's CLI-oriented approach makes updates via GitHub actions easy. While I haven't set up for FreshRSS, you can look at this PR where I add a GitHub action to deploy my blog, sathyabh.at, a static site powered by Hugo to Fly.io.

Fly.io's community Discourse is quite active if you run into any problems. Hope this gives you a good taste of what Fly.io can offer.

See also: Github repo of the fly.io config file.

Top comments (0)