A low power 1U Raspberry Pi cluster server for inexpensive colocation.
There are server colocation providers that allow hosting a 1U server for as low as $30/month, but there's a catch: There are restrictions on power usage (1A @ 120v max, for example) because they're expecting small and power-efficient network equipment like firewalls.
This repo is about designing a server that fits within the 1U space and 1A @ 120v power constraint while maximizing computing power, storage, and value.
Total cost: ~$800
You will need to do this for each of the Raspberry Pi's:
cd /Volumes/boot/
touch ssh
ssh pi@<ip address>
and the password "raspberry".sudo raspi-config
1 System Options
-> S4 Hostname
-> Update hostname -> Finish -> Rebootsudo apt-get update && sudo apt full-upgrade -y
sudo rpi-update
(only do this once on each Pi)sudo sed -i -e '$i \/usr/bin/tvservice -o\n' /etc/rc.local
sudo systemctl stop avahi-daemon.service
sudo systemctl stop avahi-daemon.socket
sudo systemctl disable avahi-daemon.service
sudo systemctl disable avahi-daemon.socket
sudo bash -c 'echo -e "dtoverlay=pi3-disable-wifi" >> /boot/config.txt'
sudo bash -c 'echo -e "dtoverlay=pi3-disable-bt" >> /boot/config.txt'
sudo reboot
ssh-copy-id pi@<IP-ADDRESS>
)sudo sed -i '/^#*PubkeyAuthentication /c PubkeyAuthentication yes' /etc/ssh/sshd_config
sudo sed -i '/^#*ChallengeResponseAuthentication /c ChallengeResponseAuthentication no' /etc/ssh/sshd_config
sudo sed -i '/^#*PasswordAuthentication /c PasswordAuthentication no' /etc/ssh/sshd_config
sudo sed -i '/^#*UsePAM /c UsePAM no' /etc/ssh/sshd_config
sudo raspi-config
6 Advanced Options
-> A6 Boot Order
-> B2 USB Boot
-> Finish -> Rebootsudo -E rpi-eeprom-config --edit
and add [all] BOOT_ORDER=0xf14
.sudo rpi-update
) with the new OS on the SSD. SSH'ing into the new OS on the SSD may require clearing out the line with the corresponding IP in your ~/.ssh/known_hosts
file with ssh-keygen -R <host>
.Remove the hard drive bay dividers and front panel extension cable from the inside of the chassis.
Install the Raspberry Pi's into their cases.
Install the M.2 drives into their enclosures.
Insert a SD card into each of the Pi's.
Follow the Software Setup guide if you haven't already.
Add mounting tape to the bottom of each of the SSD enclosures and attach them to the top of the Raspberry Pi's.
Add mounting tape to the bottom of the raspberry pi cases. Don't remove the bottom cover of the mounting tape adhesive yet.
Remove the rubber feet from the bottom of the networking switch and replace with 4x small squares of mounting tape. Don't remove the bottom cover of the mounting tape adhesive yet.
Add labels with numbers to the tops of the cases. These numbers will correspond to the hostnames of the Pi's in the software setup.
Use wire cutters to remove the metal adjacent to the ethernet port and mount the port side of the ethernet extension to the back of the chassis with washers and the included bolts.
Cut a section of the plastic sheet that came with the chassis (for under the motherboard) to fit under the power supply breakout board.
Drill holes in the chassis, insert nylon standoffs, and add the plastic sheet.
Cut 5x 6" lengths of red standed wire, strip the both ends, and install one end of each wire into the "+" slots of the USB terminal blocks and the other side of each wire into the 5V terminals of the ATX power supply breakout board. Make sure the 20 pin power supply has a corresponding wire, some wires will be missing and may not actually work on the power breakout board.
Cut and strip 5x 6" lengths of green standed wires then install one end of the each wire into the "-" slots of the USB terminal blocks and the other side of each wire into the COM terminals on the ATX power supply breakout board. Again, ensure the wire exists on the 20 pin cable before using the terminal block.
Mount the ATX power supply breakout board to the chassis and secure with nylon nuts. Insert the 20 pin ATX power supply connector into the ATX power supply breakout board.
Remove the covers from the mounting tape adhesive on the bottom of the Pi cases and switch, then position them in the chassis. You will probably want to try to match the layout from the finished project above, but this may change depending on how many Raspberry Pi's you have.
Attach ethernet cables from each of the Raspberry Pi's to the networking switch.
Cut the 12V barrel connector along with 12" of wire off of the power adapter for the network switch. Attach the cable with the solid white line markings into a 12V terminal on the ATX breakout board and attach the other wire to a COM terminal on the breakout board. You may want to confirm this is the correct "+" wire for your switch with an ohm meter and the diagram near the power connector the back of the switch.
Cut a section of the plastic sheet that came with the chassis (for under the motherboard) to fit under the 8 channel relay board.
Drill holes in the chassis, install nylon standoffs, and add the section of plastic sheet.
Wire 4 of the 5 5V USB terminal "+" wires from the ATX breakout board to NC terminals on the 8 channel relay, and wire the other side of the relay to the "+" on the USB terminal block for 4 of the 5 Pi's. More relay setup instructions
Mount the 8 channel relay to the chassis with the nylon standoffs and secure with nylon nuts.
Cut a section of the plastic sheet that came with the chassis (for under the motherboard) to fit under the 1 channel relay board.
Drill holes in the chassis and install nylon standoffs for the 1 channel relay.
Wire DC+ on the relay to a 3.3V GPIO pin from a Pi that is powered by the 8 channel relay. DC- will need to be wired to a ground GPIO pin and IN will need to be wired to GPIO pin 18. Finally, wire the 5V power from the ATX breakout board to NC, and wire COM to the "+" on the terminal block for the Pi isn't powered by the 8 channel relay.
Mount the 1 channel relay to the chassis with the nylon standoffs and secure with nylon nuts.
Move the jumper on the 1 channel relay from H to L.
Plug one of ATX SATA power connectors into the fan controller and connect the blower fan from the chassis into the fan controller.
Drill a hole in the front of the case for the power switch and install the power switch.
Add a 290 ohm resistor inline with a 6" length of wire with a female header on one side, add heatshrink, then strip the side opposite of the female header and install the wire into a 3.3V terminal on the ATX power supply breakout board.
Add the stripped side of another wire of the same length with a female header on one side to a COM terminal on the power supply breakout board, then put the female headers onto the pins of one of the LEDs on the front panel.
Apply electrical tape over the unused header pins and terminal blocks to prevent accidental electrical shorts.
Connect the Pi's USB C ports to the USB terminal adapters.
Plug in the power and flip the power switch to "on".
/etc/dhcpcd.conf
on each of the Pis and add the networking info from the colocation provider, for example:
interface eth0
static ip_address=192.168.1.191/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 8.8.4.4
sudo reboot
Only do this on the power management Paspberry Pi connected to the relay:
curl -o relay_control.py https://raw.githubusercontent.com/pawl/raspberry-pi-1u-server/main/relay_control.py
python relay_control.py
You should see the light on the SSD flash off and on for the Pi whose relay's GPIO pin you entered.
sudo apt-get install stress
while true; do vcgencmd measure_clock arm; vcgencmd measure_temp; sleep 10; done& stress -c 4 -t 900s
At least 7. (including 1 Pi Zero and a Pi 3b)
This is a tough comparison to make because the Pi CPU cores are only 1.5GHz per core.
The T2 instances have a limited number of CPU credits, which means they can't run at 100% all the time like the Pi can.
$20/month for 4GB Ram & 2 vCPUs @ 2.5 GHz * 10 = $200/month
Note: I tried using 2.5" SSDs with inateck enclosures and there wasn't enough room.