Skip to content

Commit a7f93ce

Browse files
committed
Move the documentation to the website
1 parent f7f8143 commit a7f93ce

13 files changed

Lines changed: 335 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ jobs:
1515
with:
1616
fetch-depth: 0 # Hugo uses Git information to fetch .Lastmod information (enableGitInfo).
1717

18+
- name: Setup Python 3.x
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.x
22+
23+
- name: Install Python dependencies
24+
run: pip install -r requirements.txt
25+
1826
- name: Build
1927
run: make build
2028

.gitignore

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,143 @@ dist
117117
# Stores VSCode versions used for testing VSCode extensions
118118
.vscode-test
119119

120+
### Python
121+
# Byte-compiled / optimized / DLL files
122+
__pycache__/
123+
*.py[cod]
124+
*$py.class
125+
126+
# C extensions
127+
*.so
128+
129+
# Distribution / packaging
130+
.Python
131+
build/
132+
develop-eggs/
133+
dist/
134+
downloads/
135+
eggs/
136+
.eggs/
137+
lib/
138+
lib64/
139+
parts/
140+
sdist/
141+
var/
142+
wheels/
143+
share/python-wheels/
144+
*.egg-info/
145+
.installed.cfg
146+
*.egg
147+
MANIFEST
148+
149+
# PyInstaller
150+
# Usually these files are written by a python script from a template
151+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
152+
*.manifest
153+
*.spec
154+
155+
# Installer logs
156+
pip-log.txt
157+
pip-delete-this-directory.txt
158+
159+
# Unit test / coverage reports
160+
htmlcov/
161+
.tox/
162+
.nox/
163+
.coverage
164+
.coverage.*
165+
.cache
166+
nosetests.xml
167+
coverage.xml
168+
*.cover
169+
*.py,cover
170+
.hypothesis/
171+
.pytest_cache/
172+
cover/
173+
174+
# Translations
175+
*.mo
176+
*.pot
177+
178+
# Django stuff:
179+
*.log
180+
local_settings.py
181+
db.sqlite3
182+
db.sqlite3-journal
183+
184+
# Flask stuff:
185+
instance/
186+
.webassets-cache
187+
188+
# Scrapy stuff:
189+
.scrapy
190+
191+
# Sphinx documentation
192+
docs/_build/
193+
194+
# PyBuilder
195+
.pybuilder/
196+
target/
197+
198+
# Jupyter Notebook
199+
.ipynb_checkpoints
200+
201+
# IPython
202+
profile_default/
203+
ipython_config.py
204+
205+
# pyenv
206+
# For a library or package, you might want to ignore these files since the code is
207+
# intended to run in multiple environments; otherwise, check them in:
208+
# .python-version
209+
210+
# pipenv
211+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
212+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
213+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
214+
# install all needed dependencies.
215+
#Pipfile.lock
216+
217+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
218+
__pypackages__/
219+
220+
# Celery stuff
221+
celerybeat-schedule
222+
celerybeat.pid
223+
224+
# SageMath parsed files
225+
*.sage.py
226+
227+
# Environments
228+
.env
229+
.venv
230+
env/
231+
venv/
232+
ENV/
233+
env.bak/
234+
venv.bak/
235+
236+
# Spyder project settings
237+
.spyderproject
238+
.spyproject
239+
240+
# Rope project settings
241+
.ropeproject
242+
243+
# mkdocs documentation
244+
/site
245+
246+
# mypy
247+
.mypy_cache/
248+
.dmypy.json
249+
dmypy.json
250+
251+
# Pyre type checker
252+
.pyre/
253+
254+
# pytype static type analyzer
255+
.pytype/
256+
257+
# Cython debug symbols
258+
cython_debug/
259+

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dependencies:
1010
.PHONY: build
1111
build: dependencies
1212
./hugo --minify
13+
cd docs && make build
14+
mv ./docs/site ./public/docs
1315
# If we run using Docker, we should reset file ownership afterwards.
1416
ifneq (,$(findstring docker,${ENGINE_COMMAND}))
1517
sudo chown -R ${shell id -u ${USER}}:${shell id -g ${USER}} ./public/

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
site/

docs/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: all
2+
all: build
3+
4+
.PHONY: build
5+
build:
6+
mkdocs build
7+
8+
.PHONY: server
9+
server:
10+
mkdocs serve
11+
12+
.PHONY: clean
13+
clean:
14+
rm -rf ./site/

docs/docs/assets/favicon.ico

14.7 KB
Binary file not shown.

docs/docs/assets/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/docs/developer-guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Developer Guide
2+
3+
_This site is under construction._

