+++
class = "post"
date = "2017-04-02T14:47:09-04:00"
tags = []
title = "Homeproduction, part 1: Hardware"
type = "post"
weight = 1
draft = true
+++

[Part 1](/post/homeproduction-part-1/) - [Part 2](/post/homeproduction-part-2/) - [Part 3](/post/homeproduction-part-3/)
```
Why do you do this?
Because I want to.
  - The Matrix, -ish
```

## Homelab? Homeproduction!

If you're reading this and have no idea what a 'homelab' is, it's a hobby for system administrators whereby we set up our own "lab" environments at home, to play around with and generally learn on. Some are small, just a home server and a switch, and some are basically mini-datacenters. Mine's closer to the latter.

In my case, I strongly value service independence and control of my own data. I put little trust in large corporate Internet companies, from privacy, security, and reliability perspectives, and would simply rather host my data myself. For this reason, I've spent the last 4 years building up my "homeproduction": a homelab used day-in day-out for my data needs, along with my family and friends.

This is the first in a series of posts describing my lab as it exists today in April 2017. There will be three sections: Hardware, Storage, and Services.

## From the bottom up: Power

The homelab really begins with power - no electricity, no homelab! For optimal efficiency and to prevent overloading, my lab has a dedicated 20A 120V circuit run to it. The story of this circuit is a little funny: my box has a fixed number of fuses, and was full for as long as I could remember. But I never noticed one circuit was dedicated... to the doorbell! Goodbye fixed doorbell, hello homelab circuit!

![Wall-mounted 20A outlet](/images/homelab/power-wall-plug.png)

From the surface-mounted 20A plug, the single power input to the rack goes into an APC Smart-UPS 2200 RM XL, which provides 2200VA of protecting for approximately 10 minutes at 2/3 load. With my current contingent of gear this is the perfect size and has kept the system going through several small power outages.

Power is distributed through the rack on two power bars, which provide A/B power feeds to dual-PSU gear. One of these distribution bars also connects to a second, smaller power bar for wallwarts. The goal with the dual distribution bars would be to eventually obtain a second UPS and provide truly redundant power (from the wall at least - it's a house!), but so far I haven't seen any need to (for the aforementioned reason!)

![APC Smart-UPS](/images/homelab/power-ups-bars.png) 

All-told, the rack today uses at its peak about 1500W as reported by the UPS, averaging closer to 1300W.

![Power usage graph, one week](/images/homelab/power-usage-graph.png)

## The Rack and the Room

The rack itself is an evolution from a few previous designs, including a large Lack-based setup and a smaller audio rack. In its current form, the rack is made primarily of 2x4s, pannelboard, and angle iron for rails, sitting atop six large castors to allow for easy movement. The whole rack was built in a weekend, and provides space for 2x 4U servers, 4x 2U servers, 2U for the router, and 2x 1U for switches, with patch panels at the very top.

![Rack bottom](/images/homelab/rack-bottom.png)

The "rails", made of angle iron, can be easily repositioned with a screwdriver (motorized, or it really hurts) and a level, allowing almost infinite reconfiguration of its 26U of space. At the bottom, the UPS rests on the base.

![Rack front](/images/homelab/rack-front.png)

The entire rack is enclosed with panelboard, to keep the heat in and directed up and out.

![Rack outside](/images/homelab/rack-outside.png)

At the top rear left of the rack is an opening containin 5x 120mm fans which direct hot air from the back of the case out. The air is then directed into a square duct made of rigid cardboard, running parallel lengthwize to the rack about 1/2 of the length along a wooden shelf. At the end of this duct is a powerful 120mm fan, which exhausts the hot air in one stream back into the room. Directly above the duct and exhaust is a window - in the winter it can be opened slightly to controll the exhaust tempoerature (and hence the room temperature), and in the summer I plan to attch the outlet of the duct to a flexible duct pipe, which can then be cleanly vented out the window. This setup does a fairly good job of keeping the room cool as long as the panels on the rack are shut.

![Rack exhaust port](/images/homelab/rack-exhaust-port.png)

![Rack exhaust duct](/images/homelab/rack-exhaust-doct.png)

The room itself is actually my furnace room - an unfinished floor but finished walls and ceiling. To control the noise, the entire outer wall of the room is covered with egg cartons. While these do not abosrb sound, they reflect high-pitched, irritating frequencies and help cut down the piercing shreek of the smaller fans. While the rack is still noticible in the other room (a din like a table fan), it is not the shrieking sound inside the room, which I consider a success.

![Egg carton wall](/images/homelab/room-egg-cartons.png)

## The Gear - Networking

But enough about the rack, now for the interesting bits!

The core network consists of a router and two switches. The router is a whitebox server with an Intel E3-1240 CPU, 4GB RAM, a Supermicro X9SCL motherboard, and an ancient WD Raptor, running pfSense 2.3. The router features four Ethernet ports - 2x 1Gbps to the first switch, 1x 1Gbps management port to the second switch, and 1x upstream port to the DSL modem.

![Router front](/images/homelab/router-front.png)

![Router back](/images/homelab/router-back.png)

The first switch is a Quanta LB6M, featuring 24x 10Gbps SFP+ ports, 4x 1Gbps ports, and 2x 1Gbps management ports. This switch connects the router and second switch on the 1G ports, as well as a management port from the second switch. The servers all connect to the SFP+ ports via pairs of bonded links, providing resiliency and slightly better throughput. Dual power supplies also balance the ~130W the switch draws across both power bars.

![First switch front](/images/homelab/first-switch-front.png)

The second switch is a D-Link DXS-3227, featuring 24x 1Gbps ports, plus a 10Gbps XFP port that I've never gotten working. The switch connects back to the first switch, and provides all 100Mbps/1Gbps access ports to clients and non-server devices, including the management network. The management ports from the router and first switch both terminate on this switch.

![Second switch front](/images/homelab/second-switch-front.png)

## The Gear - Environmental Monitoring

The rack features a 

## The Gear - Servers

There are three classes of servers in the cluster: the management and backup server, the hypervisors, and the Ceph storage.
