Files
officinazuliani/docs/runbooks/deploy.md
T

2.1 KiB

Deploy

Hosting: Docker on the a75 server, same flow as cam85 (docs/adr/0004-hosting-docker-server-a75.md).

Deploy

./deploy.sh

It builds locally, builds the amd64 image, loads it on 217.76.62.220, runs docker compose up -d in /home/ubuntu/officinezuliani and checks http://officinezuliani-site:3000/ from the Nginx Proxy Manager container.

Requirements: SSH key access as root@217.76.62.220, Docker with buildx, Node/npm, and a local .env.server (copy .env.server.example) with GOOGLE_PLACES_API_KEY and GOOGLE_PLACE_ID.

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"
  • Each deploy refreshes src/data/orari-google.json (commit it with the deploy)
  • 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)

  1. DNS: A record of the hostname → 217.76.62.220
  2. NPM → Proxy Hosts → Add: forward hostname officinezuliani-site, port 3000, scheme http
  3. SSL tab: request a Let's Encrypt certificate, force SSL

Test the image locally

docker buildx build --platform linux/amd64 -t officinezuliani-web:latest --load .
docker run --rm -p 8089:3000 officinezuliani-web:latest   # http://localhost:8089

Rollback

Check out the previous good commit and run ./deploy.sh again.

Server layout

  • /home/ubuntu/officinezuliani/docker-compose.yml, scripts/, .env (from .env.server, mode 600) — all copied by deploy.sh
  • Volume orari-dati shared by orari (writes) and web (/dati/, read-only)
  • Container officinezuliani-site on network a75, port 3000, no host ports

Hostnames

  • Test: https://officinezuliani.a75.eu (NPM proxy host #35, Let's Encrypt) — served with noindex
  • Production: www.officinezulianiudine.it — still on Italiaonline/Duda; at launch point DNS to 217.76.62.220, add it to the NPM proxy host with a certificate, and redirect officinezulianiudine.it → www