↓ Skip to main content

Website backend and Homelab

·

Introduction.
#

So for anyone curious on How i host my website, below is some information. Most important factors are control and ownership. I will go into detail a bit more under this. I am quite a yapper so if you want to read through this text, feel free to do so but be warned :)! I am now on an upgraded version of the homelab so this page has been rewritten for a large part but you can find the old page Here

Why i selfhost?
#

I primarily selfhost due to a few reasons i will go into detail on down below. But in a nutshell its control&ownership&freedom: less dependence on bigtech and big companies and i also have less trust in bigtech and i like the experience and educational potential and also just the joy of hosting a website on some random computer that was initially meant for the e waste.

  • Little disclaimer: So i am not totally cloud free. I expose the site to the public internet via a Hetzner VPS, so i do kind of depend on the cloud, but that’s also because i believe i am behind CGNAT. That VPS does not actually host the site and just is an Endpoint that connects via Tailscale to my local network behind CGNAT. Also my Domain i bought by a domain provider who probably uses cloud based DNS, But it is still mostly cloud-free or at least they cant touch the content on the site at all. But what you can get rid off, you should get rid off if you feel comfortable in doing so. Also remember that everything has its downsides as thats just how life works.

I like Ownership and control
#

So i am kind of a control freak. I want to be able to control and own the stuff i bought/use. In the end the buttons on websites often say “buy” and not “rent for X amount of time”. SO i do expect to be able to exchange money for a product and then be able to keep the product for as long as i will/as long as it lasts. In the end the bank also does not give me my money back, so why should i give the product back? If i eat at an restaurant, i want to be able to pay for a plate of food. I don’t want the restaurant people to come to my house and take the food i just ate at that restaurant and i legitimately paid for, out of my stomach. However, sadly that is happening with certain products these days. You don’t own your stuff anymore, or at least not for how long you want to. The manufacturer can just snatch the product out of your hands at any time, often with little to no legal consequences or anything in return. And its weird as the button did not say “You can keep this product for X amount of time and then we demand it back and will give you nothing else”. Okay, maybe in the ultra long 500 page TOS (Terms of Service) or the small lettering, but in my opinion they should be clear about it.

When you use Cloudflare or Amazon AWS or Microsoft Azure, they are in control of hosting your site. This has its ups and downs. The upsides are: You don’t have to maintain it every day, you don’t have to worry about security and you have high availability, you don’t need to have technical skills and its just convenient. The downsides are that they are in control and they also own the hardware and servers. So you must keep them befriended and you must obey to their rules and Terms of Service. Sadly these rules and the TOS(Terms Of Service) and prices can always change, sometimes even silent without any notice. And sometimes companies fund questionable or even straight up horrible causes. If you don’t agree to that and you want to keep the company from kicking you out, that’s a difficult position. And also with the big companies is that they always can be sold out and straight up go into a completely different direction than they where going at first.

I Dont trust bigtech.
#

So above i pretty much already mentioned (all of my reasons for) my distrust in big companies, but i just dont trust them hosting my website. Their main model is making money and sometimes they sacrifice the consumer (or their rights) for even more money. And i seen enough big companies turn out to be evil people that i would not want one to touch my website or its content. Planned obsolesence (engineering products to fail after X amount of time), enshtification (making products worse), data collection (collecting data and selling to highest bidder) are some of the stuff bigtech is doing these days to squeeze even more money out of people. Often also in very unethical ways. And as i said above, i dont want them supporting/funding something i disagree with/thats actively harming the world.

Its an enjoyable and fun hobby.
#

Physically owning your own hardware and getting to decide what you want to do with it is fun! You can do anything under the sun, if you know how to do it. There is also plenty of FOSS (Free and Open Source Software) out there that gives you the control and freedom and independence back and sometimes those pieces of FOSS Are better than what big companies can provide. You can also upscale and downscale it. Need more power? get another (better) machine or upgrade RAM/CPU/GPU/STORAGE, you are not bound to a specific hardware template with a subscription. And owning your hardware means you can (learn how to) fix stuff yourself and don’t have to wait for some data center technician to fix it. Also self hosting gives you insights into how a website can go from a few files to a working interactive piece of technology. With self hosting you are not the consumer anymore, you are the system administrator in charge of those top tier systems keeping the world and internet happy. You are free as a bird and go wherever you want! And there is tons of community support. By the community for the community. Also there are many other people doing this adventure in their own ways and there is plenty of support/tutorials and just helpfull help.

What is a Homelab?
#

So i run whats called a Home lab at home. Now not everyone might be familiar with the term, but Homelabbing is basically when you host stuff yourself at home for experimental or privacy reasons. You wont be relying on a major cloud provider or bigtech company and you yourself have full control over it. A home lab consists of hardware and software. The hardware can be anything from a dedicated server to your grandpa’s old computer to a mobile phone, to a raspberry pi or Arduino, the choices are limitless, as long as your hardware can support and run what you want. And the software will most of the time be Free and Open source, but it can also be proprietary software. Just make sure its downloadable by the consumer without having to sign any contract. And finally you need some sort of host Operating System which can run that software. Most of the time a Linux distro like Debian, Ubuntu, Fedora, Arch, etc etc. This Operating System will be in between the software/services you will be running and the physical hardware of the host system, but you can use pretty much any OS.

You have both computing and networking hardware. Computing hardware does as the name says computer things, so runs software, perform calculations and does actions. Networking on the otherhand provides the connectivity. The internet is just a network of computers that are connected to each other and can talk and share information to each other in some way.

My Homelab
#

