Skip to main content
Important: LiteFS is outside our scope of support. We are not able to provide support or guidance for it. Use with caution.
Don’t use LiteFS with autostop/autostart on Fly Machines.The Fly Proxy can stop and restart Machines without knowing which Machine holds the LiteFS lease or has the latest data. This can allow a Machine with stale data to acquire the lease, causing LiteFS to discard newer changes and LTX files. The result can be a database rollback and permanent data loss.
This is a technology preview. ā€œLiteFSā€ is a 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 with LiteFS:
  1. You’ll have to configure SQLite connection in your fly.toml file:
  2. Since we’re saving the SQLite database in the storage directory, make sure to mount a volume on it by following this guide here.
  3. Execute litefs mount instead of starting the server in .fly/entrypoint.sh:
  4. Make sure to properly configure the configuration file( etc/litefs.yml ) read by LiteFS:
  5. Include a ( etc/fuse.conf ) file to enable allow-other option above to work.
  6. Revise the generated Dockerfile to include the LiteFS image, install required packages, and copy the configuration files etc/litefs.yml and etc/fuse.conf to a proper location LiteFS can read.
  7. Create a middleware to forward write requests to the primary node using fly-replay
  8. Use a non-file session driver to allow fly-replay to work on Laravel CSRF protection.