commit ab855181f3b95a04cf41bc781732895831910608 Author: Tanner Storment Date: Sun Jun 30 19:03:31 2024 -0500 init commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..24a8e87 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0e594dc --- /dev/null +++ b/Dockerfile @@ -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 + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1bfa84c --- /dev/null +++ b/Makefile @@ -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 ./ diff --git a/README.md b/README.md new file mode 100644 index 0000000..54631ee --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/src/build.sh b/src/build.sh new file mode 100755 index 0000000..5d57dd6 --- /dev/null +++ b/src/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +OUT_DIR="$1" + +latexmk \ + -pdf \ + --shell-escape \ + --output-directory="$OUT_DIR" diff --git a/src/graphics/backblaze-logo-250x60.png b/src/graphics/backblaze-logo-250x60.png new file mode 100644 index 0000000..3a01ff6 --- /dev/null +++ b/src/graphics/backblaze-logo-250x60.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a95fce60e9288032997be37717f209cf6aeef257795f0b31c4611886c6e6369a +size 6322 diff --git a/src/main.tex b/src/main.tex new file mode 100644 index 0000000..eaa4391 --- /dev/null +++ b/src/main.tex @@ -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}