Commit e4438d6
2026-09-24 01:49:24
Changed files (10)
blog
cgi-bin
blog/archetypes/default.md
@@ -0,0 +1,5 @@
++++
+date = '{{ .Date }}'
+draft = true
+title = '{{ replace .File.ContentBaseName "-" " " | title }}'
++++
blog/themes/hugo-bearblog
@@ -0,0 +1,1 @@
+Subproject commit 87142ecb5fe7f326065a9c25cd7e2cf21e840baa
blog/.gitignore
@@ -0,0 +1,2 @@
+public
+.hugo_build.lock
blog/hugo.toml
@@ -0,0 +1,4 @@
+baseURL = 'https://www.intermittent.network/'
+locale = 'en-au'
+title = 'intermittent blog'
+theme = 'hugo-bearblog'
cgi-bin/fastfetch.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo "Content-Type: text/html"
+echo "Cache-Control: private, no-store"
+echo
+echo
+/usr/local/bin/fastfetch --pipe false | /usr/local/bin/aha -b -t fastfetch
nginx/fastcgi_params
@@ -0,0 +1,25 @@
+
+fastcgi_param QUERY_STRING $query_string;
+fastcgi_param REQUEST_METHOD $request_method;
+fastcgi_param CONTENT_TYPE $content_type;
+fastcgi_param CONTENT_LENGTH $content_length;
+
+fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+fastcgi_param REQUEST_URI $request_uri;
+fastcgi_param DOCUMENT_URI $document_uri;
+fastcgi_param DOCUMENT_ROOT $document_root;
+fastcgi_param SERVER_PROTOCOL $server_protocol;
+fastcgi_param REQUEST_SCHEME $scheme;
+fastcgi_param HTTPS $https if_not_empty;
+
+fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+fastcgi_param REMOTE_ADDR $remote_addr;
+fastcgi_param REMOTE_PORT $remote_port;
+fastcgi_param SERVER_ADDR $server_addr;
+fastcgi_param SERVER_PORT $server_port;
+fastcgi_param SERVER_NAME $server_name;
+
+# PHP only, required if PHP was built with --enable-force-cgi-redirect
+fastcgi_param REDIRECT_STATUS 200;
nginx/nginx.conf
@@ -0,0 +1,71 @@
+worker_processes 1;
+
+load_module /usr/local/libexec/nginx/ngx_http_brotli_static_module.so;
+load_module /usr/local/libexec/nginx/ngx_http_zstd_static_module.so;
+
+events {
+ worker_connections 1024;
+}
+
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ keepalive_timeout 65;
+
+ map $uri $hash_etag {
+ include etag.map;
+ }
+
+ server {
+ listen 172.16.0.2:80 default_server;
+
+ location / {
+ gzip_vary on;
+ gzip_static on;
+ zstd_static on;
+ brotli_static on;
+ root /usr/local/www/blog;
+ index index.html;
+
+ etag off;
+ if ($hash_etag != "") {
+ add_header ETag $hash_etag always;
+ # In theory the s-maxage should cover most cases, the SIE is just
+ # to cover soft-purge followed by origin issue
+ add_header Cache-Control "public, s-maxage=31536000, stale-if-error=3600";
+ add_header Surrogate-Key "blog";
+ # etag is enough, let's not confuse stuff with last-modified
+ add_header Last-Modified "";
+ }
+ }
+
+ location ^~ /cgi-bin/ {
+ root /usr/local/www/;
+
+ # Point to the FreeBSD fcgiwrap Unix socket
+ fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
+
+ # Include standard FastCGI parameters included with FreeBSD's Nginx package
+ include fastcgi_params;
+
+ # Script execution parameters
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ }
+
+ # redirect server error pages to the static page /50x.html
+ #
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/local/www/nginx-dist;
+ internal;
+ }
+
+ error_page 404 /404.html;
+ }
+
+}
.gitignore
@@ -0,0 +1,2 @@
+root
+
.gitmodules
@@ -0,0 +1,3 @@
+[submodule "blog/themes/hugo-bearblog"]
+ path = blog/themes/hugo-bearblog
+ url = https://github.com/janraasch/hugo-bearblog.git
build.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -e -u -o pipefail
+#set -v
+
+# clean and create the output dirs
+rm -rf root
+mkdir -p root/usr/local/www
+mkdir -p root/usr/local/etc
+
+# copy in the nginx and cgi-bin
+cp -r cgi-bin root/usr/local/www/
+cp -r nginx root/usr/local/etc
+
+# generate the files
+pushd blog
+hugo --cleanDestinationDir=true --minify=true
+popd
+
+# generate the etags
+pushd blog/public
+find . -type f | while read -r file; do
+ # trim: ./ -> /
+ WEB_PATH=$(echo $file | cut -c 2-)
+ SHA=$(shasum $file | awk '{print $1}')
+ echo "$WEB_PATH \"$SHA\";"
+done | tee ../../root/usr/local/etc/nginx/etag.map
+INDEX_SHA=$(shasum index.html | awk '{print $1}')
+echo "/ \"$INDEX_SHA\";" | tee -a ../../root/usr/local/etc/nginx/etag.map
+popd
+
+# compress the files
+find blog/public -type f -exec brotli --squash --best \{\} \; -exec gzip --best --keep \{\} \; -exec zstd -9 \{\} \;
+
+# move that in
+mv blog/public/ root/usr/local/www/blog