6.1 KiB
title | date | draft | searchHidden | tags | summary | cover | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How I Made This Site | 2022-08-31T20:38:09-06:00 | false | false |
|
This is the summary |
|
I've dreamed of this day but never imagined I'd actually stop playing league long enough to do it. Turns out, we each have a streak of awesome inside each of us just waiting to burst forth.
How do websites work?
Back in my senior year of highschool, my buddies and thought it would be funny to have our own blog / website. I didn't think there was much to it, so I turned to godaddy.com, the only website-buying marketplace around. Little did I know that they only sell domain names, and there aren't in a monopolistic market. Did I pay $20 for a domain name? Splashthetown.com says yes. Did I have a website? Nope. Two-thirds of a CS degree later and I think I am finally ready. Billions of webpages exist on the internet, so it can't be that difficult, right? I'm going to walk you through the steps I undertook to get this website to you, and how you are able to see the words you are reading on your screen right now.
Internet, I've Heard of That
I once heard the internet described as "the cloud", which is good to help people understand you know nothing about it. To give a marginally better explanation, imagine your brain, with all its neurons interconnected and whatnot. Lets call each neuron a "node". Each node holds information, and when it recieves a message it decides what to do with that information, modify it, store it, pass it on, sell it to the highest bidder for ad revenue, the possibilities are endless. In this way, the brain is much like the internet. These "nodes", or nuerons, are actually computers that make up the internet, a big web of interconnected, communicating devices. I know hardly anything about the brain.
How did I get Here
Here is the process when you type in or click on a link in your web browser:
- Your machine sends a request with the link info to the "node" or machine giving it internet, typically a router.
- The router routes your request to an internet "phone book" of sorts to see what machine on the interwebs your url cooresponds to, much like an address on a package you send in the mail.
- With the machines (ip) address known, your package is sent to that machine
- The machine has some code running on it that opens your package, gives thanks, and as quickly as it can manage, sends a package back to the sender with some code.
- That package goes back down the pipes the way it came, your browser opens the package, and you see the package contents,
html
, Mark Zuckerburg pics, cat videos, etc.
How to create your own Node
If you want to put your stake on the great world wide web, then you need a few things:
- The Address - a domain name, purchasing one lets you tell internet phone books where your computer is.
- The Node - a computer that can run some internet code on it. Most people want this to be some computer AWS or other server farm controls so that it stays online 24/7 and can scale easily (your code can be copied to other machines if you get tons of visitors).
- Some internet code, typically called a web server
I will be walking you through the fairly unconventional steps I took to get you here on this web page. There are hundreds of ways to get something on the internet, but my way is certainly one of them. For reference, I am running Arch Linux btw.
Since I don't want to pay $5 a month for ease-of-use and stability and scalability, I will be using a rasperry pi zero w2 plugged into a charging brick behind my book shelf to be the node.
Get a Domain
Any domain selling company online is eager for your money. I've used Name and GoDaddy, but any google result will do. Purchase one, that is all for now.
Write some Internet Code
Actually the goal for me with this site is to not have to write any code at all.
If you don't have a raspberry pi and instead coughed over $ to Jeff Bezos, then get the IP address of your machine and skip to step 4.
-
I used rpi imager to flash Raspberry Pi OS Lite to an SD card.
- You can use any flashing tool, but rpi imager is convenient when working with Pi's, and it lets you configure Wifi so the Pi connects automatically on boot.
-
Put the SD into the Pi and turn it on.
-
Verify it is connected to the internet:
- I use nmap to scan my local network
{{< highlight go >}} nmap -sn 192.168.<insert third octet from device ip here, like 27>.0/24 {{< / highlight >}} This gives me output like
Host is up (0.018s latency). Nmap scan report for 192.168.27.169 Host is up (0.077s latency). Nmap scan report for raspberrypi.lan (192.168.27.161)
-
Use ssh to connect to the device
ssh user@192.168.27.161
. Do not forget to include the user name in the ssh command- For this website, I'm using Hugo, a static site generator written in Go. Follow the instructions here to install and set up a simple site locally with Hugo.
- Once your site is built, run
hugo
in the base directory of your hugo siteuser@raspberrypi:~/foss-cat $ hugo Start building sites … hugo v0.102.2-f104f7bc02f7d23d41f17c7353df1217cf25b2dc linux/arm BuildDate=2022-08-31T10:42:06Z VendorInfo=gohugoio | EN -------------------+----- Pages | 10 Paginator pages | 0 Non-page files | 0 Static files | 0 Processed images | 0 Aliases | 2 Sitemaps | 1 Cleaned | 0 Total in 756 ms