mmmWiki setup mysql

Setting up mmmWiki

DISCLAIMER: The software is offered as is.

Requirements:

To run the software locally / digitalocean.com

Risk of getting stuck
/ making an error
Action
Medium Install Node.js (Google it (Personally I install nvm, then select the latest version of node.js))
Risky Install MySQL or MariaDB. (MariaDB seem to support TLS which MySql doesn't. On the other hand MySQL Workbench says they might not support MariaDB. Personally I use MariaDB.)
Medium Install Redis (they have pretty good "quick start"-instructions (ref))
Small Download the files: git (use the mysql branch)
Medium In the extracted folder: Run npm install. (This will download the required packages ).
Medium Create a file config.js (for example by copying and editing config.example.js). Read the comments (follow the instructions) of the file. config.example.js
Small execute node script --sql createTable

execute node script --sql createView

execute node script --sql createFunction

Small Create a site.csv-file. This should be placed in the directory ../mmmWikiBU/ (parallell to the mmmWiki directory)

Examples of a site.csv file:

"boDefault","boTLS","urlIcon16","urlIcon200","googleAnalyticsTrackingID","aPassword","vPassword","name","www"
false,true,"lib/image/Icon/iconRed16.png","lib/image/Icon/iconRed200.png","UA-12345678-2","","","gav","gavott.com"
true,true,"lib/image/Icon/iconRed16.png","lib/image/Icon/iconRed200.png","UA-12345678-3","","","emag","emagnusandersson.com"
... or if you are testing locally:
"boDefault","boTLS","urlIcon16","urlIcon200","googleAnalyticsTrackingID","aPassword","vPassword","name","www"
true,false,"lib/image/Icon/iconRed16.png","lib/image/Icon/iconRed200.png","","","","emag","localhost:5000"
false,false,"lib/image/Icon/iconRed16.png","lib/image/Icon/iconRed200.png","","","","gav","192.168.0.7:5000"
The top line consists of property names. Then the following lines consists of property values of resp site.

One and only one row should have boDefault=true.

The "aPassword" and "vPassword"-variables aren't used so those can be left empty. (There are "aPassword" and "vPassword"-variables in the config.js-file however.)

Small execute node script --loadFrBU site.csv

(This will load the site.csv-file created above.)

Check below if you want to undo it.

Small Start the app (By executing node script.js for example)

In production you might want the app to start it automatically at reboot and after crash. To do this I personally use the pm2.

Starting with a backup

Follow the instructions above.

Instead of executing "node script --loadFrBU site.csv", execute:

node script --loadFrBU (this will load all the files that constitute the backup: site.csv, page.zip, image.zip, page.csv, image.csv, redirect.csv)

Delete everything from the databases

Ex 1 (delete everything):
node script --sql dropFunction (drops all functions)
node script --sql dropView (drops all views)
node script --sql dropTable (drops all tables)
Ex 2:
node script --sql truncate (This command empties all the database tables (But the tables are still there (as well as views and functions)))
See node script --help for more options.

TLS (SSL (https))

This is a story of its own.

I'm currently using nginx as a proxy which is able to handle TLS.

I'm using letsencrypt as certificate authority.

See also