Moving from Heroku is not going to be a fun task.
I have a handful of projects that I’ve built to play with over my years of development.
Out of all of these projects, I have 1 (yes 1) that I would like to keep going on another provider.
Migrating a bookmarking app that has a total of 1 User (me) but is used daily to find and categorise articles/links from across the web.
Picking a provider
Picking a new service to host. Well…. fly.io seemed like the easiest. I started a new app and deployed it using their documentation within 30mins.
I then attempted to deploy the bookmarking app using the existing codebase.
Using an additional server with a worker would also contribute to usage stats, which was slightly concerning.
How can we make this easier?
We still require the worker server due to Good Jobs default configuration.
The Good Job documentation shows that you can run the jobs in the Rails server (
:async) rather than a worker (
:external) server, however, this is not recommended for high workloads - we have 1 User and that’s me 🥳.
We now have a single Rails server and a Postgres database.
Jobs are added to Postgres and processed by the Rails server.
ActionCable and Turbo Stream also get sent through Postgres.
Running out of memory
On the cheapest compute offering from fly.io, there is 256Mb or RAM.
My bookmarker app and another app both seem to level out at 300Mb of RAM which causes them to crash occasionally.
This also stops them from being deployed 🙁
The solution was to bump this up to the next level which is 512Mb however, this will presumably incur a cost