So below i will go into more detail about what i host in my homelab and the hardware. I run it in my bedroom and it consist of some computers i bought or got donated to me. And a bit of network gear i mostly bought myself (except the internet plan). I am quite happy with the homelab and i love using and having it! Also i built it with as much FAF (Family Approval Factor) in mind! Thats also why i chose gear that does not waste 600w purely for just running a powerpoint.

Network & Infrastructure.
#

Because i am still a student and dont have a money tree in my garden, i live at my parents house currently and thus i can use the power and internet the house provides but i am also a bit limited in terms of Networking mostly, but that wont keep me from being able to do this hobby at all, but everyone starts somewhere.

  • Network speed & ISP: So At our house we have ziggo (dutch cablecom provider) providing our network and tv services. I dont really watch TV but the rest of my family heavily do. 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 neighbour). 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 everthing 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). And it keeps my family happy cause then they wont be able to complain about or accidentally trip over a visible cable. I am quite happy with the plan and setup, but i am a bit dissapointed 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) :).

  • OPNSense router DNS: This router also runs my DNS. DNS is basically the phonebook 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 network switch: 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 gazzillion 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 AccessPoint (MAIN): So i have a netgear Wax218 wireless access point that has Wifi6 and is what provides my own private network. It has OpenWRT (Opensource Linux firmware altenrtaive for supported routers) 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 adfree 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 adblocker 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 adblockers so i simply chose to not deploy an adblocker on the main network to keep things from breaking completely and me having to be called to fix it every day. I like having this Private network for myself that i can completely lock down and control.

  • Secondary Wifi Accesspoint (IOT): So currently i use a deco M4r as the AP that provides Wifi to all my IOT devices. You should always isolate/seperate 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 accesspoint. This is on its own network thats also behind OPNsense and has some DNS blocklists and i also plan to lock it down even more in the future.

Hardware & serverrack.
#

So you also need hardware for a homelab. The stuff that actually hosts the service. I use mostly computers that i bought but i also got some donated to me by family and friends. I also have a rack that houses all hardware. I will start from the bottom of the rack going to the TOP.

  • The Server rack: So to house all the gear i decided to get a rack. Before it was just random computers and wiring scatered around the room, now most of it is all organized into a neater rack keeping it together. Below is a picture of the rack in its glory! Its an Open rack but i might one day enclose it in a custom wooden box but i also dont mind it being open and i will think about that for a bit. It is placed in an empty corner of my room, awawy from the bed. It is kind of loud but i am kind of weird and dont mind sleeping with some background fan noise and its also not that extremely deafining loud.

Rack
side_of_rack

  • The UPS (Uninterruptable Power Supply): SO for a homelab stable power is kind of a must. The last thing you want to happen is that a powersurge or (brief) power outage destroys or damages your expensive gear. HDD’s are sensitive to power dips or outages. They are made to withstand it, but in the unlucky event of a brief power blip, it can cause a headcrash. This is when the read/write head of the HDD (that reads the data of the platter) gets stuck on the platter and can either scratch the platter with your precious data on it or it can stall the motor. In the event of a power surge, the UPS (if it has built-in surge protection) wil be able to limit the damage as it will be the primary device to take the biggest hit. In the evnt of a power outage, the UPS will not be able to run your homelab for a week but its more meant for short power outages. Or in the event of a longer power outage, it alows you to save your files and shut down your gear safely. Its kind of a backup battery but for short periods. The UPS in question is a Energenie eg-ups-1000. This is a pure sinewave version meaning it outputs the same waveform as the power grid. You also have cheaper Units that output a modified or blocky wave but those are not that good for some power supplies and can in some cases damage them. My UPS is an online unit, meaning it is always on. This has advantages and disadvantages. The advantages are that if the power drops out, it instantly switches over to the inbuilt battery (Does not have to switch between power grid and inverter). Disadvantages are that it does mean the inverter inside is always active and thus needs active cooling and thus it has a fan inside. This fan noise is basically the loudest thing i can hear from the homelab.

  • OPNSense box: So on the left of the UPS is my OPNSense box. This is an HP prodesk 400g6 with an i3 9100, 8GB ddr4 ram and 256GB nvme storage. This runs OPNSense and thus is my network’s firewall/router solution. It also has pci NIC card which holds dual 2.5Gig Network interfaces. As described in the Network & Infrastrcuture.

  • PDU (Power Distribution Unit): This is basically a normal powerstrip but its made to be rack-mountable in a network rack. Some versions come with extra surge protection. I have a brennenstuhl branded one which did have surge protection, although i technically would not need it as my UPS already has that built in, but extra protection is extra protection so why not! I rather have the powerstrip and UPS be damaged than everything else.

  • Proxmox node “HEIN”: So above the PDU is my 2nd proxmox node. This is an Acer veriton pc i bought of Marktplaats (sort of dutch version of Ebay) that has an i3 10100, 8GB ddr4 ram and 256GB nvme storage. It runs proxmox, a debian based hypervisor platform. This is basically a platform that allows running multiple small environments (in the form of containers or VM’s) that can run software on 1 physical host. This makes it so i can have little containers host the sites and thus have multiple things hosted on 1 computer. This saves money as i dont have to buy 12 computers to host 12 individua service and it also is easy to use and manage. If a VM or container breaks i simply remove it and revert a backup. And same with if the hardware breaks, i can just transfer the vm or container’s backup file to another host. This node hosts this website and my other sites. I bought this for just 70 euro which really is a steal for a intel 10th gen system. I did add an external desktop HDD to store most of the containers on and for that i had to create my own harddrive powercable as my motherboard had a specific connector to power an external HDD, but i did not bother buying that and instead made my own that taps of power straight from the PSU. Its janky but it works! And the motto goes, if it works, dont touch it! I made a ful video about it on tiktok you can watch.

Author
309Electronics