I just switched to Fly.io as well (using SQLite) and I found out that I faced an OOM error when the internal Ghost worker is seeking upgrades. Unfortunately, I believe there’s no way to disable this worker.
So, Fly.io is pretty neat but really too tight to ensure decent stability.
I recently posted a few more tips here, and #2 might be helpful:
TL;DR = If you aren’t already making use of the fact, Fly forgives monthly bills under $5, which means you can double the amount of RAM to 512 MB without actually getting charged.
I have had a Ghost site running on Fly using SQLite (following my previous tutorial for development mode) with 256MB RAM for months without any OOM issues, but perhaps running SQLite in production (with a slightly more complex configuration) uses more RAM.
I used another tutorial with sqlite working: How to Host a Ghost Blog for Free on Fly.io (blixtdev.com)
Can you help me to transfer my ghost blog from sqlite3 to MySQL8 . Right now my blog is running on sqlite3 on ghost 5.23.0 with a message that says I run my ghost blog on unsupported database in production. Its working ok, but I’m not sure what may happened if I still use sqlite3. Also, can you tell me how to backup and update ghost to newer released version? I’m not sure how to do that from Fly command-line tools.
If you used the Ghost 5 docker image without specifying the exact version number (ie, the tag 5-alpine or alpine rather than 5.24.1-alpine), updating your existing install (tutorial forthcoming) should be as simple as running:
… from the directory where your fly.toml is located; or running fly deploy -a YOURAPPNAME from anywhere.
Probably the simplest and cleanest approach will be to deploy a second app using my MySQL 8 tutorial, and then migrate everything over.
As far as backup, you’ll want to export a JSON dump from the labs page of your admin panel, and a CSV of your members. (and your routes.yaml and redirects, if applicable).
I haven’t used the Ghost CLI backup comand on Fly; I just back up my content folder using using the FTP command in tip #7 (flyctl ssh sftp shell -a APPNAME, then get /var/lib/ghost/content/ GHOST-CONTENT-BACKUP-YYYY-MM-DD)
Then, import the JSON and restore the content folder (or the subdirectories that you need, like images + files). I didn’t do this step when I migrated, because I had my images hosted externally. I assume this would be done over SSH or SFTP. It also might be possible to clone the whole volume and attach it to the new app. I’ll look into it.
Thank you! I’m not sure how many apps I can deploy in Fly.io free tier. Also, my domain have dns records pointing to ip of the app, so I guess I will have to do new records in my domain for the new app.
AFAIK you can have 3 free apps per organization, so you should be able to deploy Ghost + MySQL in an app each, alongside your existing Ghost+SQLite app. You can have 3GBs of volume space free, so 3x 1gb volumes would be fine.
However, even if you exceed the free tier during the transition, it won’t be too expensive (and of course bills under $5, which it likely would be if you are fast, are forgiven)
@curiositry I create new app using your tutorial and restore my content, everything is ok, but I have issue with my domain. I use cloudflare and when make new dns records pointing to new app my site dont open from my domain with error SSL handshake failed. Why is that? Do i need to point only ghost app, or db app too?
@Georgi_Pehlivanov Just the Ghost app. The Ghost connects to the MySQL app using Fly’s internal routing.
You added a certificate at https://fly.io/apps/APPNAME/certificates (or using fly CLI), and added the DNS records Fly told you to at the next step, correct? Does Fly show the domain as verified, and have checkmarks next to the certificates?
@curiositry I fixed it, but now I have some problems - how to change default app domain to my domain and not to fly.dev subdomain. When I open my site, everytime I click on the logo it open link in subdomain and not in my primary domain. My domain is in fly.toml
I also have trouble connecting stripe, it worked after I opened the site from fly.dev subdomain.
The two might be related. That’s odd, you should be able to set a “url” environment variable in your fly.toml. Fly secrets take precedence over environment variables, and aren’t as vulnerable to syntax errors. Does the problem persist after you run:
flyctl secrets set url=https://yourdomain.com -a APPNAME