├── api └── .gitkeep ├── extensions ├── .gitkeep └── users-permissions │ └── config │ └── jwt.js ├── public ├── uploads │ └── .gitkeep └── robots.txt ├── .env.example ├── .eslintignore ├── favicon.ico ├── config ├── env │ └── production │ │ ├── middleware.js │ │ ├── server.js │ │ └── database.js ├── functions │ ├── responses │ │ └── 404.js │ ├── bootstrap.js │ └── cron.js ├── server.js └── database.js ├── .editorconfig ├── README.md ├── .eslintrc ├── render.yaml ├── package.json ├── LICENSE └── .gitignore /api/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /extensions/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/uploads/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | HOST=0.0.0.0 2 | PORT=1337 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .cache 2 | build 3 | **/node_modules/** 4 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naruhitokaide/strapi-postgres/HEAD/favicon.ico -------------------------------------------------------------------------------- /config/env/production/middleware.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | logger: { 4 | level: "error", 5 | }, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /extensions/users-permissions/config/jwt.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | jwtSecret: process.env.JWT_SECRET || 'b4dbad35-6caa-4f84-be56-90d0d3bc2fdf' 3 | }; -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # To prevent search engines from seeing the site altogether, uncomment the next two lines: 2 | # User-Agent: * 3 | # Disallow: / 4 | -------------------------------------------------------------------------------- /config/functions/responses/404.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = async (/* ctx */) => { 4 | // return ctx.notFound('My custom message 404'); 5 | }; 6 | -------------------------------------------------------------------------------- /config/env/production/server.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | host: "0.0.0.0", 3 | url: env("RENDER_EXTERNAL_URL"), 4 | admin: { 5 | auth: { 6 | secret: env("ADMIN_JWT_SECRET"), 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /config/server.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | host: env('HOST', '0.0.0.0'), 3 | port: env.int('PORT', 1337), 4 | admin: { 5 | auth: { 6 | secret: env('ADMIN_JWT_SECRET', 'e90f50793cca33e2f11fb21ffbaa735f'), 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{package.json,*.yml}] 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /config/database.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | defaultConnection: 'default', 3 | connections: { 4 | default: { 5 | connector: 'bookshelf', 6 | settings: { 7 | client: 'sqlite', 8 | filename: env('DATABASE_FILENAME', '.tmp/data.db'), 9 | }, 10 | options: { 11 | useNullAsDefault: true, 12 | }, 13 | }, 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /config/functions/bootstrap.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * An asynchronous bootstrap function that runs before 5 | * your application gets started. 6 | * 7 | * This gives you an opportunity to set up your data model, 8 | * run jobs, or perform some special logic. 9 | * 10 | * See more details here: https://strapi.io/documentation/v3.x/concepts/configurations.html#bootstrap 11 | */ 12 | 13 | module.exports = () => {}; 14 | -------------------------------------------------------------------------------- /config/functions/cron.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Cron config that gives you an opportunity 5 | * to run scheduled jobs. 6 | * 7 | * The cron format consists of: 8 | * [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK] 9 | * 10 | * See more details here: https://strapi.io/documentation/v3.x/concepts/configurations.html#cron-tasks 11 | */ 12 | 13 | module.exports = { 14 | /** 15 | * Simple example. 16 | * Every monday at 1am. 17 | */ 18 | // '0 1 * * 1': () => { 19 | // 20 | // } 21 | }; 22 | -------------------------------------------------------------------------------- /config/env/production/database.js: -------------------------------------------------------------------------------- 1 | const { parse } = require("pg-connection-string"); 2 | 3 | module.exports = ({ env }) => { 4 | const { host, port, database, user, password } = parse(env("DATABASE_URL")); 5 | 6 | return { 7 | defaultConnection: "default", 8 | connections: { 9 | default: { 10 | connector: "bookshelf", 11 | settings: { 12 | client: "postgres", 13 | host, 14 | port, 15 | database, 16 | username: user, 17 | password, 18 | }, 19 | }, 20 | }, 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deploy Strapi to Render 2 | 3 | This is a sample [Strapi](https://strapi.io/) app, configured for deployment to [Render](https://render.com). It uses a [managed PostgreSQL database](https://render.com/docs/databases) to store structured content and a [persistent disk](https://render.com/docs/disks) to store uploaded Media Library files. 4 | 5 | Fork this repo and click the button below to deploy. 6 | 7 | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy) 8 | 9 | See the guide at https://render.com/docs/deploy-strapi for more information. 10 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "eslint:recommended", 4 | "env": { 5 | "commonjs": true, 6 | "es6": true, 7 | "node": true, 8 | "browser": false 9 | }, 10 | "parserOptions": { 11 | "ecmaFeatures": { 12 | "experimentalObjectRestSpread": true, 13 | "jsx": false 14 | }, 15 | "sourceType": "module" 16 | }, 17 | "globals": { 18 | "strapi": true 19 | }, 20 | "rules": { 21 | "indent": ["error", 2, { "SwitchCase": 1 }], 22 | "linebreak-style": ["error", "unix"], 23 | "no-console": 0, 24 | "quotes": ["error", "single"], 25 | "semi": ["error", "always"] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /render.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | - type: web 3 | name: strapi 4 | env: node 5 | plan: starter 6 | buildCommand: yarn install && yarn build 7 | startCommand: yarn start 8 | healthCheckPath: /_health 9 | disk: 10 | name: strapi-uploads 11 | mountPath: /opt/render/project/src/public/uploads 12 | sizeGB: 1 13 | envVars: 14 | - key: NODE_VERSION 15 | value: 12.18.4 16 | - key: NODE_ENV 17 | value: production 18 | - key: DATABASE_URL 19 | fromDatabase: 20 | name: strapi 21 | property: connectionString 22 | - key: JWT_SECRET 23 | generateValue: true 24 | - key: ADMIN_JWT_SECRET 25 | generateValue: true 26 | 27 | databases: 28 | - name: strapi 29 | plan: starter 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "strapi-postgres", 3 | "private": true, 4 | "version": "0.1.0", 5 | "description": "A Strapi application", 6 | "scripts": { 7 | "develop": "strapi develop", 8 | "start": "strapi start", 9 | "build": "strapi build", 10 | "strapi": "strapi" 11 | }, 12 | "devDependencies": {}, 13 | "dependencies": { 14 | "knex": "<0.20.0", 15 | "pg": "^8.3.3", 16 | "pg-connection-string": "^2.4.0", 17 | "sqlite3": "latest", 18 | "strapi": "3.6.3", 19 | "strapi-admin": "3.6.3", 20 | "strapi-connector-bookshelf": "3.6.3", 21 | "strapi-plugin-content-manager": "3.6.3", 22 | "strapi-plugin-content-type-builder": "3.6.3", 23 | "strapi-plugin-email": "3.6.3", 24 | "strapi-plugin-upload": "3.6.3", 25 | "strapi-plugin-users-permissions": "3.6.3", 26 | "strapi-utils": "3.6.3" 27 | }, 28 | "author": { 29 | "name": "A Strapi developer" 30 | }, 31 | "strapi": { 32 | "uuid": "fd1159cd-5981-4881-877c-3cacd7f6dbf9" 33 | }, 34 | "engines": { 35 | "node": ">=10.0.0", 36 | "npm": ">=6.0.0" 37 | }, 38 | "license": "MIT" 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Render Developers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ############################ 2 | # OS X 3 | ############################ 4 | 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | .Spotlight-V100 10 | .Trashes 11 | ._* 12 | 13 | 14 | ############################ 15 | # Linux 16 | ############################ 17 | 18 | *~ 19 | 20 | 21 | ############################ 22 | # Windows 23 | ############################ 24 | 25 | Thumbs.db 26 | ehthumbs.db 27 | Desktop.ini 28 | $RECYCLE.BIN/ 29 | *.cab 30 | *.msi 31 | *.msm 32 | *.msp 33 | 34 | 35 | ############################ 36 | # Packages 37 | ############################ 38 | 39 | *.7z 40 | *.csv 41 | *.dat 42 | *.dmg 43 | *.gz 44 | *.iso 45 | *.jar 46 | *.rar 47 | *.tar 48 | *.zip 49 | *.com 50 | *.class 51 | *.dll 52 | *.exe 53 | *.o 54 | *.seed 55 | *.so 56 | *.swo 57 | *.swp 58 | *.swn 59 | *.swm 60 | *.out 61 | *.pid 62 | 63 | 64 | ############################ 65 | # Logs and databases 66 | ############################ 67 | 68 | .tmp 69 | *.log 70 | *.sql 71 | *.sqlite 72 | *.sqlite3 73 | 74 | 75 | ############################ 76 | # Misc. 77 | ############################ 78 | 79 | *# 80 | ssl 81 | .idea 82 | nbproject 83 | public/uploads/* 84 | !public/uploads/.gitkeep 85 | 86 | ############################ 87 | # Node.js 88 | ############################ 89 | 90 | lib-cov 91 | lcov.info 92 | pids 93 | logs 94 | results 95 | node_modules 96 | .node_history 97 | 98 | 99 | ############################ 100 | # Tests 101 | ############################ 102 | 103 | testApp 104 | coverage 105 | 106 | ############################ 107 | # Strapi 108 | ############################ 109 | 110 | .env 111 | license.txt 112 | exports 113 | .cache 114 | build 115 | --------------------------------------------------------------------------------