docs/docs/index.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Getting Started
2+
3+
## Installation
4+
5+
PushBits is meant to be self-hosted.
6+
That means you have to install it on your own server.
7+
You are advised to install PushBits behind a reverse proxy and enable TLS.
8+
9+
Currently, the only supported way of installing PushBits is via [Docker](https://www.docker.com/) or [Podman](https://podman.io/).
10+
The image is hosted [via ghcr.io](https://github.com/pushbits/server/pkgs/container/server).
11+
12+
## Configuration
13+
14+
To see what can be configured, have a look at the [config.sample.yml](https://github.com/pushbits/server/blob/master/config.example.yml) file inside the root of the repository.
15+
16+
Settings can optionally be provided via environment variables.
17+
The name of the environment variable is composed of a starting `PUSHBITS_`, followed by the keys of the setting, all
18+
joined with `_`.
19+
As an example, the HTTP port can be provided as an environment variable called `PUSHBITS_HTTP_PORT`.
20+
21+
To get started, here is a Docker Compose file you can use.
22+
```yaml
23+
version: '2'
24+
25+
services:
26+
server:
27+
image: ghcr.io/pushbits/server:latest
28+
ports:
29+
- 8080:8080
30+
environment:
31+
PUSHBITS_DATABASE_DIALECT: 'sqlite3'
32+
PUSHBITS_ADMIN_MATRIXID: '@your/matrix/username:matrix.org' # The Matrix account on which the admin will receive their notifications.
33+
PUSHBITS_ADMIN_PASSWORD: 'your/pushbits/password' # The login password of the admin account. Default username is 'admin'.
34+
PUSHBITS_MATRIX_USERNAME: 'your/matrix/username' # The Matrix account from which notifications are sent to all users.
35+
PUSHBITS_MATRIX_PASSWORD: 'your/matrix/password' # The password of the above account.
36+
volumes:
37+
- /etc/localtime:/etc/localtime:ro
38+
- /etc/timezone:/etc/timezone:ro
39+
- ./data:/data
40+
```
41+
42+
In this example, the configuration file would be located at `./data/config.yml` on the host.
43+
The SQLite database would be written to `./data/pushbits.db`.
44+
**Don't forget to adjust the permissions** of the `./data` directory, otherwise PushBits will fail to operate.
45+
46+
## Usage
47+
48+
We provide [a little CLI tool called pbcli](https://github.com/PushBits/cli) to make basic API requests to the server.
49+
It helps you to create new users and applications.
50+
You will find further instructions in the linked repository.
51+
52+
At the time of writing, there is no fancy GUI built-in, and we're not sure if this is necessary at all.
53+
Currently, we would like to avoid front end development, so if you want to contribute in this regard we're happy if you reach out!
54+
55+
After you have created a user and an application, you can use the API to send a push notification to your Matrix account.
56+
57+
```bash
58+
curl \
59+
--header "Content-Type: application/json" \
60+
--request POST \
61+
--data '{"message":"my message","title":"my title"}' \
62+
"https://pushbits.example.com/message?token=$PB_TOKEN"
63+
```
64+
65+
Note that the token is associated with your application and has to be kept secret.
66+
You can retrieve the token using [pbcli](https://github.com/PushBits/cli) by running following command.
67+
68+
```bash
69+
pbcli application show $PB_APPLICATION --url https://pushbits.example.com --username $PB_USERNAME
70+
```
71+
72+
### Message options
73+
74+
Messages can be specified in three different syntaxes:
75+
76+
* `text/plain`
77+
* `text/html`
78+
* `text/markdown`
79+
80+
To set a specific syntax you need to set the `extras` parameter ([inspired by Gotify's message extras](https://gotify.net/docs/msgextras#clientdisplay)):
81+
82+
```bash
83+
curl \
84+
--header "Content-Type: application/json" \
85+
--request POST \
86+
--data '{"message":"my message with\n\n**Markdown** _support_.","title":"my title","extras":{"client::display":{"contentType": "text/markdown"}}}' \
87+
"https://pushbits.example.com/message?token=$PB_TOKEN"
88+
```
89+
90+
HTML content might not be fully rendered in your Matrix client; see the corresponding [Matrix specs](https://spec.matrix.org/unstable/client-server-api/#mroommessage-msgtypes).
91+
This also holds for Markdown, as it is translated into the corresponding HTML syntax.
92+
93+
### Deleting a Message
94+
95+
You can delete a message, this will send a notification in response to the original message informing you that the message is "deleted".
96+
97+
To delete a message, you need its message ID which is provided as part of the response when you send the message.
98+
The ID might contain characters not valid in URIs.
99+
We hence provide an additional `id_url_encoded` field for messages; you can directly use it when deleting a message without performing encoding yourself.
100+
101+
```bash
102+
curl \
103+
--request DELETE \
104+
"https://pushbits.example.com/message/${MESSAGE_ID}?token=$PB_TOKEN"
105+
```

docs/docs/user-guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# User Guide
2+
3+
_This site is under construction._

0 commit comments

Comments
 (0)