perf(serve): static boot shell, gzip and immutable caching for the hashed assets

Measured against the live host:
- the shell shipped no Content-Encoding, so every visit moved 139 KB of JS raw
  -> gzip on (level 5, vary, text/js/css/json/svg/woff2): 139,433 B -> 49,835 B
- /static/* is content-hashed but had no cache header -> max-age=31536000, immutable;
  index.html is no-cache so a deploy lands immediately
- try_files fell through to a non-existent index.php -> SPA fallback to index.html
- index.html now carries a boot shell (name, role, 'rendering the resume') so a cold
  load shows the identity instead of an empty dark rectangle while the JS types in
- deploy/nginx/me.hoelee.com.conf is the versioned copy of the live config; README
  documents the Portainer archive deploy path, the Tor mirror and the inode pitfall
This commit is contained in:
hoelee committed 2026-11-13 22:40:22 +08:00
1 parent 7f8ac893d0
commit 5727ab0c8a
3 files changed
+110 -5

No files matched your search

+26 -4
View File
@@ -30,7 +30,7 @@ see Credits.
| Path | Purpose |
| --- | --- |
| `src/App.vue` | Desktop layout — orchestrates the typewriter sequence |
| `src/Mobile.vue` | Mobile layout (used when viewport ≤ 500px) |
| `src/Mobile.vue` | Mobile/tablet layout (used when viewport ≤ 900px) |
| `src/config/profile.js` | **All content lives here** — details, Markdown, animation speed, typed CSS |
| `src/components/StyleEditor.vue` | Left panel: highlighted, self-typing CSS |
| `src/components/ResumeEditor.vue` | Right panel: resume markdown → HTML |
@@ -67,7 +67,7 @@ Requires Node ≥ 18 (built and tested on Node 24).
## Deployment
Pushed to **Gitea only** — `git.hoelee.com/hoelee/hoelee-profile`. There is no GitHub mirror.
Source of truth: **Gitea** — `git.hoelee.com/hoelee/hoelee-profile` (mirrored to GitHub).
`me.hoelee.com` is served by an `nginx:alpine` container (`nginx-me.hoelee.com`) on the VPS at
`41.216.187.102`, behind Traefik. The container mounts the built site read-only:
@@ -84,8 +84,30 @@ npm run build
rsync -av --delete dist/ [email protected]:/docker/web/me.hoelee.com/public/
```
The site is static — no PHP or database is used. The `php:9000` upstream in the nginx config is a
leftover from the shared web template and is not needed by this site.
Without SSH the same build can be pushed over the Portainer Docker API with a tar archive
(`PUT /api/endpoints/4/docker/containers/php-me.hoelee.com/archive?path=/var/www/html`) — that
container is the writable side of the mount. Remove stale `static/js/index-*.js` bundles in place;
do **not** delete and recreate the directory, because the read-only bind mount keeps pointing at the
old inode and nginx starts returning 403.
### Tor mirror
The same container is published as a Tor onion service — the unRaid `tor-server` maps
`hoeleeaiwowgndbxswegtdzoeupz7lkkechtqmurbmnpvwa4k3vyuyid.onion` to `41.216.187.102:10001`, which is
this nginx. There is no second copy of the site: one deploy updates clearnet and onion together.
### nginx config
`deploy/nginx/me.hoelee.com.conf` is the versioned copy of the live config (gzip on, immutable
caching for the hashed `static/` assets, SPA fallback to `index.html`). To apply:
```bash
scp deploy/nginx/me.hoelee.com.conf [email protected]:/docker/web/me.hoelee.com/nginx/default.conf
ssh [email protected] 'docker exec nginx-me.hoelee.com nginx -t && docker exec nginx-me.hoelee.com nginx -s reload'
```
The site is static — no PHP or database is used. The `php:9000` sidecar is a leftover from the shared
web template and is not needed by this site.
## Credits
+62
View File
@@ -0,0 +1,62 @@
server {
listen 80;
server_name me.hoelee.com;
root /var/www/html;
index index.html index.htm;
client_max_body_size 100M;
server_tokens off;
# The site is a static Vue SPA: one HTML shell + hashed static/ assets.
# No PHP is served (the php-fpm sidecar is a leftover of the template).
# 139 KB of JS per visit went out uncompressed before this: enable gzip.
gzip on;
gzip_vary on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/manifest+json
image/svg+xml
font/woff2;
# SPA fallback: unknown paths return the shell instead of hitting a missing index.php.
location / {
try_files $uri $uri/ /index.html;
}
# Filenames are content-hashed by Vite, so they can be cached forever.
location /static/ {
add_header Cache-Control "public, max-age=31536000, immutable";
access_log off;
try_files $uri =404;
}
# The shell and the icons must be revalidated so a deploy is visible immediately.
location = /index.html {
add_header Cache-Control "no-cache";
}
location = /robots.txt {
add_header Cache-Control "public, max-age=3600";
}
location = /favicon.ico {
add_header Cache-Control "public, max-age=604800";
access_log off;
}
location ~ /\.ht {
deny all;
}
}
+22 -1
View File
@@ -23,13 +23,34 @@
html { background: #004040; color: #dedede; }
@media (max-width: 900px) { html { background: #002b36; } }
body { margin: 0; }
/* Boot shell: the panes are drawn by a stylesheet the app types in, so without this
the page is an empty dark rectangle for the first seconds. Rendered before the
JS module loads; Vue replaces it on mount. */
#app > .boot {
display: flex; flex-direction: column; justify-content: center;
min-height: 100vh; padding: 0 8vw; box-sizing: border-box;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
line-height: 1.5;
}
#app > .boot .n { font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: #eaeaea; }
#app > .boot .r { margin-top: .4em; color: #9fd6c9; }
#app > .boot .h { margin-top: 2.2em; color: #7f9c96; font-size: .85em; }
#app > .boot .h::after { content: '_'; animation: boot-blink 1s steps(1) infinite; }
@keyframes boot-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #app > .boot .h::after { animation: none; } }
</style>
<meta name="theme-color" content="#004040" />
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
</head>
<body>
<div id="app"></div>
<div id="app">
<div class="boot">
<p class="n">Mr Hoelee — Lee Teong Hoe</p>
<p class="r">Senior Full-Stack · DevOps · AI Systems Engineer — 10+ years, remote (GMT+8)</p>
<p class="h">rendering the resume</p>
</div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>