Pad Thing with CodiMD

From Run Your Own
Revision as of 15:15, 25 February 2019 by 320x200 (talk | contribs) (Installation and Configuration)
Jump to: navigation, search

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

Prerequisites

Installation and Configuration

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 instance cat /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 .sequelizerc with 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