Skip to content

Commit 1e23892

Browse files
committed
add setup docs
1 parent e61d10e commit 1e23892

File tree

11 files changed

+255
-105
lines changed

11 files changed

+255
-105
lines changed

.github/workflows/site.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy Site
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "site/**"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
submodules: true
27+
- name: Setup Hugo
28+
uses: peaceiris/actions-hugo@v2
29+
with:
30+
hugo-version: 'latest'
31+
extended: true
32+
- name: Setup Pages
33+
id: pages
34+
uses: actions/configure-pages@v3
35+
- name: Build With Hugo
36+
working-directory: site
37+
run: hugo --minify
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v2
40+
with:
41+
path: ./site/public
42+
43+
deploy:
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v2

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77

88
Note Mark is a lighting fast and minimal; web-based Markdown notes app. Featuring a sleek and responsive web UI.
99

10-
> If you are looking for V0.5.0, navigate to before-0.6.0
11-
1210
> Project currently in **"ALPHA"** stage of development:
1311
1412
## Docs
15-
Documentation is still a WIP, however you can view it here: [/docs](docs)
13+
Documentation is still a WIP, however you can view it here: [notemark.docs.enchantedcode.co.uk](https://notemark.docs.enchantedcode.co.uk/).
1614

1715
> Checkout [here](https://github.com/enchant97/note-mark/issues/47) for the roadmap.
1816

site/content/_index.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Welcome
3+
---
4+
Note Mark is a lighting fast and minimal; web-based Markdown notes app. Featuring a sleek and responsive web UI.
5+
6+
- [Setup Guide]({{< ref "docs/setup/install">}})
7+
- [User Guide]({{< ref "docs/usage">}})
8+
9+
## Features
10+
- Markdown (GitHub Flavored Markdown, see spec [here](https://github.github.com/gfm/))
11+
- HTML sanitisation, minimizing XSS attacks
12+
- Mobile Friendly
13+
- Friendly "Slug" based URLs for cleaner links
14+
- Dark & Light Theme
15+
- Notebook Sharing
16+
- Custom flat-file based storage system (easy to backup and synchronize)
17+
- Multiple views for a note (rendered, plain)
18+
- Editor with shortcuts
19+
20+
### Future
21+
- revision history
22+
- S3 storage backend
23+
- Ability to upload assets (e.g. images)
24+
- Offline functionality
25+
- Live synchronization
26+
- A CLI app/daemon (bring your own editor)
27+
28+
### Not Implementing
29+
- Unlimited nesting of notebooks/notes
30+
- Encrypted end-to-end notes
31+
- Any-other note type apart from markdown
32+
- WYSIWYG editor

site/content/docs/deploy.md

-101
This file was deleted.

site/content/docs/setup/_index.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: Setup
3+
---

site/content/docs/setup/backup.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: What To Backup
3+
---
4+
To avoid data-loss it is important for you to backup your application data.
5+
6+
The markdown files are stored in the apps data location which will also include the database if you decided to use sqlite. If you used a database server (PostgreSQL and MariaDB) you will need to perform a database dump. This is important as metadata and user details are stored there.
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: 02 - Configuration
3+
---
4+
Configuration of the backend is done through environment variables. See the below options:
5+
6+
| Key | Description | Default | Docker Default |
7+
|:------------ |:----------------------------------------- |:----------|:--------------- |
8+
| BIND__HOST | What ip to listen on | 127.0.0.1 | 0.0.0.0 |
9+
| BIND__PORT | Port to bind to | 8000 | 8000 |
10+
| DB__TYPE | Type of DB (sqlite, mariadb, postgres) | | sqlite |
11+
| DB__URI | URI (or file path if using SQLite) | | /data/db.sqlite |
12+
| JWT_SECRET | base64 encoded secret | | |
13+
| TOKEN_EXPIRY | seconds until a token expires | 259200 | 259200 |
14+
| DATA_PATH | Where to store app data | | /data |
15+
| CORS_ORIGINS | Comma separated values of allowed origins | | |
16+
| ALLOW_SIGNUP | Whether to enable new accounts | true | true |
17+
18+
> *TIP* A secret can be generated using: `openssl rand -base64 32`
19+
20+
## Database URI
21+
These have been copied from the ORM, more info found [here](https://gorm.io/docs/connecting_to_the_database.html).
22+
23+
sqlite:
24+
25+
```text
26+
/path/to/db.sqlite
27+
```
28+
29+
mariadb:
30+
31+
```text
32+
user:pass@tcp(127.0.0.1:3306)/notemark?charset=utf8mb4&parseTime=True&loc=Local
33+
```
34+
35+
postgres:
36+
37+
```text
38+
host=localhost user=user password=pass dbname=notemark port=5432 sslmode=disable TimeZone=Europe/London
39+
```

site/content/docs/setup/install.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: 01 - Install
3+
---
4+
5+
## Docker (Official)
6+
Both the backend and frontend are distributed by as Docker images, making deployment easier.
7+
8+
Below are the image names:
9+
10+
```text
11+
ghcr.io/enchant97/note-mark-backend
12+
13+
ghcr.io/enchant97/note-mark-frontend
14+
```
15+
16+
The following labels are available:
17+
18+
> *TIP* Image labels follow Semantic Versioning
19+
20+
```text
21+
<major>
22+
23+
<major>.<minor>
24+
25+
<major>.<minor>.<patch>
26+
```
27+
28+
Deploying both apps can be done using Docker Compose, shown below:
29+
30+
> *TIP* Using a reverse proxy can allow you to have the app on a single domain & port
31+
32+
```yaml
33+
# file: docker-compose.yml
34+
version: "3"
35+
36+
volumes:
37+
data:
38+
39+
services:
40+
backend:
41+
image: ghcr.io/enchant97/note-mark-backend:0.6.
42+
restart: unless-stopped
43+
volumes:
44+
- data:/data
45+
environment:
46+
# !!! REPLACE These !!!
47+
JWT_SECRET: "bXktc2VjcmV0"
48+
CORS_ORIGINS: "*"
49+
ports:
50+
- 8001:8000
51+
52+
frontend:
53+
image: ghcr.io/enchant97/note-mark-frontend:0.6
54+
restart: unless-stopped
55+
ports:
56+
- 8000:8080
57+
```
58+
59+
Once running you should be able to visit at 8000 and see the UI. Navigate to the login page and change the port to 8001 and append `/api`. These steps would not be required if you ran the app over the same FQDN and port (using a reverse proxy).
60+
61+
## Bare
62+
TBA
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Reverse Proxy
3+
---
4+
To run the backend and frontend over one FQDN and port can be done via a reverse proxy.
5+
6+
## Routes
7+
Depending on the request they need to be routed to either app. These are documented below:
8+
9+
Backend:
10+
11+
- `/api/*`
12+
13+
Frontend:
14+
15+
- `/*`
16+
17+
If you are not using the Docker image then all requests that are not found for the frontend routes need to navigate to the `index.html` file.
18+
19+
## Nginx - Docker
20+
This example assumes you already have the Docker Compose shown in the install section.
21+
22+
```yaml
23+
# file: docker-compose.yml
24+
proxy:
25+
image: nginx:alpine
26+
restart: unless-stopped
27+
ports:
28+
- 80:80
29+
volumes:
30+
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
31+
```
32+
33+
```properties
34+
# file: nginx.conf
35+
upstream backend {
36+
server backend:8000;
37+
}
38+
39+
upstream frontend {
40+
server frontend:8000;
41+
}
42+
43+
server {
44+
listen 80;
45+
server_name example.com;
46+
47+
location / {
48+
proxy_pass http://frontend;
49+
}
50+
51+
location /api {
52+
proxy_pass http://backend/api;
53+
}
54+
}
55+
```

site/content/docs/usage/_index.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Usage
3+
---
4+
TBA

site/hugo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
baseURL = "https://note-mark.docs.enchantedcode.co.uk/"
1+
baseURL = "https://notemark.docs.enchantedcode.co.uk/"
22
languageCode = "en"
33
title = "Note Mark"
44
copyright = "Leo Spratt"

0 commit comments

Comments
 (0)