Setting up a home server

I've recently been enjoying setting up a home server. Here is what I started with, in order.

  1. SSH Access
  2. Pi Hole
  3. Docker and Docker Compose
  4. Ghost Blog
  5. Plex
  6. Caddy

Lesson number 0: You can actually get free domain names!

I searched for "free web domains" and found http://www.dot.tk, which is where I easily got epicbits.dev for free! At least for the first year.

Lesson number 1: Don't install services natively. Run them all on Docker!

I initially installed Pi Hole and ran it as my network DNS server to block ads. I later wanted to secure my blog with SSL and started working on setting up Caddy. However, I needed the ports that Pi Hole was running on (port 80). I tried to uninstall Pi Hole so I would run it in Docker for ease of customization. Halfway through the uninstall process, things exploded and my server could no longer connect to the internet.

I spent several hours banging my head against the desk, trying to figure out why my connection wouldn't work.

I then got so fed up that I completely reinstalled the operating system on my server and started from scratch (I hadn't done all that much anyway).

Lesson number 2: Pi Hole is awesome for blocking ads, but has some drawbacks.

I haven't yet setup Pi Hole again. Pi Hole was awesome for these reasons.

  1. No need to worry about ads! Nor annoying websites that tell you to turn off your ad-blocking software.
  2. A simple and elegant interface.
  3. Stats on all outgoing requests from my network.
  4. DHCP to assign static IPs to all the devices on my home network.
  5. Easily blacklist additional sites.

Here's what I didn't like about Pi Hole.

  1. If my server goes down, there's no internet access and there's no fallback. You could setup several servers for redundancy, but I just want something that works out of the box. Call me lazy, if you will.
  2. Pi Hole does not respect context for ads. When I do a Google search, the top links are typically proxied via Google as ads for the websites that I want to go to, but then are blocked by Pi Hole.

Pi Hole was awesome, I may install it again someday.

Lesson number 3: Docker compose is awesome!

Docker not only makes things super easy to run, but my favorite part about it is that it makes installing required dependencies so easy. Without affecting anything else!

My current setup looks like this.

x-wing@x-wing:~/www$ ls
caddy  ghost  pihole  plex

I then have separate docker-compose.yaml files in each directory. Here's the one running this blog.

version: '3.6'
services:
  ghost:
    container_name: ghost
    image: ghost:alpine
    restart: unless-stopped
    ports:
      - 2368:2368
    volumes:
      - /home/x-wing/www/ghost/content:/var/lib/ghost/content
    environment:
      - url=https://epicbits.dev

Now, when my computer reboots, each service will auto-start. Important data is mounted to the host, so no need to worry about losing anything on a restart. No need for a long command to run anything if I need to make a change, just a simple docker-compose up -d.

Lesson number 4: Caddy Server is great for a quick https solution

I wanted to secure my family blog. I had heard of Caddy, but soon learned that it has a quick and easy integration with Let's Encrypt.

Here's my docker-compose.yaml for Caddy.

version: '3.6'
services:
  caddy:
    container_name: caddy
    image: abiosoft/caddy
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - /home/x-wing/www/caddy/Caddyfile:/etc/Caddyfile
      - /home/x-wing/www/caddy/.caddy:/root/.caddy
    environment:
      - ACME_AGREE=true
    links:
      - ghost:ghost
  ghost:
    container_name: ghost
    image: ghost:alpine
    restart: unless-stopped
    ports:
      - 2368:2368
    volumes:
      - /home/x-wing/www/ghost/content:/var/lib/ghost/content
    environment:
      - url=https://epicbits.dev

And my Caddyfile.

www.epicbits.dev, epicbits.dev {
    proxy / ghost:2368 {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Proto {scheme}
    }
    tls <my email address>
}

And that was it! I just pointed my router to port 80 on my server and Caddy redirects traffic to epicbits.dev to my ghost blog.

Lesson number 5: Plex is easy to setup.

I threw together this docker-compose.yaml file based on the docker settings on the image.

version: '3.6'
services:
  plex:
    container_name: plex
    image: plexinc/pms-docker
    restart: unless-stopped
    ports:
      - 32400:32400/tcp
      - 3005:3005/tcp
      - 8324:8324/tcp
      - 32469:32469/tcp
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
    environment:
      - TZ=America/Denver
      - PLEX_CLAIM=<your plex claim>
      - ADVERTISE_IP=http://<internal IP of your host>:32400/
    hostname: <local hostname>
    volumes:
      - /home/x-wing/www/plex/config:/config
      - /home/x-wing/www/plex/transcode:/transcode
      - /home/x-wing/www/plex/data:/data

I then opened up the plex port 32400 on my router and voila! I had a Plex server. I added some movies and photos to the data directory and easily added libraries on my Plex account.

And that's it! I'm excited for my next adventures with a home server!