Fly.io Deployment

I’m running several services on fly.io. Some using fly’s postgres and some using sqlite3

Using sqlite3 should be as straightforward as running

fly volumes create my_app_strapi_data -s <size in GB>

npm install better-sqlite3

update fly.toml:


[env]
DATABASE_FILENAME='/strapi_data/strabi.db'

[mounts]
  source="my_app_strapi_data"
  destination="/strapi_data"

and then - following SQLite | Strapi Documentation

in ./config/database.js

module.exports = ({ env }) => ({
  connection: {
    client: 'sqlite',
    connection: {
      filename: env('DATABASE_FILENAME')),
    },
    useNullAsDefault: true,
  },
});

Then deploy.

Note that this will mean you can only run 1 machine, unless you use fly’s sqlite replication using LiteFS - LiteFS - Distributed SQLite · Fly Docs

So be sure to scale to 1 machine :

fly scale count 1
1 Like