I used this boilerplate to setup strapi on render But when deploying new commits from my strapi repo. The sql lite database gets reset and strapi promts my to create a new admin user.
When deploying a snapshot the database gets as well deleted while deploying.
My first guess was that it is the build command yarn build
but when excluding the command i get csp violations when visiting https://strapi-xxx.onrender.com/admin
My prod db with lots of content is gone and the disk restore wont work..
render.yml
services:
- type: web
name: strapi
region: frankfurt
env: node
plan: starter
buildCommand: yarn install && yarn build
startCommand: rsync -a public/ /data/public/ && yarn start
healthCheckPath: /_health
autoDeploy: false
disk:
name: foo-data
mountPath: /data
sizeGB: 2
envVars:
- key: NODE_VERSION
value: ~16.13.0
- key: NODE_ENV
value: production
- key: DATABASE_FILENAME
value: /data/strapi.db
- key: JWT_SECRET
generateValue: true
- key: ADMIN_JWT_SECRET
generateValue: true
- key: APP_KEYS
generateValue: true
- key: API_TOKEN_SALT
generateValue: true
package.json
{
"name": "xxx-cms",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"@strapi/plugin-i18n": "4.3.8",
"@strapi/plugin-users-permissions": "4.3.8",
"@strapi/strapi": "4.3.8",
"better-sqlite3": "7.4.6",
"strapi-plugin-populate-deep": "^0.1.2",
"strapi-tiptap-editor": "^0.9.1"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "8eecc22d-4d63-4696-b0bf-b28c6ffd4d45"
},
"engines": {
"node": ">=14.19.1 <=16.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}
config/database.js
const path = require('path');
module.exports = ({ env }) => ({
connection: {
client: 'sqlite',
connection: {
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
},
useNullAsDefault: true,
},
});
config/env/production/server.js
module.exports = ({ env }) => ({
url: env("RENDER_EXTERNAL_URL"),
dirs: {
public: "/data/public"
},
});