System Information
- Strapi Version: 4.7.0
- Operating System: Windows 11 (dev), Linux (server)
- Database: sqlite
- Node Version: 18.15.0
- NPM Version: 9.5.0
- Yarn Version: 1.22.19
I am trying to deploy my strapi project to render.com. I have followed the guide here:
Deploy Strapi | Render · Cloud Hosting for Developers
Render Deployment
However there seems to be an issue with the file path in which the sqlite database file is created.
the render.yaml file states:
disk:
name: strapi-data
mountPath: /data
sizeGB: 1
## ...
envVars:
- key: DATABASE_FILENAME
value: /data/strapi.db
This creates the persistent disk with the ABSOLUTE mount path of /data
(in the ROOT directory of the SERVER)
However, the DATABASE_FILENAME
value in this example seems to creating the strapi.db
file RELATIVE to the PROJECT DIRECTORY (which is a few levels deeper: /opt/render/project/src/backend/data
)
This means that the database file does not persist between deployments.
Here is my database.js
file:
module.exports = ({ env }) => ({
connection: {
client: "sqlite",
connection: {
filename: path.join(
__dirname,
"..",
env("DATABASE_FILENAME", ".tmp/data.db")
),
},
useNullAsDefault: true,
},
});
Is this an issue with Strapi, Render.com or the code/configuration? Any help here is greatly appreciated.
Many thanks,
Chris