Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c7dfc8d
change paths to conform a bit more to other cloudron apps
fbartels Jun 1, 2018
239ff77
update to latest hackmd release
fbartels Jun 1, 2018
7368296
update changelog
fbartels Jun 1, 2018
d187ffb
added partial config file to set tmp directory and ldap username
Jun 4, 2018
4b88e0a
merge pr from @jeau and update changelog
fbartels Jun 5, 2018
48f6727
update todo
fbartels Jun 5, 2018
caf4af5
properly format config.json
fbartels Jun 6, 2018
8c49348
remove usernamefield from config.json (already set in start.sh)
fbartels Jun 6, 2018
06b982c
disable pdf export until https://github.com/hackmdio/hackmd/issues/82…
fbartels Jun 7, 2018
50263a0
update changelog
fbartels Jun 7, 2018
5dce257
switch default visibility to private for new notes
fbartels Jun 8, 2018
70e3eec
set more sharing options as suggested in https://github.com/fbartels/…
fbartels Jun 10, 2018
074916f
update changelog
fbartels Jun 10, 2018
15e05d7
update todo
fbartels Jun 10, 2018
3915862
some path cleanups (prefer absolute over relative paths)
fbartels Jun 11, 2018
d4dad2c
update todo
fbartels Jun 11, 2018
fa2260a
generate a per installation unique sessionsecret (to persist sessions…
fbartels Jun 12, 2018
b1b86a9
switch tmppath back to a relative one
fbartels Jun 12, 2018
b78e170
update changelog
fbartels Jun 13, 2018
dc6e935
Set 'x' bit in the repo instead
gramakri Jun 21, 2018
ac1938a
Update nodejs to 8.11.3
gramakri Jun 21, 2018
f98481d
Add MIT license
gramakri Jun 21, 2018
f0f7ab9
Add README
gramakri Jun 21, 2018
ffdef25
Fix id of application
gramakri Jun 21, 2018
3304cf6
Update DESCRIPTION
gramakri Jun 21, 2018
1253af8
Remove multiple steps to reduce docker image size
gramakri Jun 21, 2018
26caf27
Fixup minor bash script issues
gramakri Jun 21, 2018
e440e1f
build should not be in data directory
gramakri Jun 21, 2018
496e000
Fix tmp path
gramakri Jun 21, 2018
2c59c05
Move customizable settings to config.json
gramakri Jun 21, 2018
f4c444b
generate sequelizerc to run db migrations
gramakri Jun 21, 2018
2e7639d
Set useSsl flag for resources to load correctly
gramakri Jun 21, 2018
46e0fd1
Add ignore files
gramakri Jun 21, 2018
5e0cbe9
Add tests
gramakri Jun 21, 2018
6c12cb1
Allow login via email
gramakri Jun 21, 2018
f41873c
Version 0.1.0
gramakri Jun 21, 2018
c4aa7f2
Fix screenshot link
gramakri Jun 21, 2018
1a94e37
Add documentationUrl
gramakri Jun 21, 2018
c738c3f
Version 0.2.0
gramakri Jun 21, 2018
1dc38d6
update to codimd 1.2.0 and update references from hackmd to codimd
fbartels Jul 1, 2018
26964c1
allowAnonymousEdits should be set to true
fbartels Jul 3, 2018
7eb9428
forgot to update version in description
fbartels Jul 6, 2018
d93da0d
Add notes to tags
gramakri Aug 6, 2018
f91bae2
update to 1.2.1 upstream
fbartels Oct 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.gitignore
.dockerignore
test
CloudronManifest.json
README.md
DESCRIPTION.md
screenshots/*

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/

15 changes: 11 additions & 4 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[0.0.2]
minor bugfix
[0.1.0]
* Initial version
* Made possible by @dictcp, @felix and @jeau

[0.0.1]
initial release
[0.2.0]
* Update screenshot and add documentation link

[0.3.0]
* HackMD is now called CodiMD

[0.3.1]
* Update to CodiMD 1.2.1
18 changes: 11 additions & 7 deletions CloudronManifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"id": "io.hackmd",
"title": "HackMD",
"author": "HackMD authors",
"id": "io.hackmd.cloudronapp",
"title": "CodiMD",
"author": "CodiMD authors",
"description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG",
"tagline": "Best way to write and share your knowledge in markdown",
"version": "0.0.2",
"version": "0.3.1",
"healthCheckPath": "/status",
"httpPort": 3000,
"addons": {
Expand All @@ -14,15 +14,19 @@
"ldap": {}
},
"manifestVersion": 1,
"website": "https://hackmd.io",
"website": "https://hackmd-ce.herokuapp.com/",
"contactEmail": "support@cloudron.io",
"icon": "logo.png",
"tags": [
"markdown",
"wiki",
"document",
"collaboration"
"collaboration",
"notes"
],
"mediaLinks": [ "https://hackmd.io/screenshot.png" ]
"mediaLinks": [
"https://s3.amazonaws.com/cloudron-app-screenshots/io.hackmd.cloudronapp/f41873c2e6538e0d246d7ad7111a4b4e8df15a5a/screenshot.png"
],
"documentationUrl": "https://cloudron.io/documentation/apps/hackmd/"
}

18 changes: 14 additions & 4 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
This app packages HackMD 0.5.2-snapshot (d1d6d58)
This app packages CodiMD <upstream>1.2.1</upstream>

HackMD lets you create realtime collaborative markdown notes on all
platforms.
Inspired by Hackpad, with more focus on speed and flexibility.
CodiMD lets you create realtime collaborative markdown notes on all
platforms. Inspired by Hackpad, with more focus on speed and flexibility.

## Features

* Documentation Collaborated
* Context Captured
* Native Markdown
* Knowledge Net
* Technical Sharing and Presentation
* Turn Notes into Slides
* Better Conference Experience
* Questions Polling

42 changes: 23 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
FROM cloudron/base:0.10.0
# install jq and moreutils (for sponge).
# can be removed once https://git.cloudron.io/cloudron/docker-base-image/merge_requests/3 is merged and released
RUN apt update && \
apt -y install moreutils jq && \
rm -rf /var/cache/apt /var/lib/apt/lists

# setup nodejs version
ENV NODEJS_VERSION 6.9.5
RUN ln -s /usr/local/node-$NODEJS_VERSION/bin/node /usr/local/bin/node && \
ln -s /usr/local/node-$NODEJS_VERSION/bin/npm /usr/local/bin/npm
RUN mkdir -p /usr/local/node-8.11.3
RUN curl -L https://nodejs.org/download/release/v8.11.3/node-v8.11.3-linux-x64.tar.gz | tar zxf - --strip-components 1 -C /usr/local/node-8.11.3
ENV PATH /usr/local/node-8.11.3/bin:$PATH

WORKDIR /hackmd
WORKDIR /app/code

ENV HACKMD_VERSION d1d6d5810b12645ddb02275ce0c2498b2189a8a0
RUN curl -L https://github.com/hackmdio/hackmd/archive/$HACKMD_VERSION.tar.gz | tar -xz --strip-components 1 -f -
ENV HACKMD_VERSION 1.2.1
RUN curl -L https://github.com/hackmdio/codimd/archive/$HACKMD_VERSION.tar.gz | tar -xz --strip-components 1 -f -

# npm, deps
RUN npm install
RUN npm install && npm run build

# build front-end bundle
RUN npm run build

# remove dev dependencies
RUN npm prune --production
# generate sequelizerrc
RUN sed -e "s/'change this'/process.env.POSTGRESQL_URL/" /app/code/.sequelizerc.example > /app/code/.sequelizerc

# add utils
ADD CloudronManifest.json ./
ADD start.sh ./
RUN chmod +x ./start.sh
ADD start.sh /app/code

# constant.js is generated on startup and "require"d by the code
RUN ln -sfn /run/hackmd/constant.js /app/code/public/build/constant.js && \
rm -rf /app/code/public/uploads && ln -sf /app/data/uploads /app/code/public/uploads

# use local storage
RUN ln -sfn /app/data/build/constant.js ./public/build/constant.js && \
rm -rf ./public/uploads && ln -sf /app/data/uploads ./public/uploads
# add user definable config
ADD config.json /app/code/config.json-cloudron
RUN ln -sfn /app/data/config.json /app/code/config.json

EXPOSE 3000

CMD ["/hackmd/start.sh"]
CMD ["/app/code/start.sh"]
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# HackMD Cloudron App

This repository contains the Cloudron app package source for [HackMD](https://hackmd.io/).

## Installation

[![Install](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=io.hackmd.cloudronapp)

or using the [Cloudron command line tooling](https://cloudron.io/references/cli.html)

```
cloudron install --appstore-id io.hackmd.cloudronapp
```

## Building

The app package can be built using the [Cloudron command line tooling](https://cloudron.io/references/cli.html).

```
cd hackmd-app

cloudron build
cloudron install
```

## Testing

The e2e tests are located in the `test/` folder and require [nodejs](http://nodejs.org/). They are creating a fresh build, install the app on your Cloudron, backup and restore.

```
cd hackmd-app/test

npm install
USERNAME=<cloudron username> PASSWORD=<cloudron password> mocha --bail test.js
```

3 changes: 3 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO list

- merge cloudron docker image with upstream source from https://github.com/hackmdio/docker-hackmd
12 changes: 12 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"production": {
"allowAnonymous": false,
"allowAnonymousEdits": true,
"allowEmailRegister": false,
"allowFreeUrl": true,
"allowPdfExport": false,
"debug": false,
"defaultPermission": "private",
"email": false
}
}
42 changes: 28 additions & 14 deletions start.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
#!/bin/bash

set -eu

# prepare data directory
mkdir -p /app/data/build && \
mkdir -p /app/data/uploads
chown -R cloudron:cloudron /app/data
mkdir -p /app/data/uploads /tmp/hackmd /run/hackmd

if [ -f .sequelizerc ];
then
node_modules/.bin/sequelize db:migrate
if [ ! -e /app/data/config.json ]; then
echo "Creating initial template on first run"
cp /app/code/config.json-cloudron /app/data/config.json
fi

# wait for db up
sleep 3
# generate and store an unique sessionSecret for this installation
CONFIG_JSON=/app/data/config.json
if [ $(jq .production.sessionSecret $CONFIG_JSON) == "null" ]; then
echo "generating sessionSecret"
sessionsecret=$(pwgen -1sc 32)
jq ".production.sessionSecret = \"$sessionsecret\"" $CONFIG_JSON | sponge $CONFIG_JSON
fi

export NODE_ENV='production'
export HMD_ALLOW_ANONYMOUS="false"
# these cannot be changed by user (https://github.com/hackmdio/hackmd/wiki/Environment-Variables)
export HMD_DOMAIN="$APP_DOMAIN"
export HMD_PROTOCOL_USESSL=true
export HMD_DB_URL="$POSTGRESQL_URL"
export HMD_LDAP_URL="$LDAP_URL"
export HMD_LDAP_BINDDN="$LDAP_BIND_DN"
export HMD_LDAP_BINDCREDENTIALS="$LDAP_BIND_PASSWORD"
export HMD_LDAP_SEARCHBASE="$LDAP_USERS_BASE_DN"
export HMD_LDAP_SEARCHFILTER="(username={{username}})"
export HMD_EMAIL=false
export HMD_ALLOW_EMAIL_REGISTER=false
export HMD_LDAP_SEARCHFILTER="(|(username={{username}})(mail={{username}}))"
export HMD_LDAP_USERNAMEFIELD="username"
export HMD_PORT=3000
export HMD_IMAGE_UPLOAD_TYPE=filesystem
export HMD_TMP_PATH=/tmp/hackmd

echo "Running db migrations"
node_modules/.bin/sequelize db:migrate

chown -R cloudron:cloudron /app/data /tmp/hackmd /run/hackmd

# run
/usr/local/bin/gosu cloudron:cloudron node app.js
export NODE_ENV=production
exec /usr/local/bin/gosu cloudron:cloudron node app.js

24 changes: 24 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ejs": "^2.3.4",
"expect.js": "^0.3.1",
"mkdirp": "^0.5.1",
"mocha": "^2.3.4",
"rimraf": "^2.4.4",
"selenium-server-standalone-jar": "^2.53.0",
"selenium-webdriver": "^2.53.3",
"superagent": "^1.4.0"
},
"dependencies": {
"chromedriver": "^2.37.0"
}
}
Loading