Laravel: Multi-Node SQLite with LiteFS
This is a technology preview. "LiteFS" is a
distributed file system that enables you to sync SQLite data across instances of your application.
Take note of the following important steps in configuring your Laravel Fly App with
1) You'll have to configure SQLite connection in your
[env] ... DB_CONNECTION="sqlite" DB_DATABASE="/var/www/html/storage/database/database.sqlite"
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.
litefs mount instead of starting the server in
exec litefs mount
fuse: # Point to the directory containing your DB_DATABASE in fly.toml dir: "/var/www/html/storage/database" # Allow none-root access to the directory above--required for web access allow-other:true # Start the server, this was previously run in .fly/entrypoint.sh exec: "supervisord -c /etc/supervisor/supervisord.conf"
5) Include a ( etc/fuse.conf ) file to enable
allow-other option above to work.
8) Use a none-file session driver to allow fly-replay to work on Laravel CSRF protection.