↓ Skip to main content

Website backend and Homelab

·

Introduction.
#

So this website is fully selfhosted by me on my own hardware. I will explain why i chose to go this way down below. There are some important and ethical factors at play for the reason why i chose to host it on a physical computer in my bedroom. I will also explain a bit about the setup i am hosting everything on.

What is Cloud hosting?
#

Many websites these days are hosted on big cloud platforms like Amazon AWS, Microsoft Azure, Cloudflare and others. Very big tech companies with a lot of money and influence. Many if not pretty much every website you visit is hosted on one of those 3 platforms controlled by those tech giants with billions of dollars, pretty much all owned and operated by some of the wealthiest people in the world. Those companies own giant datacenters with millions of servers all scattered around the world, to give you the best and quickest connection and give high availability as another niche point. Most of the time the process to deploy is also very easy. You give them money, they give you a template for a server, often for X amount of money providing you with X amount of CPU cores, X amount of memory and X amount of disk space. Often also having additional features like bot protection, backup recovery, high availability, fire walling, but you of course got to pay extra for that. They will then often do the work for you of hosting it and making sure your website is alive. Thats all great and easy, but there are a few downsides!

You own NOTHING!
#

So why did i not go the same direction as the rest and host my website in the cloud? Well thats because i like having full control and ownership over my products. These days the word “buy” or “purchase” or “ownership” does not mean what it meant a few years ago. The word “buy” should mean you throw money at it and then it will be yours for the rest of your life. And “ownership” should mean you own it for the rest of your life. But these days that word does not mean that anymore. If you buy a physical device with your own hard earned money, companies can just snatch it from your hands at any time, often without any legal troubles. You bought a digital game and the button really did say “Buy”, they can at any time remove or take down that game and then you lost money and don’t get anything back. Even if you buy the physical disk, some games rely on an active connection to some servers and they can just take those servers offline. Remember: The button did not say “rent” or “buy for X period”, it said “buy”. You bought something with your own hard earned money, they said “you can buy it from us”, you should expect it to be fully yours as you paid for it, so its your possession, but it aint!

This is also the lack of Ownership. If you buy a WiFi speaker, you expect it to just connect to your WiFi and play your playlist from your devices. Sadly the manufacturer can brick the speaker remotely or pull the plug out of the back end services, the speaker fully relied on for even basic functionality and then your expensive WiFi speaker becomes ewaste. You bought it and you should own it and the speaker should work till it physically breaks, but the manufacturer says “no” and often wants you to buy their new speaker with extra functions and bells and whistles you never asked for. Sonos is an example. they pushed a specific firmware update that bricked the old Sonos S1 models just because Sonos wanted to end that line, should not mean the consumer cant use it anymore. The consumer bought it with their own money. If i buy a book or DVD, i expect it to be still readable/usable when i am 95, but that cant happen or else the companies cant earn all those millions as long lasting devices never break in 6 years. The products last and are just built like actual tanks. This makes it so consumers dont want their newer even more shiny product with even more features anymore, cause why replace something that works? So that means the companies have to break the products so consumers finally will buy a new products, even though that product could have easily lasted 10 years more.

- What is selfhosting?
#

So as the word says, self hosting means hosting stuff yourself using your own hardware and software, without relying on a major 3rd party. This gives you control and ownership over the stuff you selfhost. Nobody can change the TOS (terms of service) after the deal/contract and nobody can raise prices or collect data, you are the boss and main decision maker over it all and not some rich company’s board of directors. This also allows you to host anything you like as you are not bound to the rules of X company which gives a lot more freedom too. SO in a nut-shell selfhosting gives: control, freedom, ownership which is really appreciated in todays modern age, where companies often dont like you owning things you paid for. They can even scoop it straight out of your hands at any time if they feel like. And freedom from companies also means you dont have to try and be friendly towards them and fear them dropping or suing you over some thing you said one day. I like free speech (although within the boundaries of not harassing someone) and some companies sadly dont like that, so thats another reason i wanted to selfhost.

- What is a Homelab?
#

So a homelab is when you have a collection of computing and networking gear/hardware that is tied to each other and allows you to host stuff on. This does not need to be a 10k dollar server and 10Gig internet. It can be anything from a cheap single board computer like a Raspberry PI, to your grandpa’s old pc, to an old smartphone you had laying around in a drawer, to a small office (mini)pc, to a old retired server of some company. Basically hardware does not really matter, as long as it can run and host at minimum one service, it can be considered a homelab. A homelab can be as small or advanced as you like/can afford and there are not really any limits. And in terms of networking, you can start with a 100mbps plan no issues (as long as you are not hosting a service that relies on fast speeds). And as named before: It gives you control, ownership, freedom over your own stuff. Also the joke people make about “The cloud is just someone else their computer” is true, but in the case of homelabbing its your computer and you dont need to keep that external person happy. And just privacy, you wont have a major company snooping on your data.

