Pad Thing with CodiMD

CodiMD is a browser-based real-time collaborative markdown notes/pad kind of thing.

Prerequisites

 * Node v8.x https://nodejs.org/dist/latest-v8.x (tested with v8.15, support for v10.x is on the way)
 * A MySQL database, for now it only works with an utf8 db, specifically
 * a user with limited rights
 * SSL certs
 * NGINX HTTP server

Installation and Configuration
wget https://github.com/hackmdio/codimd/archive/1.2.1.tar.gz tar xvf 1.2.1.tar.gz mv codimd-1.2.1 /path/to/somewhere/codimd cd /path/to/somewhere/codimd {   "production": { "host": "localhost", "debug": "false", "port": "3000", "domain": "${FQDN}", "sessionSecret": "${RANDOM_CRAP}", "useCDN": "false", "protocolUseSSL": "true", "allowOrigin": "['localhost']", "allowFreeURL": "true", "forbiddenNoteIDs": "['robots.txt']", "imageUploadType": "filesystem", "db": { "username": "${DB_USER}", "password": "${DB_USER_PASSWORD}", "database": "${DB}", "host": "localhost", "port": "3306", "dialect": "mysql" },       "csp": { "enable": "true", "directives": { "scriptSrc": "${FQDN}" },           "upgradeInsecureRequests": "auto", "addDefaults": "true" }  } } var path = require('path'); module.exports = { 'config':         path.resolve('config.json'), 'migrations-path': path.resolve('lib', 'migrations'), 'models-path':    path.resolve('lib', 'models'), 'url':            'mysql://${DB_USER}:${DB_USER_PASSWORD}@localhost:3306/${DB}' } npm run build node_modules/.bin/sequelize db:migrate server { listen 443; server_name subdomain.domain.yolo; access_log /var/log/nginx/subdomain.domain.yolo-access.log; error_log /var/log/nginx/subdomain.domain.yolo-error.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_http_version 1.1; proxy_pass http://localhost:3000; proxy_cache_bypass $http_upgrade; proxy_redirect off; } }
 * get latest CodiMD stable release from https://github.com/hackmdio/codimd/releases (1.2.1 at time of writing)
 * give it a place to stay if you like...
 * Edit
 * You can fill the config as such:
 * : your absolute domain name, ie subdomain.domain.yolo
 * : for instance
 * ,,  : info from the MySQL db and user you created for this app
 * Edit  with the relevant MySQL info, again.
 * Build
 * prepare database:
 * Make a site entry for you NGINX config, something along those lines:
 * Done!

Testing from the shell
(Or running from / ) su pooruser -s /bin/sh NODE_ENV="production" CMD_USECDN="false" CMD_ALLOW_GRAVATAR="false" node app.js
 * su as your limited rights user:
 * start CodiMD like this:

As a systemd service
TODO