Website TODO

Created 2024-07-04, Updated 2024-10-02

I expect this will be somewhat of a living document as I check items off and get more ideas. I may also add notes on how I do things, if they're not significant or interesting enough to deserve their own post.

CSS Styling

My goal with styling the site is to start very simple and build up over time. While I know some HTML at least, I know zero CSS. To begin with I'm borrowing heavily from James G's lovely blog because I like how simple but effective his styling is.

  • 2024-07-04 Added basic colors and width definitions.

SSL and Better Hosting

The site is currently served from the static-web-server container. This is sufficient for now, but I will likely want something a little more capable in the future. Now that I actually read their site, though, it may work for me longer than I thought. It does support TLS, at least.

Update: 2024-10-02

It's been a while - crazy end of summer. Finally getting some time to get back to this.

I originally looked into hosting with Docker, both building my own set of containers and running linuxserver/swag as an all-in-one solution. I ran into a few problems along the way (chief among which was being unable to get containers accessible from outside due to some forwarding or firewall issue), and eventually decided to go old fashioned and just host on bare metal. Maybe eventually I'll move to nix or something to make it reproducible - but the setup for something this basic really isn't that difficult.

First step: SSL

I followed the steps here to get certbot installed. I also had to pip install certbot-nginx for the nginx plugin. The default contents of /var/www were enough to confirm HTTPS worked when I started nginx.

Now, hosting

I chose nginx to run the server mostly because I previously used it as a reverse proxy on some personal infrastructure, so I have some idea of how to configure it. (I've since moved to traefik so I had forgotten a fair amount anyway).

Here's the configuration, in /etc/nginx/sites-available/xylemphloem.xyz:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    root /var/xylemphloem.xyz/public;
    server_name xylemphloem.xyz;

    ssl_certificate /etc/letsencrypt/live/xylemphloem.xyz/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xylemphloem.xyz/privkey.pem; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/xylemphloem.xyz/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xylemphloem.xyz/privkey.pem; # managed by Certbot

    location / {
        root /var/xylemphloem.xyz/public;
        try_files $uri $uri/ =404; # Serve files or directories
    }
}

# Redirect http
server {
    if ($host = xylemphloem.xyz) {
        return 301 https://$host$request_uri;
    }
    listen 80;
    listen [::]:80;
    server_name xylemphloem.xyz;
    return 404;
}

The "managed by Certbot" lines aren't, actually - I copied them over from what certbot put in the default site configuration. We'll see how this works on renewal.

Enable the site:

sudo ln -s /etc/nginx/sites-available/xylemphloem.xyz /etc/nginx/sites-enabled/xylemphloem.xyz

The final step is building the site in /var/xylemphloem.xyz - time to retire my dockerfile and run.sh from my initial setup. A one-line docker command does it - honestly not sure why I didn't do this to begin with.

docker run -u "$(id -u):$(id -g)" -v $PWD:/app --workdir /app ghcr.io/getzola/zola:v0.19.1 build

With an nginx restart, we're off to the races!