/homelab-setup

Primary LanguageShellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Homelab Setup

This project is the "configuration as code" for my homelab environment. The project goal is to simplify management, updates, and configuration changes for every service running on my home network so that I don't get bogged down with day 2 operations (preventing me from focusing on my other projects). This document describes the steps required to (re)deploy each service from scratch.

Table of Contents

  1. Router
  2. Gitea
  3. Nextcloud
  4. Harbor
  5. Kubernetes

Router

  1. Install OpenBSD 6.7
    • Enable SSH
  2. Setup passwordless SSH
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    vi ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  3. Install Python
    pkg_add python-3.8.2
    
  4. Run router Ansible role
    make router
    

Gitea

  1. Provision a VM
    • 1 CPU
    • 1 GB memory
    • 8 GB disk
  2. Install Debian 10
    • Disable GUI
    • Disable print server
    • Enable SSH
  3. Setup passwordless SSH
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  4. Install sudo
    apt install sudo
    usermod -aG sudo <user>
    
  5. Run gitea Ansible role
    make gitea
    
  6. Create gitea user
    gitea --config /etc/gitea/app.ini admin create-user \
      --username <user> \
      --password password \
      --email <email> \
      --must-change-password \
      --admin
    
  7. Log in, setup SSH keys, GPG keys, repos, etc.

Nextcloud

  1. Provision a VM
    • 1 CPU
    • 1 GB memory
    • 64 GB disk
  2. Install Debian 10
    • Disable GUI
    • Disable print server
    • Enable SSH
  3. Setup passwordless SSH
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  4. Install sudo
    apt install sudo
    usermod -aG sudo <user>
    
  5. Run nextcloud Ansible role
    make nextcloud
    
  6. Complete installation with web UI
  7. Install "Deck" App

Harbor

  1. Provision a VM
    • 2 CPU
    • 4 GB memory
    • 128 GB disk
  2. Install Debian 10
    • Disable GUI
    • Disable print server
    • Enable SSH
  3. Setup passwordless SSH
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  4. Install sudo
    apt install sudo
    usermod -aG sudo <user>
    
  5. Run harbor Ansible role
    make harbor
    
  6. Log in to web UI and change admin password
  7. Configure Docker client to trust private CA
    sudo mkdir -p /etc/docker/certs.d/harbor.mydomain.com/
    sudo vim /etc/docker/certs.d/harbor.mydomain.com/ca.crt
    

Kubernetes

  1. Provision 6 VMs
    • 2 CPU
    • 7 GB memory
    • 32 GB disk
  2. Install Debian 10
    • Disable GUI
    • Disable print server
    • Enable SSH
  3. Setup passwordless SSH
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  4. Install sudo
    apt install sudo
    usermod -aG sudo <user>
    
  5. Run k8s Ansible role
    make k8s
    
  6. (optional) Copy ~/.kube/config to local machine
    mkdir ~/.kube
    chmod 770 ~/.kube
    scp user@k8s-master.mydomain.com:~/.kube/config ~/.kube/config