2015-09-27 06:45:21 +00:00
HackMD 0.3.3
2015-05-04 07:53:29 +00:00
===
2015-08-15 04:15:42 +00:00
[![Join the chat at https://gitter.im/hackmdio/hackmd ](https://badges.gitter.im/Join%20Chat.svg )](https://gitter.im/hackmdio/hackmd?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
2015-07-01 16:15:34 +00:00
HackMD is a realtime collaborative markdown notes on all platforms.
Inspired by Hackpad, but more focusing on speed and flexibility.
2015-07-01 16:10:20 +00:00
Still in early stage, feel free to fork or contribute to this.
2015-05-04 07:53:29 +00:00
2015-06-01 10:04:25 +00:00
Thanks for your using! :smile:
2015-05-15 04:58:13 +00:00
2015-09-27 06:45:21 +00:00
Prerequisite
2015-07-11 04:52:04 +00:00
---
2015-09-27 06:45:21 +00:00
- Node.js 0.10.x or up (not test in version 4)
- PostgreSQL 9.3.x or 9.4.x
- MongoDB 3.0.x
2015-07-11 04:52:04 +00:00
2015-09-27 06:45:21 +00:00
Get started
2015-06-01 10:04:25 +00:00
---
2015-09-27 06:45:21 +00:00
1. Download a release and unzip or clone into a directory
2. Enter the directory and type `npm install` , will install all the dependencies
3. Install PostgreSQL and MongoDB (yes, currently we need both)
4. Import database schema, see more on below
5. Setup the configs, see more on below
6. Setup environment variables, which will overwrite the configs
7. Run the server as you like (node, forever, pm2)
2015-06-01 10:04:25 +00:00
2015-07-01 16:10:20 +00:00
Import database schema
2015-06-01 10:04:25 +00:00
---
2015-07-01 16:15:34 +00:00
The notes are store in PostgreSQL, the schema is in the `hackmd_schema.sql`
2015-06-01 10:04:25 +00:00
To import the sql file in PostgreSQL, type `psql -i hackmd_schema.sql`
2015-07-01 16:10:20 +00:00
The users, temps and sessions are store in MongoDB, which don't need schema, so just make sure you have the correct connection string.
2015-06-01 10:04:25 +00:00
2015-07-01 16:10:20 +00:00
Structure
---
```
hackmd/
├── tmp/ --- temporary files
├── lib/ --- server libraries
└── public/ --- client files
├── css/ --- css styles
├── js/ --- js scripts
├── vendor/ --- vendor includes
└── views/ --- view templates
```
2015-09-15 08:49:23 +00:00
Configuration files
2015-06-01 10:04:25 +00:00
---
2015-05-15 04:58:13 +00:00
There are some config you need to change in below files
```
2015-07-01 16:10:20 +00:00
./config.js --- for server settings
2015-09-15 08:49:23 +00:00
./public/js/index.js --- for client settings
2015-05-15 04:58:13 +00:00
```
2015-09-15 08:08:50 +00:00
Client-side index.js settings
---
| variables | example values | description |
| --------- | ------ | ----------- |
| debug | `true` or `false` | set debug mode, show more logs |
| version | `0.3.2` | current version, must match same var in server side `config.js` |
Environment variables
---
| variables | example values | description |
| --------- | ------ | ----------- |
| NODE_ENV | `production` or `development` | show current environment status |
2015-09-25 02:39:09 +00:00
| DATABASE_URL | `postgresql://user:pass@host:port/hackmd` | PostgreSQL connection string |
| MONGOLAB_URI | `mongodb://user:pass@host:port/hackmd` | MongoDB connection string |
2015-09-15 08:08:50 +00:00
| PORT | `80` | web port |
| SSLPORT | `443` | ssl web port |
| DOMAIN | `localhost` | domain name |
Server-side config.js settings
---
| variables | example values | description |
| --------- | ------ | ----------- |
| testport | `3000` | debug web port, fallback to this when not set in environment |
| testsslport | `3001` | debug web ssl port, fallback to this when not set in environment |
| usessl | `true` or `false` | set to use ssl |
| urladdport | `true` or `false` | set to add port on oauth callback url |
| debug | `true` or `false` | set debug mode, show more logs |
2015-09-22 04:06:13 +00:00
| usecdn | `true` or `false` | set to use CDN resources or not |
2015-09-15 08:08:50 +00:00
| version | `0.3.2` | currnet version, must match same var in client side `index.js` |
| alloworigin | `['localhost']` | domain name whitelist |
| sslkeypath | `./cert/client.key` | ssl key path |
| sslcertpath | `./cert/hackmd_io.crt` | ssl cert path |
| sslcapath | `['./cert/COMODORSAAddTrustCA.crt']` | ssl ca chain |
| tmppath | `./tmp/` | temp file path |
2015-09-25 02:39:09 +00:00
| postgresqlstring | `postgresql://user:pass@host:port/hackmd` | PostgreSQL connection string, fallback to this when not set in environment |
| mongodbstring | `mongodb://user:pass@host:port/hackmd` | MongoDB connection string, fallback to this when not set in environment |
2015-09-15 08:08:50 +00:00
| sessionname | `connect.sid` | cookie session name |
| sessionsecret | `secret` | cookie session secret |
| sessionlife | `14 * 24 * 60 * 60 * 1000` | cookie session life |
| sessiontouch | `1 * 3600` | cookie session touch |
| heartbeatinterval | `5000` | socket.io heartbeat interval |
| heartbeattimeout | `10000` | socket.io heartbeat timeout |
| documentmaxlength | `100000` | note max length |
| facebook, twitter, github, dropbox, imgur | multiple values | your own api keys, see source code for details |
2015-09-15 08:49:23 +00:00
Operational Transformation
2015-06-01 10:04:25 +00:00
---
2015-09-15 08:49:23 +00:00
From 0.3.2, we start support operational transformation.
Which make concurrent editing safe and not break up other users' operations.
Even more, now can show other clients' selections.
See more at http://operational-transformation.github.io/
2015-05-08 03:52:30 +00:00
2015-09-25 02:39:09 +00:00
**License under MIT.**