Set up SQLite in the Storage Folder
Since SQLite is “embeddable”, you no longer have to set up a separate Fly App for it. You simply configure your Laravel Fly App with one:-
Configure SQLite connection in your fly.toml file:
- As seen above, the SQLite database will be located in the storage directory. Make sure to mount a volume on the directory by following this guide here. Mounting a volume on the storage folder will ensure everything it contains gets persisted, including data on the SQLite database located inside.
-
Once you’ve configured persisting the storage directory by following step 2 above, revise the start up script that will be created from it. Revise it to enable initializing the SQLite file:
The condition statement checks if the database folder does not exist in the volumized storage folder. If it does not exist, it creates a database directory inside storage/ and creates a database.sqlite file in the storage/database folder.
-
Finally, deploy your Laravel Fly App with
fly deploy!