chore: refresh opening hours from Google every 24 hours

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-04 16:25:57 +01:00
co-authored by Claude Opus 5.5
parent 0bce333173
commit 2ca29efd73
5 changed files with 8 additions and 5 deletions
+2 -2
View File
@@ -17,14 +17,14 @@ services:
orari: orari:
# Legge gli orari dalla scheda Google Business Profile (Places API) ogni # Legge gli orari dalla scheda Google Business Profile (Places API) ogni
# 6 ore e li scrive in orari.json (ADR 0005). La chiave sta solo nel .env # 24 ore e li scrive in orari.json (ADR 0005). La chiave sta solo nel .env
# del server, copiato da deploy.sh a partire da .env.server locale. # del server, copiato da deploy.sh a partire da .env.server locale.
image: node:22-alpine image: node:22-alpine
container_name: officinezuliani-orari container_name: officinezuliani-orari
restart: always restart: always
env_file: env_file:
- .env - .env
command: ["node", "/app/orari-google.mjs", "--out", "/dati/orari.json", "--ogni", "6"] command: ["node", "/app/orari-google.mjs", "--out", "/dati/orari.json", "--ogni", "24"]
volumes: volumes:
- ./scripts:/app:ro - ./scripts:/app:ro
- orari-dati:/dati - orari-dati:/dati
+3
View File
@@ -17,3 +17,6 @@ Opening hours were hard-coded in the site. The client keeps them up to date on t
- The client edits hours only on Google; the sign follows within 6 hours, without a deploy. The /dove-siamo table and JSON-LD update at the next deploy. - The client edits hours only on Google; the sign follows within 6 hours, without a deploy. The /dove-siamo table and JSON-LD update at the next deploy.
- About 120 Place Details requests per month: expected to stay within Google Maps Platform free monthly usage, but a billing account is required — check the current price list. - About 120 Place Details requests per month: expected to stay within Google Maps Platform free monthly usage, but a billing account is required — check the current price list.
- If Google returns no regular hours, nothing is overwritten (no blank sign). - If Google returns no regular hours, nothing is overwritten (no blank sign).
## Update (2026-11-04)
Refresh interval changed from 6 to **24 hours** (owner's request: hours change rarely). The sign therefore follows a change on Google within a day; about 30 requests per month plus one per deploy.
+1 -1
View File
@@ -13,7 +13,7 @@ Requirements: SSH key access as `root@217.76.62.220`, Docker with buildx, Node/n
## Opening hours from Google (ADR 0005) ## Opening hours from Google (ADR 0005)
- Find the Place ID once: `set -a; source .env.server; set +a; node scripts/orari-google.mjs --cerca "Officine Zuliani Udine"` - Find the Place ID once: `set -a; source .env.server; set +a; node scripts/orari-google.mjs --cerca "Officine Zuliani Udine"`
- Each deploy refreshes `src/data/orari-google.json` (commit it with the deploy) - Each deploy refreshes `src/data/orari-google.json` (commit it with the deploy)
- On the server, container `officinezuliani-orari` refreshes `/dati/orari.json` every 6 hours: `docker compose logs orari` shows the last updates - On the server, container `officinezuliani-orari` refreshes `/dati/orari.json` every 24 hours: `docker compose logs orari` shows the last updates
## Publish a hostname (one-time, Nginx Proxy Manager UI) ## Publish a hostname (one-time, Nginx Proxy Manager UI)
1. DNS: A record of the hostname → `217.76.62.220` 1. DNS: A record of the hostname → `217.76.62.220`
+1 -1
View File
@@ -5,7 +5,7 @@
// Uso: // Uso:
// node scripts/orari-google.mjs --cerca "Officine Zuliani Udine" → trova il Place ID // node scripts/orari-google.mjs --cerca "Officine Zuliani Udine" → trova il Place ID
// node scripts/orari-google.mjs --out src/data/orari-google.json → aggiorna una volta // node scripts/orari-google.mjs --out src/data/orari-google.json → aggiorna una volta
// node scripts/orari-google.mjs --out /dati/orari.json --ogni 6 → ripete ogni 6 ore (server) // node scripts/orari-google.mjs --out /dati/orari.json --ogni 24 → ripete ogni 24 ore (server)
// //
// Variabili d'ambiente: GOOGLE_PLACES_API_KEY, GOOGLE_PLACE_ID. // Variabili d'ambiente: GOOGLE_PLACES_API_KEY, GOOGLE_PLACE_ID.
// Se Google non risponde o i dati non sono validi, il file esistente NON viene toccato. // Se Google non risponde o i dati non sono validi, il file esistente NON viene toccato.
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"fonte": "google", "fonte": "google",
"aggiornato": "2026-11-04T15:14:44.384Z", "aggiornato": "2026-11-04T15:22:48.382Z",
"statoAttivita": "OPERATIONAL", "statoAttivita": "OPERATIONAL",
"settimana": [ "settimana": [
{ {