distributed file system that enables you to sync SQLite data across instances of your application.
Read further on the official LiteFS documentation and follow along a LiteFS-configured sample Laravel repository here.
Laravel Specific Configuration
Take note of the following important steps in configuring your Laravel Fly App withLiteFS:
-
You’ll have to configure SQLite connection in your
fly.tomlfile: - Since we’re saving the SQLite database in the storage directory, make sure to mount a volume on it by following this guide here.
-
Execute
litefs mountinstead of starting the server in.fly/entrypoint.sh: -
Make sure to properly configure the configuration file( etc/litefs.yml ) read by LiteFS:
-
Include a ( etc/fuse.conf ) file to enable
allow-otheroption above to work. -
Revise the generated Dockerfile to include the
LiteFSimage, install required packages, and copy the configuration filesetc/litefs.ymlandetc/fuse.confto a proper locationLiteFScan read. - Create a middleware to forward write requests to the primary node using fly-replay
- Use a non-file session driver to allow fly-replay to work on Laravel CSRF protection.