Pad Thing with CodiMD
Jump to navigation
Jump to search
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
- a user with limited rights
- SSL certs
- NGINX HTTP server
Installation and Configuration
- get latest CodiMD stable release from https://github.com/hackmdio/codimd/releases (1.2.1 at time of writing)
wget https://github.com/hackmdio/codimd/archive/1.2.1.tar.gz tar xvf 1.2.1.tar.gz
- give it a place to stay if you like...
mv codimd-1.2.1 /path/to/somewhere/codimd cd /path/to/somewhere/codimd
- Edit
config.json
{
"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"
}
}
}
- You can fill the config as such:
${FQDN}: your absolute domain name, ie subdomain.domain.yolo${RANDOM_CRAP}: for instancecat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c 32; echo${DB_USER},${DB_USER_PASSWORD},${DB}: info from the MySQL db and user you created for this app
- Edit
.sequelizercwith the relevant MySQL info, again.
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}'
}
- Build
npm run build