#import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge
#import "@preview/codly:1.0.0": *

#import "../template.typ": apply-template
#show: apply-template

#set page(height: auto)
#set text(lang: "en")

#show "rpi": "Raspberry Pi 4b"

#outline()

#pagebreak()

= Servers

#show: codly-init.with()


#import fletcher.shapes: ellipse
#figure(
  diagram(
    // debug: true,
    node-stroke: .5pt,
    node((0,0), [#rect([Servers])]),
    node((-1, 1), [Hetzner\ (`91.107.207.162`)], name: <hetzner>),
    node((1,1), [rpi\ (`192.168.0.34`)], name: <rpi>),
    edge((0,0), <hetzner>, "->"),
    edge((0,0), <rpi>, "->"),

    edge(<hetzner>, <rpi>, "<--", bend: -35deg, label: [_#link("https://www.zerotier.com/download/")[Zerotier-One]_]),
    node((-3, 1), [Public net], shape: ellipse, stroke: .5pt, name: <net>),

    edge(<hetzner>, <net>, "->", label: "Traefik")

    // node((-1, 1.75), [MailCow], width: 20mm, name: <mailcow>),
    // edge(<hetzner>, <mailcow>, "->"),
    // node((-2, 1.75), [Dashy], name: <dashy>),
    // edge(<hetzner>, <dashy>, "->"),
    // node((-1.5, 1.75), [Ntfy], name: <ntfy>),
    // edge(<hetzner>, <ntfy>, "->"),
    // node((-2.5, 1.75), [Filebrowser])
  ),
  caption: "Topology of servers"
)
My *Hetzner* server is using Ubuntu (sadly), _which I want to change later to something like Alpine_.

My *rpi* is using #link("https://dietpi.com/")[DietPi] and Docker.\
A problem that often appears when working with services on my rpi, is that it runs a `aarch64` or `arm64` architecture, where many docker-images aren't built for. 

== Ports

*Hetzner:*
#table(
  columns: (auto, auto),
  table.header([*Service*], [*Port/-range*]),
  [Mailcow], [143, 993, 110, 995, 4190, 25, 465, 587], 
  [Dashy], [8585],
  [Filebrowser], [8099],
  [Forgejo], [3000, 222],
  [HedgeDoc], [3003],
  [Keycloak], [9595],
  [Mealie], [9925],
  [MiniFlux], [8097],
  [Ntfy], [2586],
  [Redbot], [1080],
  [Seafile], [9080],
  [Stirling-PDF], [8282],
  [Syncthing], [8384, 22000],
  [Traefik], [80, 443, 8085],
  [Vaultwarden], [8082],
  [Wireguard], [51820],
)
however much is filtered to out to the public using Hetzner's inbuilt firewall service.


#pagebreak()

= List of Services

- MailCow
- Dashy
- Diun
- Filebrowser
- Forgejo
- HedgeDoc
- #text(red)[Keycloak → *not done yet*]
- Mealie
- MiniFlux
- Ntfy
- Redbot (along with muse)
- Seafile
- Stirling-PDF
- Syncthing
- Traefik
- Vaultwarden
- WireGuard


#pagebreak()

// == MailCow
== Dashy

It is configured to show all of my services although without description, _yet_, and shows wether they're up or not at the moment.

It has a user for me set-up which allows me to directly add services without having to touch any `.yml` directly

== Diun

This service is used to watch my docker containers and tell me via *ntfy*.

It is used by all serves with the following label in their `docker-compose.yml`:
```yaml
    labels:
      - "diun.enable=true"
```
