Setting Up the Home Lab

Setup the Raspberry Pi

Flash Ubuntu to an SD card using Raspberry Pi Disk Imager and adapt these files on the SD card afterwards:

config.txt
# ... original content ...


# Turn off Power LED
dtparam=pwr_led_trigger=default-on
dtparam=pwr_led_activelow=off

# Turn off Activity LED
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

# Turn off Ethernet ACT LED
dtparam=eth_led0=4

# Turn off Ethernet LNK LED
dtparam=eth_led1=4
user-data
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#cloud-config

# Global host configuration
hostname: rpi-0 # TODO: adapt host name
timezone: Europe/Berlin # TODO: adapt timezone
locale: en_US.UTF-8
ssh_pwauth: false

ntp:
  enabled: true

# User configuration
users:
- name: your_name # TODO: adapt user name
  gecos: your_name # TODO: same name here
  sudo: ALL=(ALL) NOPASSWD:ALL
  groups: sudo
  lock_passwd: true
  shell: /bin/bash
  ssh_authorized_keys:
  - ssh-rsa AAAAB3Nza... # TODO: YOUR SSH KEY

# Package configuration
package_update: true
package_upgrade: true
package_reboot_if_required: true

packages:
- linux-modules-extra-raspi
- podman

# Reboot host
power_state:
  mode: reboot

Connect the raspberry pi to network and power and wait until cloud-init is done:

ssh rpi-0 cloud-init status

This might take a while…

When the RaspberryPi is running, you might need to mount an external storage. Have a look at this guide: Set up automatic mounting

Deploying Prod Instance

Create a new domain and a new tunnel:

cloudflared login
cloudflared tunnel create prod-homelab
cloudflared tunnel route dns prod-homelab *.YOUR_PROD_DOMAIN.dpdns.org

Create an .env file similar to the .env.dev file and adapt the variables: Cluster Domain, paths for the secrets etc.

and a prod.compose.yml:

prod.compose.yml
1
2
3
4
5
#!/usr/bin/env -S podman-compose --env-file .env.prod -f 
name: prod-homelab

include:
  - src/compose.yml

Make it executable by running chmod +x prod.compose.yml.

Push everything to the Git repository.

Connect to the Raspberry Pi via SSH, navigate to the mount point of the external storage, e.g. /mnt/storage and clone your Git repository. Copy the secrets to the paths that are configured in the .env.prod file. Start the stack by running ./prod.compose.yml up -d and see if the services are accessible via https://pdf.YOUR_PROD_DOMAIN.dpdns.org.

Last updated on