Mise à jour de 'Home'

2022-12-01 16:58:28 +01:00
parent 2b514babf8
commit 9369576221

189
Home.md

@@ -1,188 +1 @@
This is part 1 - Why and how to get a server, [Part 2: Install the server](install_the_server), [Part 3: Tests](hw_tests), [Part 4: setup and migrate](migrate)
Disclaimer : All opinions, ideas and choices described thereafter are stricly my own.
# Motivation
Garaia, the company I previously founded, was running a cluster of 4 servers (2 muscled ones and 2 lighter ones) spread out on 2 French providers (OVH and Online.net). The 2 "big" servers were in charge of running the show while the 2 lighter ones served as hot backups in case OVH broke down... [And for those who missed it, yes it did !](https://www.reuters.com/article/us-france-ovh-fire-idUSKBN2B20NU).
When the commercial success of Garaia proved to be too modest and I decided to change my career plans, I tore down the cluster and fell back to only one of the small servers for the time being.
Since then I joined my dream company and became [Commercial Lead at Canonical
](https://www.linkedin.com/in/alexandre-micouleau-03b7393/?lipi=urn%3Ali%3Apage%3Ad_flagship3_feed%3Bl1sH%2Bt1gR7yuPj1uvN8vDQ%3D%3D). As such, not only did I join a company that promotes multi clouds and hybrid clouds, but a part of my job is also to prove the better economical and performance dominance of private clouds over public clouds.
And yet, it seemed a bit hypocritical of my part to keep most of my stacks on public clouds. Moreover, since I am now in charge of procuring servers for our infrastructure, I might as well acquire one of those for myself and have fun with it ! Well, most probably one of the great grand fathers of the kind we get at Canonical, but still ;-D ). **Finally, it might be fun to prove that you can compete with public cloud prices even with modest/commodity hardware, since Canonical and its clients already do with larger infrastructures.**
So, here's the plan:
1. get a cheap server on ebay,
2. set it up in my home,
3. migrate all my services on it and get rid of the two pieces it will replace, namely the last living bare metal I rent, and my home NAS.
| ![That remains to be seen](https://i.pinimg.com/originals/53/05/83/530583e79e4fc7f75855995d511e185c.jpg)|
|:--:|
| That remains to be seen :'-)|
# 0. Current situation
Before going on our first phase of the plan (a.k.a.: "buying, shopping, spending"), it might be good to get a feel of what we have and how it is used. This will give us guidelines and orientations on the specs we are looking for.
## Online.net
### Server specs
This server is a rather modest : an energy efficient Intel Atom CPU C2750, with 16 GiB of RAM and 1 TB of HDD.
In short, a single low end core, few RAM, no SSD, no RAID : more "bare minimum" than "bare metal"
```
# lscpu extract
CPU(s): 8
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 1
Model name: Intel(R) Atom(TM) CPU C2750 @ 2.40GHz
CPU MHz: 1300.053
CPU max MHz: 2401.0000
CPU min MHz: 1200.0000
# lsmem extract
Memory block size: 128M
Total online memory: 16G
Total offline memory: 0B
# fdisk extract
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
```
### Usage
This server is running around 30 LXD and Docker containers:
* Garaia's main machines (and sattelites now that the service has been discontinued)
* Garaia related services (Minio, some RDBs and caches, Gitea, ...)
* Support/infra services (ssh access, borg backups, vpn)
* Docker related services (registry, registry browser, portainer, ...)
* Some user related services (Syncthing, Vaultwarden, ...)
* Test/tryout machines and services
All in all, this server is rather under-used at 8% CPU usage and under 3 GiB of RAM needed.
![CPU](https://gitea.micouleau.info/alex/homelab-project/raw/commit/44880e7c6fb01e1e8de1a0c4c4785a3b2389114f/htop-sd.png)
![RAM](https://gitea.micouleau.info/alex/homelab-project/raw/branch/master/ram-dedi.png)
### Running costs
Price for this machine is 32 € / month.
## Home NAS
### Specs
Qnap TS 451+ :
* Intel® Celeron® J1900 4-core/4-thread at 2.0GHz (turbo: 2.42 GHz),
* 8 GiB RAM,
* 4x2To disks set in a RAID5 array.
This NAS is already 7 years old and has proven reliable.
I already have had to change failing disks which was a satisfying experience.
I really enjoy the 3 disks + 1 parity setup, nice balance between disk loss and security.
### usage
![qnap usage](https://gitea.micouleau.info/alex/homelab-project/raw/branch/master/htop-qnap.png)
Here is the obeserved usage of this NAS :
* 5 - 10 containers (Docker + LXD)
* 15% CPU
* 4GiB Ram (~50%)
* 700-800 GiB storage (12-15% total storage)
### Running costs
Power consumptions benchmarks are easy to find over the web for the TS 451+.
Taking into account my average usage, I recon my TS 451+ consumption to average 30W which would amount to 5.58 $ / year in electricity.
Since the NAS is now old, its acquisition cost is out of the scope, but its safe to say that I'll need to replace one of its disk every 18 months. The last disk I bought was 60€ so 40€/year.
The monthly cost of this NAS thus amounts to 3.75€/month
## Conclusions
<b>For running all my services, the two machines consume around :
* under 2 GHz cores full time (the cpu cores of my two machines are similar enough to be aggregated)
* less than 8 GiB of RAM
* around 850 GiB of disk space
In terms of monthly costs we're set at around 36 € / month
</b>
# Ebay browsing
I went for the <b>"best bang for your buck ®"</b> strategy there, even more so, <b>"What's the dirt-cheapest server I can find that will have the specs necessary to replace my stack ®"</b>.
Being a great fan of [Stéphane Graber's videos](https://www.youtube.com/@LXD), where he once showcased his 3 servers cluster bought on ebay for "250-300$" each, I decided to take that that as my price base.
And indeed, there are lots of servers to buy from ebay for 250$. The data center industry is pushed to acquire every new generation of servers as they generally present real advantages on the performance or TCO front. 2 generations later you have myriads of servers that no one is interested in getting, safe for the personal hobyists as myself.
But even those servers are far too powerful for my needs and being determined to go the miser way, I eventually found this beauty :
![ebay_offer](https://gitea.micouleau.info/alex/homelab-project/raw/commit/37dd4dcf0aea6879754f1c345fc5bc1acac56048/ebay-offer.png)
Yep, a hundred bucks, 130 € with shipping for something incomaparably more powerful than the Atom I rent. And at half the price I was set on. It's also a HPE, so good hardware and a brand commonly used at Canonical, this looks like a great candidate !
Now, let's get some disks. So, it's worth mentioning that server manufacturers are apparently not the best in class when it comes to open standards, interoperability, support and maintaining legacy hardware. HPE, as you'll read [Part 2: Install the server](later) is even pretty bad on that front. Unsupported hardware, unmaintained software.
For instance, I read that HPE is only supporting their own brand of hard disks (not the cheapest one obviously). Some hardware may work fine, but some disks might have the effect of having the fans running full speed continuously. Luckily I stumbled upon this offer
![ebay_disks](https://gitea.micouleau.info/alex/homelab-project/raw/commit/9769a81d550ccb2a177abd0821cc15613d5950fd/ebay-hdd.png)
4 HDD certified for my server for a total of 115 € with shipping. They are second hand HDD. But they are sold as "working". I'll run some tests on those to check their real mileage.
This config is promising as it looks like it fits both my needs and budget.
## Specs comparison
The config I am running for is clearly an overkill in terms of CPU :
![Cpu comparison](https://gitea.micouleau.info/alex/homelab-project/raw/branch/master/CPU%20scores.png)
This config will provide:
* 24 vcores (when I really need about 2 of them)
* Twice the computing power each core being twice as powerful as the CPUs I am currently running
* 48 GiB of ram when 4 were really needed and 16 was the target
* 1.8TB of disk space so twice my current usage
* in short tons of overhead to have fun and experiment with
## Costs Comparison
### Buying costs / CapEx
In total for server, hard disks, and shipping : under than 250€.
I think I could run this setup as is for at least four years, given I replace 1 HDD/year on average.
* 250 / 4 = 62.5 € amortization / year
* 130 / 4 = 32.5 € replacement parts / year
**Yearly CapEx would amount to 95€/ year or 8€ / month**
### Running costs / OpEx
As the server will most probably be as idle as the existing setup, I envision it will consume around 180 to 200W.
At the current prices of energy in my area the yearly cost of energy would amount to around 35€ / year or 3 € /month
### Costs verdict
**I would drop down from 36 € per month to 11.** a discount of around 70 %.
Break even is also very fast as I'll have returned my investment by the 12th month.
[Article](article_home)