Introduction to My Homelab
#

So i run a small homelab. Its a basic rack with a bit of hardware inside in the form of some networking and computing. Most systems i bought myself but also a few i got from family and or friends. It was a real investment but i am happy to have it and i use it daily now! Very proud of it and while its not as big or complex or clean/expensive as the setups you find on r/homelab on Reddit, i do enjoy it. It runs what i need and i run some stuff on it to escape the gripes of bigtech and just to get a bit more control and ownership over my stuff. Primary things i rely on are listed down below. I do plan to of course when i get my own house, to expand it even further and to add more powerful/expensive gear and faster internet. But as i said above, a homelab can be as small/larger as you want and everyone starts somewhere. I am very happy with my homelab rack. Its placed in a convenient empty corner of my bedroom so its not next to my bed either. It does produce some noise and does draw some power but i try to optimize that and i can live in a noisy environment and weirdly enough it brings me peace and i can sleep better if i have some background noise. I also try to keep the “FAF” Aka Family Approval factor, so i try to get gear that is as efficient as possible and i try to shut down stuff i can shut down. And i limit it to my own bedroom too. That FAF also influenced some choices you can find scattered about on this page. Power draw is the primary concern and is also what i am still working on. Because i live at my parents house, i dont pay any electricity bills but i try to limit the power my homelab uses so we dont get skyscraper high bills or atleast try to limit the impact it has.

My Home lab: Networking.
#

So because i live at my parents house and i am a student who does not have a money tree in his garden, i use our house’s network provided by our ISP Vodafone/Ziggo. They are a Dutch ISP that provide internet, phone services and TV. At our house we have a 1Gig plan off 1Gbps download and 100Mbps upload speeds via DOCSIS coaxial. Actually we had a 700meg plan first, but our ISP upgraded us to the 1 gig plan for free so thats kinda nice of them. They have a HFC (Hybrid Fiber Coaxial) network, this means its partially fiber (from the data centers to the street distribution box) and then from that distribution box is coaxial to the homes. They gave us a main sagemcom modem and 2 wifi boosters of the same brand. Because my family is not that tech savvy, i am the one who installed and manages everything, so i am also the local IT support for my family (and also our neighbor). Networking is a critical part of homelabs and its the back haul that connects everything together. Networking can be considered all infrastructure and roads/highways connecting cities, towns and even countries together. In this metaphor, the roads are the cables and the cars the data packets and the infrastructure holds and makes sure everything is connected to each other.

- Wifi backhaul.
#

Because my bedroom is upstairs and our modem is on the main floor, i could not simply run an ethernet cable upstairs, at least not cleanly and i did not feel like doing irreparable harm/modifications to our house, so i had to get a bit creative for it. Because our ISP had given us 2 wifi boosters which use MESH and can connect via wireless with the main modem, i decided to put one in my room and sync it to the modem downstairs. The other one stands by the TV in the living room as our TV area also needed good internet. Speeds are actually not that bad and i could easily get near 1gig in my bedroom so the setup does seem to work great and with minimal losses. This AP has a ethernet LAN port i could use for the homelab so thats also handy! Also kind of handy that the modem is physically isolated from the AP upstairs so in case a lightning surge travels through the coax cable, it cant fry my stuff upstairs (or atleast not directly).

I am quite happy with the plan, but i am getting sort of a bit of FOMO (fear of missing out) when i see that KPN and or Delta or other providers have full FTTH (Fiber To The Home), with more upload speeds. But thats also a limitation i am wiling to accept when i am still living at my parent’s home. Ziggo for the rest does work fine and we had little issues with them and my dad and brother are huge football and sports fans, so thats also a reason we chose ziggo as they provide exactly that in terms of TV.

- Opnsense router.
#

So for a homelab it is recommended that you separate your gear from your ISP’s network. So thats what i did! Instead of the LAN output of that Wifi AP feeding straight into my primary network switch, it first goes to my Opnsense router. This is just a standard HP Prodesk 400g6 with an i3 9100, 8GB ddr4 ram and a 128GB nvme ssd as the boot drive. It also has a dual 2.5GB Intel I226 NIC (Network card) slotted into the PCI slot. This is because you need 2 ethernet ports. A WAN (basically the input) and a LAN (basically the output). The Prodesk costed me around 90 Euros from Marktplaats (can be considered a sort of dutch version of “ebay”). The NIC card costed me 40 euros so not that cheap, but it is 2.5Gbps you are paying for. Our ISP does not yet provide more than 1 Gbps (except for companies), but future proofing is always nice! The pc runs Opensense which is a FreeBSD (Another Unix-like operating system. Also is the basis of MacOS and PlayStation OS and also powers Netflix servers) based Operating System that is tailor made for routing and firewall purposes.

