Hi everyone,
In the past my app used the following template Epic Stack with the following essential config for the deployment to Fly.io
I SSH’ed into the production VM (before the monorepo setup) and I saw that somehow a data.db file gets created in the ./prisma folder at the root.
While I was moving the app into a monorepo I was asking myself: how and why? I had quite some problems and struggles make a monorepo work and in no way I got a data.db inside the Prisma folder generated. I had to change a bunch of files and ENV variables in order to get a connection.
What I have done now is:
fly.toml
[mounts]
source = "litefs"
destination = "/var/lib/litefs"
[build]
dockerfile = "/other/Dockerfile"
ignorefile = "/other/Dockerfile.dockerignore"
litefs.yml
fuse:
dir: '${LITEFS_DIR}'
data:
dir: '/var/lib/litefs'
exec:
- cmd: npx prisma migrate deploy --schema ./apps/sitenu/prisma/schema.prisma
if-candidate: true
# Main database WAL
- cmd: sqlite3 /litefs/data/sqlite.db "PRAGMA journal_mode = WAL;"
if-candidate: true
# Cache database WAL
- cmd: sqlite3 /litefs/data/cache.db "PRAGMA journal_mode = WAL;"
if-candidate: true
- cmd: npm start --prefix apps/sitenu
I had to change the ENV to:
DATABASE_URL: file:/litefs/data/sqlite.db
DATABASE_PATH: /litefs/data/sqlite.db
CACHE_DATABASE_PATH: /litefs/data/cache.db
LITEFS_DIR: /litefs/data
While I had:
DATABASE_URL: file:/litefs/data/sqlite.db
DATABASE_PATH: ./prisma/data.db
CACHE_DATABASE_PATH: ./other/cache.db
LITEFS_DIR: /litefs/data
Is this setup correct or did I miss something in order to get the data.db file get created in the prisma folder? I should note that first when I ssh’ed into the VM my whole project was available within #app. Now with the monorepo the actual app is att #app/apps/projectname