Giter Site home page Giter Site logo

render-examples / strapi-sqlite Goto Github PK

View Code? Open in Web Editor NEW
43.0 8.0 322.0 472 KB

Deploy Strapi with SQLite on Render

Home Page: https://render.com/docs/deploy-strapi

License: MIT License

Shell 4.11% JavaScript 95.89%
strapi render headless-cms deployment hosting sqlite

strapi-sqlite's Introduction

Deploy Strapi to Render

This is a sample Strapi app, configured for deployment to Render. It uses a SQLite database, which is stored on a persistent disk along with uploaded Media Library files.

Fork this repo and click the button below to deploy.

Deploy to Render

See the guide at https://render.com/docs/deploy-strapi for more information.

strapi-sqlite's People

Contributors

aduong avatar crcastle avatar davidmauskop avatar lauriejim avatar wendorf avatar zach-render avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

strapi-sqlite's Issues

Getting error while deploying

Jan 26 10:24:16 PM Error: The public folder (/data/public) doesn't exist or is not accessible. Please make sure it exists.
Jan 26 10:24:16 PM at module.exports (/opt/render/project/src/node_modules/@strapi/strapi/lib/core/bootstrap.js:29:11)
Jan 26 10:24:16 PM at async Strapi.register (/opt/render/project/src/node_modules/@strapi/strapi/lib/Strapi.js:383:5)
Jan 26 10:24:16 PM at async Strapi.load (/opt/render/project/src/node_modules/@strapi/strapi/lib/Strapi.js:477:5)
Jan 26 10:24:16 PM at async Strapi.start (/opt/render/project/src/node_modules/@strapi/strapi/lib/Strapi.js:212:9)
Jan 26 10:24:16 PM error Command failed with exit code 1.

Error Node expected version

Jan 25 06:00:52 PM ==> Checking out commit 6583634b40518cc085a7192013f2086e3f5e001d in branch master
Jan 25 06:00:52 PM ==> Downloading cache...
Jan 25 06:00:55 PM ==> Detected Node version 15.6.0
Jan 25 06:00:56 PM ==> Detected Node version 15.6.0
Jan 25 06:00:57 PM ==> Installing dependencies with Yarn...
Jan 25 06:00:57 PM yarn install v1.22.10
Jan 25 06:00:57 PM [1/5] Validating package.json...
Jan 25 06:00:57 PM [2/5] Resolving packages...
Jan 25 06:00:58 PM [3/5] Fetching packages...
Jan 25 06:01:11 PM warning [email protected]: Invalid bin field for "url-loader".
Jan 25 06:01:28 PM error [email protected]: The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "15.6.0"
Jan 25 06:01:28 PM error Found incompatible module.
Jan 25 06:01:28 PM info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Database is deleted when deploying new commits

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"
  },
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.