Its fully Opensource and very stable because its FreeBSD based. FreeBSD is like Linux another Unix-like operating system. It is different as FreeBSD is a full complete unified OS, while Linux is just a kernel and thus requires other components made by other groups to be a full Operating System distribution. This means all components of FreeBSD are developed by the same group of people and you wont really have any outside dependencies. FreeBSD does have a slower development cycle and is less cutting edge than Linux, but it does trade that slower cycle and less hardware support for more stability. Its Networking stack is a lot better and more mature and stable than that off any Linux distro and its also one of the reasons Netflix uses FreeBSD to power the servers as opposed to most companies choosing Linux (or windows Server in some cases).This OS allows me to turn the pc into a router. This basically means i can have this router purely for serving my homelab and private network. And because its also a firewall it means i can isolate and protect our home’s network from my servers and gear and private network and vice versa. This also means i can have a different subnet/isolated network so i can do changes that wont affect the whole house, which is great for the FAF (Family approval factor) :).

As a subnet (basically what format IP address is used. Eg 192.168.x.x for most devices, 10.10.x.x or any other for other purposes) i chose 10.10.x.x instead of 192.168.x.x (the default subnet). This is because i found it to be cleaner and then i fully am separated from the 192.168.x.x subnet our ISP router comes with. Also 10.10.x.x is easier and quicker to type than subnets with 3 digits.

I wrote a full article about setting up and deploying Opnsense Here. It is a very old article but it does match with what i am describing here.

* Opnsense unbound DNS.
#

This router also runs my DNS. DNS is basically the phone book of the internet. A computer does not understand the name google.com but it can understand IP addresses. DNS is basically like in a phonebook. when you want to call up your friend and dont know his number. In the phonebook you then look up that friend’s name and then find his number to call. Thats basically how DNS works. The computer wants to reach google.com but only knows the domain. It then hits up a DNS server and says “may i know the phone number of google.com please” and that DNS server then looks into its database and sends back “Google.com can be reached at this number 123.123.234.123” and the the computer can call up that server. Unbound allows you to add blocklists to it. Basically these lists are the equivalent to the “Do not call” lists and thus can contain people you dont ever want to call (for example your ex). In the networking world it contains domains you dont want to be able to reach. This could be advertisement domains or telemetry/tracking domains, malware host domains, etc etc etc. Aka domains you dont want to connect to. I added blocklists to unbound so i can get rid of advertisements, tracking and also malicious domains which power sketchy/dangerous domains you can one day happen to accidentally stumble upon. This makes it so i can enjoy my stuff without being bombarded by ads or having all my data sold.

- Primary NetworkSwitch.
#

So after the internet connection comes out of my Opnsense box as 10.10.x.x, it connects via a CAT6e cable to my primary switch. This switch its task is to distribute the connection evenly across all connected devices. This makes it that i can hook up all gear to the switch and then have 1 cable going/coming to/off the router, so i dont need a gazillion routers and thus 1 router can serve the whole network. The switch i use is a zyxel GS1920-24HP. Its a POE switch, meaning power over Ethernet. This means it can do POE. Poe is basically where you can send data and power over 1 LAN cable to the device. This is handy for things like IP phones, Access points or security cameras so you only have to run 1 wire and dont have to worry about powering the device or finding a socket near the device. It also comes with 24 ports which is great for hooking up a lot of devices. It also has 4 SFP ports which allow you to connect fiber to it for either data input or output. It is SFP and not SFP+ so cant do 10 Gigabit unfortunately, but thats not really a concern/limitation right now. Also the switch was very cheap and i needed a switch with more ports as before i used a zyxel gs1900-8 switch with only 8 ports and no PoE. It runs Zyxel’s own ZyNOS which is an RTOS (Real Time Operating System) and thus not Linux based lie other switches or network gear. This switch OS takes care of all functionality and powers the switch and makes it that you can manage it via the WEB (or on some variants over a console cable). It can be compared to the cisco switches which also run a RTOS. This also means you cant potentially install a custom firmware like OpenWRT on it but for now that is not really an issue and in general an RTOS is purposely application built and thus very safe and stable.

- Primary Wifi AP.
#

