@smi-digital/create-smi-app 2.4.6 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -39,13 +39,40 @@ services:
|
|
|
39
39
|
depends_on:
|
|
40
40
|
__APP_NAME__-strapi:
|
|
41
41
|
condition: service_healthy
|
|
42
|
+
healthcheck:
|
|
43
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:4321"]
|
|
44
|
+
interval: 5s
|
|
45
|
+
timeout: 2s
|
|
46
|
+
retries: 5
|
|
47
|
+
deploy:
|
|
48
|
+
update_config:
|
|
49
|
+
order: start-first
|
|
50
|
+
|
|
51
|
+
__APP_NAME__-cache:
|
|
52
|
+
container_name: __APP_NAME__-cache
|
|
53
|
+
image: nginx:alpine
|
|
54
|
+
restart: unless-stopped
|
|
55
|
+
volumes:
|
|
56
|
+
- ./frontend/nginx-cache.conf:/etc/nginx/conf.d/default.conf:ro
|
|
57
|
+
networks:
|
|
58
|
+
- agency_shared_network
|
|
59
|
+
depends_on:
|
|
60
|
+
- __APP_NAME__-astro
|
|
61
|
+
healthcheck:
|
|
62
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost/"]
|
|
63
|
+
interval: 5s
|
|
64
|
+
timeout: 2s
|
|
65
|
+
retries: 5
|
|
66
|
+
deploy:
|
|
67
|
+
update_config:
|
|
68
|
+
order: start-first
|
|
42
69
|
labels:
|
|
43
70
|
- "traefik.enable=true"
|
|
44
|
-
# Listen on both www and non-www
|
|
71
|
+
# Listen on both www and non-www
|
|
45
72
|
- "traefik.http.routers.__APP_NAME__-astro.rule=Host(`__PROJECT_DOMAIN__`) || Host(`www.__PROJECT_DOMAIN__`)"
|
|
46
73
|
- "traefik.http.routers.__APP_NAME__-astro.tls.certresolver=letsencrypt"
|
|
47
|
-
#
|
|
48
|
-
- "traefik.http.services.__APP_NAME__-astro.loadbalancer.server.port=
|
|
74
|
+
# Route traffic to the Nginx Cache (Port 80) instead of Astro directly
|
|
75
|
+
- "traefik.http.services.__APP_NAME__-astro.loadbalancer.server.port=80"
|
|
49
76
|
|
|
50
77
|
networks:
|
|
51
78
|
agency_shared_network:
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
"template": "Dockerfile.frontend.ssr.template",
|
|
67
67
|
"target": "frontend/Dockerfile"
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
"template": "nginx-cache.conf.template",
|
|
71
|
+
"target": "frontend/nginx-cache.conf"
|
|
72
|
+
},
|
|
69
73
|
{
|
|
70
74
|
"template": "frontend/src/middleware.ts.template",
|
|
71
75
|
"target": "frontend/src/middleware.ts"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=astro_cache:10m max_size=1g inactive=60m use_temp_path=off;
|
|
2
|
+
|
|
3
|
+
server {
|
|
4
|
+
listen 80;
|
|
5
|
+
|
|
6
|
+
# Gzip compression for faster transfers
|
|
7
|
+
gzip on;
|
|
8
|
+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
9
|
+
|
|
10
|
+
location / {
|
|
11
|
+
proxy_cache astro_cache;
|
|
12
|
+
|
|
13
|
+
# Respect the Stale-While-Revalidate headers from Astro middleware
|
|
14
|
+
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
15
|
+
proxy_cache_background_update on;
|
|
16
|
+
proxy_cache_lock on;
|
|
17
|
+
|
|
18
|
+
# Proxy to the Astro SSR container (internal Docker DNS)
|
|
19
|
+
proxy_pass http://__APP_NAME__-astro:4321;
|
|
20
|
+
|
|
21
|
+
proxy_set_header Host $host;
|
|
22
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
23
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
24
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
25
|
+
|
|
26
|
+
# Add a header so we can verify if the cache is working
|
|
27
|
+
add_header X-Cache-Status $upstream_cache_status;
|
|
28
|
+
}
|
|
29
|
+
}
|