├── .dockerignore ├── Dockerfile ├── LICENSE ├── README.md ├── config.production.json ├── render.yaml ├── start.sh └── updateConfig.js /.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | LICENSE 3 | README.md 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # see versions at https://hub.docker.com/_/ghost 2 | FROM ghost:5.14.1 3 | 4 | WORKDIR $GHOST_INSTALL 5 | COPY . . 6 | 7 | ENTRYPOINT [] 8 | CMD ["./start.sh"] 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ghost on Render 2 | 3 | This is a template repository for running [Ghost](https://ghost.org) on Render. 4 | 5 | * It uses the official [Ghost Docker image](https://hub.docker.com/_/ghost). 6 | 7 | * It uses [Render Disks](https://render.com/docs/disks) for permanent SSD storage for uploaded files and content. 8 | 9 | * It supports [MySQL](https://render.com/docs/deploy-mysql) as the backing database for Ghost. 10 | 11 | **Note**: As of Ghost 5.0, MySQL 8 is the only supported database, according to the [Ghost changelog](https://ghost.org/docs/changes/). SQLite is only supported in development environments, NOT in production. 12 | 13 | 14 | ## Deployment 15 | 16 | See https://render.com/docs/deploy-ghost. 17 | -------------------------------------------------------------------------------- /config.production.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://localhost:10000", 3 | "server": { 4 | "port": 10000, 5 | "host": "0.0.0.0" 6 | }, 7 | "database": { 8 | "client": "mysql", 9 | "connection": { 10 | "host": "mysql-db", 11 | "port": 3306, 12 | "user": "admin", 13 | "password": "DATABASE_PASSWORD", 14 | "database": "DATABASE_NAME" 15 | } 16 | }, 17 | "mail": { 18 | "transport": "Direct" 19 | }, 20 | "logging": { 21 | "transports": [ 22 | "stdout" 23 | ] 24 | }, 25 | "paths": { 26 | "contentPath": "/var/lib/ghost/content" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /render.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | - type: web 3 | name: ghost 4 | env: docker 5 | autoDeploy: false 6 | disk: 7 | name: ghost 8 | mountPath: /var/lib/ghost/content 9 | sizeGB: 10 #Feel free to change this to suit your needs. 10 | envVars: 11 | - key: database__client 12 | value: mysql 13 | - key: database__connection__host 14 | fromService: 15 | type: pserv 16 | name: mysql 17 | property: host 18 | - key: database__connection__database 19 | value: ghostdb 20 | - key: database__connection__user 21 | value: mysql 22 | - key: database__connection__password 23 | fromService: 24 | type: pserv 25 | name: mysql 26 | envVarKey: MYSQL_PASSWORD 27 | 28 | - type: pserv 29 | name: mysql 30 | plan: standard 31 | env: docker 32 | repo: https://github.com/render-examples/mysql 33 | autoDeploy: false 34 | disk: 35 | name: mysql 36 | mountPath: /var/lib/mysql 37 | sizeGB: 10 38 | envVars: 39 | - key: MYSQL_DATABASE 40 | value: ghostdb 41 | - key: MYSQL_USER 42 | value: mysql 43 | - key: MYSQL_PASSWORD 44 | generateValue: true 45 | - key: MYSQL_ROOT_PASSWORD 46 | generateValue: true 47 | 48 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o errexit 3 | 4 | baseDir="$GHOST_INSTALL/content.orig" 5 | for src in "$baseDir"/*/ "$baseDir"/themes/*; do 6 | src="${src%/}" 7 | target="$GHOST_CONTENT/${src#$baseDir/}" 8 | mkdir -p "$(dirname "$target")" 9 | if [ ! -e "$target" ]; then 10 | tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")" 11 | fi 12 | done 13 | 14 | # update the URL 15 | node updateConfig.js 16 | 17 | node current/index.js 18 | -------------------------------------------------------------------------------- /updateConfig.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | const contents = fs.readFileSync("config.production.json"); 4 | const config = JSON.parse(contents); 5 | const externalURL = process.env.url || process.env.RENDER_EXTERNAL_URL; 6 | if (externalURL) { 7 | // update the URL in the config 8 | config.url = externalURL; 9 | fs.writeFileSync("config.production.json", JSON.stringify(config, null, 2)); 10 | } 11 | --------------------------------------------------------------------------------