So i have a netgear Wax218 wireless access point that has Wifi6 and is what provides my own private network. It has OpenWRT installed on it and it is powered and fed data by the switch over PoE over a single cable. It can do speeds of up to 2.5Gbps and is what powers my 309Electronics_OpenWRT private network i use. This is behind that opnsense router and thus also means whenever i am connected to this AP i get an ad free experience. Another bonus is that i can via this AP access all my servers and selfhosted services with no issues and without needing a VPN or tunnel. I also simply wanted a private network for a long time! And also because i did not want to cause any problems with user experience for my family, i did not install an ad blocker on the main network. They chose to keep using the bigtech provided services and some of those services are very strict when it comes to ad blockers so i simply chose to not deploy an ad blocker on the main network.

- IOT Wifi Ap.
#

So currently i use a deco M4r as the AP that provides WiFi to all my IOT devices. You should always isolate/separate IOT devices and put them on their own Network so thats what i did. The deco powers my 309Electronics_IOT IOT network which i separated from my main network and also its a Wifi5 network which works better with IOT devices as not all devices like Wifi6. This is not powered over PoE but i plan to eventually swap it out with a PoE access point.

My home lab: Servers.
#

So for a homelab you also need computing hardware. This is what hosts your services.

- Proxmox Servers.
#

So i use Proxmox as one of the primary Operating Systems for my homelab. I have 2 pcs that run it. Its based on Debian and is a virtualization hypervisor meaning you can run multiple virtual machines (VM’s) or containers on just 1 computer/host. Basically you can have multiple smaller computers on 1 computer. This means you dont specifically need 100 individual systems to host 100 different services. Big cloud platforms also utilize virtualization as otherwise you would need an infinite amount of individual servers. This also saves cost as you need to invest one time in a good system and then can run multiple things on it.

* “Main” Proxmox server “HiPerIN”.
#

So this is my “main” server. Main in quotes as it is not really the server i absolutely depend on. Thats my other server i will talk about below. I call this my Main server as it is the first server i hosted stuff on and started with proxmox on. This used to be my “gaming” pc before i got my powerful gaming laptop i have now (which has an i7 13650hx, 24GB ddr5 and rtx5070M gpu). That pc has a I5 12400, 16GB ddr5 ram and has a 512GB nvme boot drive. I added an extra 1TB HDD to it and another 512GB sata m.2 ssd for storing the VMs and containers on. This used to in the past run my other services i now transferred over to the other system. But for now it primarily runs my power hungry tasks like a modded private Minecraft server or a Windows11 Virtual machine i can remote into from any place for doing quick tasks that require windows, without me needing to shutdown Linux, boot up windows, (probably) wait for updates, boot up windows again and then finally be able to use it. I might also run Local AI on it one day when prices drop down and i can get a nice GPU for under 1000 euros. Thats also what i based the name on. HiPerIn stands for “High Performance Intel Node”. I did wire in a esp8266 mcu board so i could turn this server on and off on demand, so i could turn it off if i dont need it to save power and turn it on when i need it.

* My Actual Main server “HEIN”.
#

So this can actually be considered my main server. Or at least this is what i host most of my major services i use on. This is a Acer veriton system with an i3 10100, 8GB ddr4 and 128GB NVME boot drive. I later added a 500GB desktop hdd for which i did first have to create a custom cable to power the drive (i made a video about it on tiktok). This pc was 70 euro off marktplaats and for a 10th gen system in my country and in todays inflated market, 70 euro is an awesome deal! This runs my services i write more about down below but in a nut shell it runs this blog, my links page, my forgejo git server, my tailscale vpn (i use for remote management and access to my homelab when i am away), my nginx proxy manager reverse proxy, comments API for the blog, analytics system for the blog, likes system for the blog, newsletter system for the blog, My private password manager. So it runs quite a bit of stuff and everything works nicely! Called it HEIN standing for “high Efficiency Intel Node”, also as an i3 10th gen is quite efficient and is powerful enough for the task. This server will stay on pretty much all the time (except maintenance and cleaning of course).

- NAS (Network Attached Storage).
#

So a good homelab also has a NAS. A NAS Stands for “Network Attached Storage” and as the name says is a storage box thats connected to the network and thus can also be accessed by devices on the network for either writing data to or reading data off. Its basically cloud storage without the cloud. You can upload files or download files. My NAS is a system i built myself but you can also buy prebuilt NAS solutions. A NAS is just a computer that has no display and has a bit of storage inside of it in the form of Harddrives (HDD) or solid state drives (SSD) and that runs a OS that makes it a Network storage. I use this NAS to store my pictures, media and files. Also i backup all servers to it and i use it to transfer footage to my laptop for editing (for my tiktok videos and other videos). And its another thing i can replace a bigtech service with as for this i dont need to rely on google drive or Microsoft onedrive.

