Hosting this website
02/08/2024
This project honestly was never meant to be what I actually use as my portfolio, but just a test of my abilities. I did however surprise myself and get it working so it is what I have stuck with.
Anyway, on to how this website is actually hosted.
Server
As I have said above, this was never supposed to be even semi-permanent. I honestly thought I'd give up after about a week, but here we are! Anyway, because of that I didn't want to pay for hosting services (I'm cheap), so I decided to try hosting it myself!
A good friend of mine happened to be getting rid of a few workstations whilst I was planning this, which was perfect as it meant I could use them to host this website! Right now this website is running off of one of these workstations running a PROXMOX hypervisor, in a virtual machine running Ubuntu 22.04 LTS server.
Docker & Watchtower
I have a love hate relationship with docker, as I imagine alot of people do. When it works, its great, when I eventually do something I shouldn't have and it breaks, less great. Either way it is something I have been fiddling with for years running various server types (honestly mostly Minecraft servers 🤓), and kind of have the hang of now.
To run this website I'm actually running 3 docker containers at once. One is my Django + Gunicorn container, another is my nginx reverse proxy, and my third is an instance of watchtower. What this combination allows me to do is serve the website and static files (using the Django + Gunicorn container) through the nginx reverse proxy. Watchtower is used to monitor my dockerhub repo/image of the Django + Gunicorn container to check for changes. When I push a change to my github repository it builds and pushes the image to dockerhub using github actions, and pings my server's watchtower instance to check for an update. Watchtower then safely shuts down the relevant container if it detects and change and restarts the containers with the new image.