- Published on
My Homelab Journey
- Authors
- Name
- Ayden Jahola
Table of Contents
How did I start my homelab journey?
I've always been interested in setting up my own homelab. I love the idea of having my own personal cloud, running services that I use on a daily basis, and learning more about networking and server administration. I finally took the plunge and started building my homelab a few months ago. Here's my journey and some tips to get you started.
Getting Started
The first thing I did was research the hardware I would need. I wanted something that was powerful enough to run multiple services, but also energy efficient and quiet. I ended up going with a small form factor Dell Optiplex PC with an Intel Core i3-4160 processor, 12GB of RAM, and two HDDs, the boot HDD is 320GB and the main storage is 640GB. It's been working great for me so far.
Setting Up the Server
Once I had my hardware, the journey for finding the best suitable OS started, I initially started my homelab as being my NAS so I looked up good NAS solution and I ended up using TrueNAS. I installed TrueNAS Server on it. then inside of TrueNAS I ran a VM and installed Ubuntu server on it, I chose Ubuntu server because it's easy to use and has great support for Docker, which I planned to use to run most of my services. I also set up a few basic services like SSH, a firewall, and a reverse proxy using Traefik.
Running Services
With the server set up, I started running services. I used Docker Compose to define and run my services, which made it easy to manage everything. Some of the services I'm running include Vaultwarden, Pi-Hole, Plausible, HedgeDoc, Traefik, Homebridge, Uptime Kuma, Portainer, Plex and Home Assistant. I also set up a WireGuard VPN so I can access my homelab from anywhere.
Documentation
Documentation is key when running a homelab, documenting how you setup the whole process can be helpful in the future in case things go to shit, I keep my documentation in this docs website and the github repo that has all of my docker-compose files can be found here
Backups
I never set up a backup solution for my homelab until I started hosting Vaultwarden, I realized that I need to have a backup solution for my data specially with the sensitive data that I have in my Vaultwarden, so the current solution I have is not the best but it's better than nothing, I have a script that runs every 6 hours and backs up my data to my Google Drive, I'm planning to improve this solution in the future.
the script is a simple bash script that uses gpg
to encrypt the data and then send them to the Google Drive encrypted:
#!/bin/bash
job_name="service-name" # change this to the name of the service
backup_dir="path/to/gdrive/backups/" # change this to the path of the backups directory
file_name="service-backup-$(date +%Y-%m-%d_%H-%M-%S)" # change this to the name of the backup file
file_path="${backup_dir}${file_name}" # specify the file path
mkdir -p "$backup_dir" # create the backup directory if it doesn't exist
tar -czf "$file_path.tar.gz" -C path/to/tar/dir . # change this to the path of the directory you want to backup
gpg --encrypt --recipient your_gpg_key --output "$file_path.tar.gz.gpg" "$file_path.tar.gz" # change this to your gpg key
rm "$file_path.tar.gz" # remove the unencrypted tar file from local machine
find "$backup_dir" -type f -mtime +14 -exec rm {} \; # remove backups older than 14 days
if [ $? -eq 0 ]; then # if success then exit
exit 0
else # if failed then send a message to discord with the error message
rm "$file_path.tar.gz.gpg" # remove the encrypted tar file from local machine
# send a message to discord with the error message and the file name and the date of the backup
curl -H "Content-Type: application/json" -d \
'{"content": "discord_user_id `SQlite3` backup for **'"${job_name}"'** has just **FAILED**\nFile name: `'"$file_name.tar.gz.gpg"'`\nDate: `'"$(TZ=Europe/Dublin date)"'"}' \
"discord_webhook_url"
fi
this script is a heavily modified version of the script that Redbrick uses to backup their databases. Redbrick's script can be found here, I modified it to fit my needs and I'm planning to improve this solution in the future.
Tips for Getting Started
If you're interested in setting up your own homelab, here are a few tips to get you started:
- Start small: You don't need to run a dozen services right away. Start with a few basic services and add more as you get comfortable.
- Use Docker: Docker makes it easy to run and manage services, and it keeps everything isolated from the host system.
- Back up your data: Make sure you have a good backup strategy in place. You don't want to lose all your data if something goes wrong.
- Have fun: Setting up a homelab can be a lot of work, but it's also a lot of fun. Enjoy the process and don't be afraid to experiment.
Resources that helped me
- Docker Compose: Docker Compose documentation is a great resource for learning how to define and run multi-container Docker applications.
- Traefik: Traefik documentation is a great resource for learning how to set up a reverse proxy for your services.
- TrueNAS: TrueNAS documentation is a great resource for learning how to set up a NAS server.
- Ubuntu: Ubuntu documentation is a great resource for learning how to set up an Ubuntu server.
- WireGuard: WireGuard documentation is a great resource for learning how to set up a VPN.
- Cloudflare: Cloudflare with Traefik is the best way to expose your services to the internet.
- Awesome-Selfhosted: A great resource for finding self-hosted alternatives to popular services.
- cawnj/leo-config: Special thank to
cawnj
for helping out with the Traefik configuration and the reverse proxy setup. - Redbrick: Special thanks to Redbrick for the help through setting up the whole thing.
I hope this post has inspired you to start your own homelab. It's been a great learning experience for me, and I'm excited to see how my homelab grows in the future. If you have any questions or need help getting started, feel free to reach out to me. I'd love to help you on your homelab journey.
Happy homelabbing!