98 lines
7.6 KiB
Markdown
98 lines
7.6 KiB
Markdown
Title: Considerations for server hardware
|
|
Date: 2019-7-10
|
|
Tags: hardware, sbc,
|
|
url: choosing-a-homebrew-server.html
|
|
save_as: choosing-a-homebrew-server.html
|
|
Summary: What makes a suitable homebrew server and where to get it?
|
|
Category: fundamentals
|
|
slug: 002
|
|
|
|
[TOC]
|
|
|
|
## Introduction
|
|
|
|
You wan't to get started with self-hosting. This means you will need a computer that will be your server. But what makes a good server?
|
|
|
|
First, while dedicated server equipment does exist, in the case of the homebrew server it is more helpful to think of a 'server' as a function rather than as a special machine.
|
|
|
|
Why? Because dedicated servers are expensive, loud, specialized and power hungry devices. At the same time any spare computer with a network port running GNU/Linux can *become* a server.
|
|
|
|
It really depends what exactly you plan to do with it, but the odds are that 10 year old laptop you have lying around is more than up to the task!
|
|
|
|
## Considerations for servers
|
|
|
|
One of the main strategies of the homebrewserver.club is re-use. You re-use your existing internet connection at home to start hosting but you can also re-use old equipment you have.
|
|
|
|
In general there are a few things you want to take in consideration when determining what hardware to use.
|
|
|
|
### Power usage
|
|
|
|
All computers use power, but some use more than others. The function of the server is to be on-line and on the network 24/7 ([although that is not always necessary](https://solar.lowtechmagazine.com/2018/09/how-to-build-a-lowtech-website.html)). That means power usage is an important consideration, not only because it will cost you money but also because it will have an environmental impact.
|
|
|
|
You can get an approximation of power usage of a machine by looking at the power rating on the power supply or AC adapter. This value is usually expressed in Watt (or W). That number represents the theoretical *maximum* draw of that system, it might use less but not more. The laptop this article is written on is rated 65W but average consumption is about 10W
|
|
|
|
So how to calculate what that costs for a year of usage? First let's asume that this value is indeed the Watt per hour (Wh). Multiply that number by 24 to get the usage in a day.
|
|
|
|
`10 Wh * 24 hours = 240Wh or 0.24KWh`
|
|
|
|
Having the KWh figure will let you use that value to compare against your utilities bill.
|
|
|
|
Multiply it by the number of days in a year to get a sense of the costs on a yearly basis.
|
|
|
|
`240 Wh * 365 days = 87600 Wh or 87.6 KWh`
|
|
|
|
The price for electricity where I am is €0,24 per KWh so on a yearly basis that is €21 euros. On a monthly basis that is €1,75.
|
|
|
|
#### Considering power consumption at extreme ends.
|
|
|
|
A gaming pc tower that needs a 300 Watt supply can use up to 2,628 KWh of electricity a year which would cost up to €630. That is only a little less than the average inhabitant of this planet uses *in total during a year*[^1]. At the same time a Single Board Computer ([like this one](https://solar.lowtechmagazine.com/2018/09/how-to-build-a-lowtech-website.html) uses a maximum of 1.3 Watt (without peripherals). That comes down to 11.3 KWh or €3,20 on a yearly basis. Now these are both rough measures and power usage will likely be lower. However, this calculation does indicate that the choice of hardware and resulting power consumption do matter.
|
|
|
|
#### Energy consumption vs embodied energy.
|
|
|
|
While older equipment will use more power for the same performance as newer equipment this should not be your only consideration, especially when running on renewable power sources. In fact the overwhelmingly largest part of energy usage of digital technology comes from [manufacture and not usage](https://solar.lowtechmagazine.com/2009/06/embodied-energy-of-digital-technology.html). Environmentally it makes more sense to reuse and older less energy efficient device rather than investing in a newer energy efficient device.
|
|
|
|
## Benefits and disadvantages of laptops as servers
|
|
|
|
Laptops make good homebrew servers since they are widely available, relatively powerful and energy efficient. Aside from that they have the benefit of having a screen and keyboard. If you are just starting out with running a server and are not yet so comfortable with the [command line and ssh]({filename}ssh.md) it can be a real benefit as you can work on the machine directly. Aside from that the laptop battery can mitigate sudden power outages, so that the laptop can shut itself down gracefully if power runs out.
|
|
|
|
Laptops will also have the ability to hold one or more harddisks and plenty of USB ports for connecting multiple peripherals. It is not unlikely that you have one lying around or will be able to find one in a thriftstore.
|
|
|
|
Disadvantages can be size, sound, heat generation and power consumption (in particular if you don't tune the power management to turn off the screen).
|
|
|
|
|
|
## Single Board Computers
|
|
|
|
Arguably the ideal homebrew server hardware is the Single Board Computer (SBC). These are often very small computers on a single chip. They aimed at hobbyists and meant for prototyping. Popular brands are RaspberryPi, BeagleBone, Hardkernel and Olimex. They typically use the same ARM processors as used in smart phones meaning they are extremely energy efficient, using only a few Watts of energy under full load. Most models don't use active cooling so they make no sound, which is a boon in domestic environments. They can also be very cheap, ranging from €10 to €50.
|
|
|
|
The disadvantages are that, compared to a laptop, they are relatively 'incomplete'. You will need at the very least get an SD card and 5V charger to use them. They don't have a battery meaning that a power outage will shut it off without warning, possibly corrupting the SD-card. In terms of performance they usually have less RAM available than a laptop. Their bus bandwith to read/write disks they can also be lacking.
|
|
|
|
Having said that there are some boards which are really well optimized for homebrew server usage, such as the Olimex boards which have SATA ports (for connecting HDDs), are able to use Li-Po batteries, Gigabit Ethernet ports and decent amounts of RAM. You will also find many SBCs on the second hand market.
|
|
|
|
In general when using these boards have at GNU/Linux distributions optimized for single board computers such as [Armbian](https://armbian.com).
|
|
|
|
## Costs
|
|
|
|
One of the things that might hold one back are the costs involved in this whole undertaking.
|
|
|
|
As an example one can take my personal setup which I have been running since 2014. At the time I paid around €75 for a Olimex Micro (2ghz, 2 cores, 1GB ram) including peripherals such as a high performance SD card and power supply. Later I spent another €80 for a 2TB HDD. In terms of energy usage the upper bound is at 10Wh meaning €21 yearly.
|
|
|
|
So in total `€75 + €80 + €105 (€21x 5 years) = €260`. Per year this means €52 or about €4,30 a month. So while the upfront cost can be substantial, the cost over time is really manageable.
|
|
|
|
If you can reuse old equipment the costs are essentially negligable since you've already been paying for your ISP connection and reuse hardware.
|
|
|
|
### Compared to a VPS
|
|
|
|
So how does this compare to a Virtual Private Server, since you can get one for like €3, right?
|
|
|
|
If one compares the processing power of lower-tier VPS providers one can get 1 core 2Ghz and 2GB RAM for about €3. This is equivalent to low-end SBCs but if one starts including storage though the price quickly ramps up.
|
|
|
|
The great advantage of a VPS is that you won't have port restrictions and usually fast uplink.
|
|
|
|
no port restriction, no traffic shaping, hardware is maintained, it is not your personal IP-address.
|
|
|
|
|
|
|
|
|
|
|
|
[^1]: See per capita electricity consumption for the world population: <https://en.wikipedia.org/wiki/List_of_countries_by_electricity_consumption>
|