DIY security system part 1

Author:

Sit around the fire children and allow me to retell the story of the Frigate debacle of 26.It all started one night when I received a carrier pigeon message from my brother in Christ asking how difficult it would be to set up a DIY home security system.

All right I’m done with the bid, Long story short I told him I would look into it. But he made the mistake of telling me that if I could figure out the technical side He could handle the installation side and maybe we could go into business together and install these for people for some decent money. That got me hyped.

I dove in researching software options and configuring everything. I’ll detail my process and my pitfalls along the way. This is part 1 of 2. This post will detail the configuration of the base software. Part 2 will come later and will talk about the automation scripts and the things I did to make it more of an appliance.

There might also be a part 3 coming since I didn’t actually finish the whole process. We abandoned the whole business venture since I discovered the NVR systems could be had for a thousand bucks along with 5 or 6 (Terrible) cameras. While I think our solution is better in the long run for privacy and flexibility. Because at the end of the day if you turn a workstation into a home security system it still a workstation with the capability to do so much more on top of just being in NVR. I was sure that some people out there would appreciate having a private fileserver to break away from iCloud or Google drive fileserver. I just didn’t think that we could convince a non-technical person who isn’t super concerned about privacy to spend 2 to 3 times as much for us to install a unit that they would have to do maintenance for even if it was incredibly minor.

Even though it’s not finished I haven’t given the Russian bots something new to talk about in my comment section for a good while.

Base operating system

I opted for Ubuntu desktop 24.04.4 I didn’t want the customer to panic if they didn’t see desktop environment and was forced to use terminal for everything. If I was doing this for myself I would just run Ubuntu server since it is much more lightweight.

CCTV software

I went with Frigate after entertaining zone minder for a little bit. People were claiming that Frigate was a little more heavy on the hardware side but after seeing a video of someone running the software on a raspberry pie with 2 cameras and AI object detection I was sold. Besides Frigate is much more modern and I feel like it would induce far less customer panic if they didn’t see something that looked like it was out of 2004.

Note: While I didn’t get far enough to start blogging and cameras to my system Frigate pretty much supports any camera with RTSP (Real-Time Streaming Protocol).

VPN

Long story short I wanted to create a golden image with all the software installed and preconfigured along with any installation scripts. The plan was my partner would install the golden image on every machine and then we would run checks to make sure everything was in order. And then it was as simple as taking it to the customers house import needed. This were the VPN actually comes in to play. I obtained wire guard for a little while it was very easy to set up but it did require port forwarding. And I didn’t want to have to deal with explaining to the customer that I would have to open up a port on the router. Also my partner was less technical will be the one that would have to do that and I didn’t want the headache.

I went with tailscale it doesn’t require any port forwarding and I could preload my access key. At the customer’s so it was dead simple. After the job is complete it was as simple as removing my access key from my dashboard. Oh yeah, that is the one downside of tailscale it doesn’t acquire an email or Google account so if there was an outage during a job that would have been quite annoying.

Step-by-step install

Purge snap (optional)

sudo snap remove --purge firefox
sudo snap remove --purge snap-store
sudo snap remove --purge core
sudo snap remove --purge core18
sudo snap remove --purge core20
sudo snap remove --purge core22
sudo snap remove --purge snapd-desktop-integration

sudo apt purge snapd -y

rm -rf ~/snap
sudo rm -rf /snap /var/snap /var/lib/snapd
sudo apt-mark hold snapd

Install native Firefox

sudo add-apt-repository ppa:mozillateam/ppa -y
sudo apt update
sudo apt install firefox -y

Docker

I had some weird issue with the dependencies and repo so I had to do things a bit differently but and what you’re having issues do whatever the documentation says. Use the madness below is a last resort.

sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) \
signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Run the following command to verify everything is installed.

docker compose version

Enable the darker service and verify that the version was installed

sudo systemctl enable --now docker

docker –version

systemctl status docker

Directory structure

mkdir -p /opt/frigate/config /opt/frigate/media

cd /opt/frigate
sudo nano /opt/frigate/docker-compose.yml 

Copy this into the docker compose file exactly (Indentation and spacing is incredibly important)

services:
  frigate:
    container_name: frigate
    image: ghcr.io/blakeblackshear/frigate:stable
    restart: unless-stopped
    privileged: true
    shm_size: "512m"

    volumes:
      - ./config:/config
      - ./media:/media/frigate

    ports:
      - "5000:5000"

 /opt/frigate/config/config.yml

mqtt:
  enabled: false

detectors:
  cpu1:
    type: cpu

cameras:
  test_camera:
    ffmpeg:
      inputs:
        - path: "rtsp://admin:password@192.168.1.100:554/stream"
          roles:
            - detect
            - record

    detect:
      width: 1280
      height: 720
      fps: 5

    record:
      enabled: true
      retain:
        days: 7

    snapshots:
      enabled: true 

This is the end of part one I hope this gave you a good baseline. Part two will be about scripts that I was writing to make it as friendly to the non-technical user as humanly possible. I’m actually leaving comments on for this one since I installed a CAPTCHA plug-in so feel free to leave a comment you know what you think.

I hope this helped.

Leave a Reply

Your email address will not be published. Required fields are marked *