I’m trying to get a simple Rails app with Litestack deployed, but this part from the blog post doesn’t seem to work:
When the fly launch command is run, Fly.io runs the dockerfile-rails gem, which detects the Litestack gem and configures the Dockerfile with the VOLUME and ENV directives needed to store and access Sqlite databases on persistent volume.
The fly launch command then detects the VOLUME directives from the Dockerfile and adds them to the fly.toml file, which configures a persistent volume on the Fly Machine deployment target.
AFAICS, the only Litestack-specific thing that happens during fly launch is that ENV LITESTACK_DATA_PATH="/data" is added to the Dockerfile, but no “VOLUME and ENV directives needed to store and access Sqlite databases on persistent volume.”
I encountered the same. My dockerfile looks pretty different from the one in the demo repo, and also doesn’t include anything related to LITESTACK_DATA_PATH. I was expecting the database to be persisted after each deploy but, nope!
Anyway, all I can really try at this point is to figure out what parts from the demo’s dockerfile I need to bring over as best as I can
Hey sorry for the delay! I missed this post. Moving to Hetzner is one way to get it working. If you stick around Fly the fly launch command should detect any VOLUME declarations in a Dockerfile and create a volume in the fly.toml file. If it’s not working that way then there’s a bug.
If you’re doing this with an existing app that’s deployed to Fly you’ll need to setup a volume manually, which you can read more about at Add volume storage · Fly Docs
Thanks for the response Brad!
One thing I’m noticing… Here’s the quote from the blog post describing fly launch:
This will create a fly.toml file in your project working directory environment, and provision resources on Fly.io. A Dockerfile is also generated, which is a description of the server that will be running in production.
But just now you said
the fly launch command should detect any VOLUME declarations in a Dockerfile and create a volume in the fly.toml file
So the post implies that the Dockerfile is generated by the fly launch command, but you’re saying you should already have one by the time you run fly launch. So maybe that’s where the problem lies?
You have a new Rails project with the sqlite3 gem and you’ve run bundle add litestack
You run fly launch, which detects the gems above and generates a Dockerfile with the VOLUME /data directive, provisions a persistent volume at /data on the Fly Machine.
If those conditions aren’t met there’s a few manual steps, mainly adding the VOLUME /data to the Dockerfile and provisioning the volume on that machine.