* The Computer & case.
#

The computer is a Asus pc i bought of marktplaats. It came with an i5 10400, 8GB ddr4 and 128GB NVME boot drive and came in an midtower case. I ended up transferring over the guts to a new bigger (kind of gigantic) Asus pc case with enough space for the storage and fans for cooling. This runs TrueNAS, a debian based Operating system tailored for network storage usage. This makes the computer a NAS and handles all stuff a NAS needs to do to function as a NAS. I ended up putting in another stick of 8GB of ddr4 ram so i could have 16GB ram as I wanted to run some more stuff on the NAS like a media library and google photo’s alternative. I also added the single NIC card out of my old Opnsense router in the NAS as i wanted to prepare it for 2.5Gig speeds so i could in the future transfer over data from the NAS to my laptop and reverse. I got this for 100 euros.

* The Storage HDD’s.
#

So as primary bulk storage i bought 4x 2TB HDD’s of eBay. They where from a reputable refurbished reseller who said they where healthy and in good shape and when they came they where indeed perfect health and shape and i did extensively test to make sure the seller claims where reality and they where! Buying used HDD’s is always a gamble but for me it turned out great. I bought 4 so i could have 2 pairs of 2TB forming in total 4TB usable capacity. This also meant that each set had a redundant drive so in case 1 drive of set 1 fails, i dont loose data. Redundancy is important as you dont ant to have data loss because a single drive you relied on failed. redundancy and having a backup in each pair at least decreases that chance of data loss. And of course go by the 3, 2, 1 method. 3 copies, 2 different mediums and 1 offsite/cloud. These 4 drives costed me in total 200 euros.

* The HBA.
#

They where SAS drives meaning Serial Attached SCSI and thus they could not be plugged into a standard pc motherboard. The plugs do look similar and with a bit of improvising can fit, but SATA controllers cant interface with SAS drives, while SAS controllers can interface with SATA drives. So what i needed was a HBA (Host Bus Adapter) this is a PCIE card that allows me to interface with those SAS drives. The card i bought was an LSI9300 and it had 2 channels which could support 8 drives in total. This means i could plug in all my 4 SAS drives into Chanel 1 and have channel 2 free to use for other drives. Channel2 i ended up plugging in 2 sata ssds of 500GB each so i could have 500GB of faster storage for stuff that benefited from quicker storage. This card was about 50 euros.

* Cloud backup.
#

So i am not totally Cloud-free but thats not an issue. I am not directly relying on the cloud. Its purely used for backups. I backup my NAS to a hetzner storagebox incase the NAS crashes or fails so i wont loose all important files. Its Hetzner, a German company and while i dont trust any cloud solution, European cloud is higher on the list of trust than American or other solutions. I do have it setup that TrueNAS first encrypts the data so it never gets uploaded to the cloud unecnrypted and thus even if they could breach it, it will just result in gibberish and random bits instead of sensitive data. I Store the key to decrypt it and the instructions to mount the storagebox on paper and in a document on my laptop. It mostly contains my backups and pictures and stuff i cant loose. It does not contain media as media can be replaced (atleast higher chance to replace media than delicate family pictures or passwords/keys).

- Homeassistant server
#

So this is my Homeassistant server. It runs my local Home assistant smart home. Its a dell optiplex 3040 mini with an i3 6100, 8GB ddr3 and 500GB laptop HDD. This runs Homeassistant OS, a custom Linux based operating system built using buildroot to run the homeassistant framework. I got this for free from a family member.

My home lab: Services
#

So below are all the services i run in my homelab with an explanation why and on which server i host them. This is more about the software side of the spectrum.

- Homeassistant
#

  • Hosted on the Homeassistant Mini PC: So Homeassistant or HA for short is an opensource privacy focused selfhostable smarthome platform that supports many devices and is powered by a whole community of tinkerers and developers. The aim is privacy and local control without a big company being involved like Apple/Amazon/Google/Tuya. Its meant to be by the community for the community/people and its run by an independent company. It has dutch origins as it initially was a small project started by a Dutch person named Paulus Schoutsen and initially was a few python scripts to control his Philips hue lights. The community saw potential and it quickly grew out to be one of the most active (smarthome) opensource projects. It is now run and backed by an independent company called Nabu Casa who Paulus Schoutsen created. Also the lead Developer, Franck Nijhof is also from the Netherlands.

- My Blog
#

  • Hosted on a Proxmox LXC on the HEIN node: So
Author
309Electronics