fix: ensure SSR always fetches fresh assets from database #9

Merged
kfj001 merged 5 commits from bugfix/ssr-asset-freshness into main 2026-08-07 16:43:17 -07:00
2 changed files with 20 additions and 7 deletions
Showing only changes of commit 89cac854ae - Show all commits

No files matched your search

+3 -2
View File
@@ -5,8 +5,9 @@ set -e
# Ensure nginx can write to the shared logs directory # Ensure nginx can write to the shared logs directory
mkdir -p /logs && chown nginx:nginx /logs mkdir -p /logs && chown nginx:nginx /logs
# Render nginx config from template # Render nginx config from template to /etc/nginx/nginx.conf
sed "s|__API_UPSTREAM__|${API_UPSTREAM}|g" /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf # (full config, not conf.d/ snippet — avoids Alpine include nesting issues)
sed "s|__API_UPSTREAM__|${API_UPSTREAM}|g" /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/nginx.conf
# Render client-side config.json for fallback use # Render client-side config.json for fallback use
envsubst '${API_PUBLIC_URL}' < /usr/share/nginx/html/config.json.template > /usr/share/nginx/html/config.json envsubst '${API_PUBLIC_URL}' < /usr/share/nginx/html/config.json.template > /usr/share/nginx/html/config.json
+17 -5
View File
@@ -1,9 +1,19 @@
# Map ISO timestamp to date-only string for daily log rotation # Full nginx configuration — rendered to /etc/nginx/nginx.conf
map $time_iso8601 $log_date { # (NOT placed in conf.d/ to avoid include nesting issues with Alpine nginx)
"~^(?<date>\d{4}-\d{2}-\d{2})" $date;
default "unknown"; user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
} }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format kmtn_json escape=json log_format kmtn_json escape=json
'{' '{'
'"time":"$time_iso8601",' '"time":"$time_iso8601",'
@@ -11,7 +21,8 @@ log_format kmtn_json escape=json
'"x_forwarded_for":"$http_x_forwarded_for"' '"x_forwarded_for":"$http_x_forwarded_for"'
'}'; '}';
access_log /logs/access-$log_date.log kmtn_json; access_log /logs/access.log kmtn_json;
sendfile on;
upstream ssr_backend { upstream ssr_backend {
server 127.0.0.1:4200; server 127.0.0.1:4200;
@@ -83,3 +94,4 @@ server {
add_header X-Powered-By "Angular SSR" always; add_header X-Powered-By "Angular SSR" always;
} }
} }
}