init commit

This commit is contained in:
Tanner Storment 2024-06-30 19:03:31 -05:00
commit ab855181f3
8 changed files with 153 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM ubuntu:24.04
RUN apt update && apt install -y texlive-xetex latexmk graphviz inkscape
RUN useradd -ms /bin/bash latex
USER latex
VOLUME /wksp
WORKDIR /wksp

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
build:
mkdir -p dist
docker run \
--user 1000:1000 \
--rm \
--volume ./src:/wksp \
--volume ./dist:/output \
homelab-documentation-builder /wksp/build.sh /output
svgs:
mkdir -p dist
docker run \
--user 1000:1000 \
--interactive \
--tty \
--rm \
--volume ./src:/wksp \
--volume ./dist:/output \
homelab-documentation-builder /bin/bash
clean:
rm -rf ./dist
docker:
docker build -t homelab-documentation-builder ./

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# Graphics Sources
Backblaze Logo was sourced from https://www.backblaze.com/partners/resources
I resized it using imagemagick
```sh
convert -resize 250x60 "Backblaze Logos/Horizontal Logo/PNG/horizontal-white-navy.png" backblaze-logo-250x60.png
```

8
src/build.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
OUT_DIR="$1"
latexmk \
-pdf \
--shell-escape \
--output-directory="$OUT_DIR"

BIN
src/graphics/backblaze-logo-250x60.png (Stored with Git LFS) Normal file

Binary file not shown.

99
src/main.tex Normal file
View File

@ -0,0 +1,99 @@
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[11pt,oneside,a4paper]{article}
\usepackage[margin=0.25in]{geometry}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{listings}
\usetikzlibrary{shapes.geometric, arrows}
\setlength{\parindent}{0pt}
\definecolor{bbRed}{HTML}{E20626}
\definecolor{bbNavy}{HTML}{000033}
\definecolor{termBackground}{HTML}{393939}
\definecolor{termForeground}{HTML}{FEFEFE}
\definecolor{termGreen}{HTML}{88FC82}
\definecolor{termBlue}{HTML}{677FEA}
\tikzstyle{borgclient} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=white, fill=red!30]
\tikzstyle{borgserver} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=white, fill=blue!30]
\tikzstyle{backblaze} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=bbRed, color=bbNavy, fill=white]
\tikzstyle{arrow} = [thick,->,>=stealth]
\lstdefinestyle{shellRecord}{
backgroundcolor=\color{termBackground},
commentstyle=\color{termGreen},
keywordstyle=\color{termForeground},
stringstyle=\color{termBlue},
basicstyle=\ttfamily\scriptsize\color{termForeground},
tabsize=2
}
\begin{document}
\tableofcontents
\section{Backups}
\subsection{Overview}
Every node maintains a borg repository on backups.lab.local. The repositories are encrypted in repokey mode. Repokeys are stored in my keepass database and are backed up on paper. Every night, backups.lab.local syncs the encrypted repositories with backblaze.
I configure the nodes to use borg using the borg-client ansible role. This role sets up the borg user and syncs a number of helpful scripts to its home directory. It also generates a fresh ed25519 keypair, which is then uploaded to the borg server.
\subsection{Diagram}
\begin{tikzpicture}[node distance=2cm]
\node (hoster) [borgclient] {hoster.lab.local};
\node (laptop) [borgclient, left of=hoster, xshift=-2cm] {ex.lab.local};
\node (mailserver) [borgclient, right of=hoster, xshift=2cm] {mx.secrecy.email};
\node (backups) [borgserver, below of=hoster] {backups.lab.local};
\node (backblaze) [backblaze, below of=backups, yshift=-1cm] {
\begin{tabular}{c}
\includegraphics[width=.25\textwidth]{graphics/backblaze-logo-250x60.png} \\
secrecy-rocks-backups-2
\end{tabular}
};
\draw [arrow] (hoster) -- node[anchor=east] {borg} (backups);
\draw [arrow] (laptop) -- (backups);
\draw [arrow] (mailserver) -- (backups);
\draw [arrow] (backups) -- node[anchor=east] {rclone} (backblaze);
\end{tikzpicture}
\subsection{Restore Procedure}
Point-in-time backups can be mounted in a FUSE directory and explored like any other directory.
\subsubsection{From backups.lab.local}
\lstset{style=shellRecord}
\begin{lstlisting}[language=bash]
# List available backups
> borg list borg@backups.lab.local:/opt/backups/hoster.lab.local
2024-06-27T18:51:42+00:00 Thu, 2024-06-27 13:51:43 [97a6...8077]
2024-06-27T18:56:01+00:00 Thu, 2024-06-27 13:56:01 [7436...bc28]
2024-06-27T19:02:06+00:00 Thu, 2024-06-27 14:02:08 [cb33...2239]
2024-06-28T03:00:15+00:00 Thu, 2024-06-27 22:00:17 [3b8f...4a2a]
2024-06-29T03:00:22+00:00 Fri, 2024-06-28 22:00:23 [8fbc...2826]
2024-06-30T03:00:21+00:00 Sat, 2024-06-29 22:00:23 [9142...a5b8]
# Mount a backup
> borg mount \
-o uid=1000,gid=1000 \
borg@backups.lab.local:/opt/backups/hoster.lab.local::2024-06-30T03:00:21+00:00 \
~/restore/
# Interact with the files in the backup
> ls ~/restore/opt/backup-staging/
airsonic compose gitea joplin lost+found nextcloud traefik wekan
\end{lstlisting}
\subsubsection{From backblaze}
Use rclone to copy the repositories from the secrecy-rocks-backups-2 bucket to backups.lab.local. Then continue as normal.
\end{document}