Skip to content

Commit

Permalink
Merge pull request #26 from hacklab-fi/mdbook
Browse files Browse the repository at this point in the history
mdBook
  • Loading branch information
tswfi authored Dec 10, 2023
2 parents 09e2248 + 7585959 commit d591f5a
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 12 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy
on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@master
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build Book
run: |
mdbook build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'book'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
23 changes: 23 additions & 0 deletions .github/workflows/mdbook_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: mdBook CI
on: [push, pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install stable
rustup default stable
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir bin
curl -sSL $url | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Run tests
run: mdbook test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
6 changes: 6 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Tatu Wikman"]
language = "en"
multilingual = false
src = "src"
title = "Hacklab IT Infra documentation"
File renamed without changes.
12 changes: 12 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Summary

- [Server Admin minutes](./Server-admin-minutes.md)
- [Matrix](./matrix/general.md)
- [Discord](./matrix/discord.md)
- [Facebook](./matrix/facebook.md)
- [GMessages](./matrix/gmessages.md)
- [Hookshot](./matrix/hookshot.md)
- [Signal](./matrix/signal.md)
- [Slack](./matrix/slack.md)
- [Telegram](./matrix/telegram.md)
- [Whatsapp](./matrix/whatsapp.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions matrix/matrix-hookshot.md → src/matrix/hookshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ At the moment `webhooks`, `feeds` and `github` are supported.

bot user is `@hookshot:hacklab.fi` admins are `@tsw:hacklab.fi` and `@olmari:hacklab.fi`

command: `!hookshot help` gives you basic information of things
command: `hookshot help` gives you basic information of things

## webhooks

Invite `@hookshot:hacklab.fi` to your channel, give it `moderator` rights and ask it to add a webhook endpoint for you

```
```chat
/invite @hookshot:hacklab.fi
/op @hookshot:hacklab.fi 50
!hookshot webhook [nameforyourwebhook]
```

See the endpoint url from the admin room and send a test message to it:

```
```bash
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"username": "its a me mario", "text": "yup, message from webhook", "html": "<i>yup</i><h2>formatting</h2>"}' \
Expand All @@ -43,21 +43,21 @@ To delete a webhook

Invite `@hookshot:hacklab.fi` to your channel, give it `moderator` rights and ask it to add a webhook endpoint for you

```
```chat
/invite @hookshot:hacklab.fi
/op @hookshot:hacklab.fi 50
!hookshot feed https://example.com/feed/atom/ [nameyourfeed]
```

To list existing feeds

```
```chat
!hookshot feed list
```

And to remove a feed

```
```chat
!hookshot feed remove https://example.com/feed/atom
```

Expand All @@ -75,15 +75,15 @@ Now that the channel is bridged to the repo you can use some commands to update

Creating new issue

```
```chat
!gh create "Title text" "Description for the issue" "label1,label2"
```

You can omit the labels (but its best to always have some description)

Closing an issue

```
```chat
!gh close 3 "Yay, great job!"
```

Expand All @@ -97,7 +97,7 @@ Running on our matrix server under user `matrix-hookshot`, home directory in `/o

Requires at least Node 16 and Rust installed. Those are installed via nvm and rustup. The base requirements for those are

```
```bash
sudo apt update && sudo apt upgrade
# rustup
sudo apt install curl build-essential gcc make
Expand Down Expand Up @@ -179,7 +179,7 @@ on our server all the appservice configurations are collected in `/etc/matrix-sy

so always modify the `registration.yml` and then copy it to into `/etc/matrix-synapse/app_service_config_files/matrix-hookshot.yml`

```
```bash
sudo cp /opt/matrix-hookshot/matrix-hookshot/registration.yml /etc/matrix-synapse/app_service_config_files/matrix-hookshot.yaml
sudo chown matrix-synapse:matrix-synapse /etc/matrix-synapse/app_service_config_files/matrix-hookshot.yaml
sudo chmod 600 /etc/matrix-synapse/app_service_config_files/matrix-hookshot.yaml
Expand All @@ -191,7 +191,7 @@ And reload `matrix-synapse` after modifications.

add two new location blocks

```
```nginx
# hookshot
location /[YOUR]/ {
include snippets/matrix-proxy-headers.conf;
Expand Down Expand Up @@ -219,7 +219,7 @@ And /[YOUR]/ is something that you can choose. Values `hookshot` and `webhook` a

add unit file for this service

```
```conf
[Unit]
Description=Matrix Hookshot
After=matrix-synapse.service
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d591f5a

Please sign in to comment.