Site promotion tools

This commit is contained in:
MaddoScientisto 2026-04-11 15:57:35 +02:00
commit a6cdbb7beb
9 changed files with 723 additions and 2 deletions

78
sync/promote-file.sh Normal file
View file

@ -0,0 +1,78 @@
#!/bin/sh
set -eu
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
echo "usage: $0 <source> <destination> [metadata-source]" >&2
exit 64
fi
src="$1"
dst="$2"
metadata_source=${3:-}
dst_dir=$(dirname "$dst")
dst_name=$(basename "$dst")
dst_ext=""
case "$dst_name" in
*.*)
dst_ext=${dst_name##*.}
;;
esac
test -f "$src" || {
echo "source file not found: $src" >&2
exit 66
}
owner=""
group=""
mode=""
sample=""
if [ -e "$dst" ]; then
owner=$(stat -f '%Su' "$dst")
group=$(stat -f '%Sg' "$dst")
mode=$(stat -f '%Lp' "$dst")
else
if [ -n "$metadata_source" ]; then
test -e "$metadata_source" || {
echo "metadata source not found: $metadata_source" >&2
exit 66
}
sample=$metadata_source
elif [ -n "$dst_ext" ]; then
for candidate in "$dst_dir"/*."$dst_ext"; do
[ -e "$candidate" ] || continue
sample=$candidate
break
done
fi
if [ -z "$sample" ]; then
for candidate in "$dst_dir"/*; do
[ -f "$candidate" ] || continue
sample=$candidate
break
done
fi
if [ -n "$sample" ]; then
owner=$(stat -f '%Su' "$sample")
group=$(stat -f '%Sg' "$sample")
mode=$(stat -f '%Lp' "$sample")
else
owner=$(stat -f '%Su' "$dst_dir")
group=$(stat -f '%Sg' "$dst_dir")
mode=644
fi
fi
cp "$src" "$dst"
chown "$owner":"$group" "$dst"
chmod "$mode" "$dst"
printf 'copied %s -> %s\n' "$src" "$dst"
printf 'restored owner=%s group=%s mode=%s\n' "$owner" "$group" "$mode"
if [ -n "$sample" ]; then
printf 'metadata source=%s\n' "$sample"
fi

View file

@ -0,0 +1,37 @@
#!/bin/sh
set -eu
PROMOTE=/home/marco/promote-file.sh
INCOMING=/home/marco/regalamiunsorriso/incoming/www
LIVE=/home/sites/regalamiunsorriso/www
PHP_SAMPLE=$LIVE/_inc_footer.php
"$PROMOTE" "$INCOMING/_inc_footer.jsp" "$LIVE/_inc_footer.jsp"
"$PROMOTE" "$INCOMING/_js/rus-ecom-240621.js" "$LIVE/_js/rus-ecom-240621.js"
"$PROMOTE" "$INCOMING/associazione.jsp" "$LIVE/associazione.jsp"
"$PROMOTE" "$INCOMING/atleticaImmagine_chiSiamo-en.jsp" "$LIVE/atleticaImmagine_chiSiamo-en.jsp"
"$PROMOTE" "$INCOMING/atleticaImmagine_chiSiamo.jsp" "$LIVE/atleticaImmagine_chiSiamo.jsp"
"$PROMOTE" "$INCOMING/controlCode-en.jsp" "$LIVE/controlCode-en.jsp"
"$PROMOTE" "$INCOMING/controlCode.jsp" "$LIVE/controlCode.jsp"
"$PROMOTE" "$INCOMING/faceai_config.php" "$LIVE/faceai_config.php" "$PHP_SAMPLE"
"$PROMOTE" "$INCOMING/faceai_handoff.php" "$LIVE/faceai_handoff.php" "$PHP_SAMPLE"
"$PROMOTE" "$INCOMING/faceai_return.php" "$LIVE/faceai_return.php" "$PHP_SAMPLE"
"$PROMOTE" "$INCOMING/faceai_simulator.php" "$LIVE/faceai_simulator.php" "$PHP_SAMPLE"
"$PROMOTE" "$INCOMING/faceai_simulator_view.php" "$LIVE/faceai_simulator_view.php" "$PHP_SAMPLE"
"$PROMOTE" "$INCOMING/includes/inc-header.php" "$LIVE/includes/inc-header.php"
"$PROMOTE" "$INCOMING/lostPwd.jsp" "$LIVE/lostPwd.jsp"
"$PROMOTE" "$INCOMING/mailMessage/noMorePic.html" "$LIVE/mailMessage/noMorePic.html"
"$PROMOTE" "$INCOMING/mailMessage/noMorePic.txt" "$LIVE/mailMessage/noMorePic.txt"
"$PROMOTE" "$INCOMING/mailMessage/noMorePicCc.html" "$LIVE/mailMessage/noMorePicCc.html"
"$PROMOTE" "$INCOMING/mailMessage/noMorePicScad.html" "$LIVE/mailMessage/noMorePicScad.html"
"$PROMOTE" "$INCOMING/mailMessage/noMorePicScad.txt" "$LIVE/mailMessage/noMorePicScad.txt"
"$PROMOTE" "$INCOMING/mailMessage/perScadereMsg.html" "$LIVE/mailMessage/perScadereMsg.html"
"$PROMOTE" "$INCOMING/mailMessage/userMsg_it.html" "$LIVE/mailMessage/userMsg_it.html"
"$PROMOTE" "$INCOMING/mailMessage/userMsg_itCC.html" "$LIVE/mailMessage/userMsg_itCC.html"
"$PROMOTE" "$INCOMING/newsCR-en.jsp" "$LIVE/newsCR-en.jsp"
"$PROMOTE" "$INCOMING/newsCR.jsp" "$LIVE/newsCR.jsp"
"$PROMOTE" "$INCOMING/pg/controlCode.jsp" "$LIVE/pg/controlCode.jsp"
"$PROMOTE" "$INCOMING/pg/logon.jsp" "$LIVE/pg/logon.jsp"
"$PROMOTE" "$INCOMING/pg/registra.jsp" "$LIVE/pg/registra.jsp"
"$PROMOTE" "$INCOMING/users-en.jsp" "$LIVE/users-en.jsp"
"$PROMOTE" "$INCOMING/users.jsp" "$LIVE/users.jsp"

View file

@ -0,0 +1,51 @@
# Riepilogo Modifiche Pubblicate
Di seguito il riepilogo dei file aggiornati o aggiunti sul sito, con una breve descrizione delle modifiche effettuate. Il testo e' pensato per poter essere riutilizzato direttamente in una comunicazione al cliente.
## Nuovi File
| File | Descrizione |
| --- | --- |
| `www/faceai_config.php` | Nuovo file di configurazione FaceAI con impostazioni ambiente, utility per token firmati, risoluzione identita' utente, gestione errori e supporto alle chiamate JSON verso il backend. |
| `www/faceai_handoff.php` | Nuovo endpoint di handoff verso FaceAI: valida i parametri della gara e dell'utente e reindirizza al frontend FaceAI con payload firmato. |
| `www/faceai_return.php` | Nuovo endpoint di ritorno da FaceAI: valida la callback firmata e mostra i risultati filtrati all'interno del sito legacy. |
| `www/faceai_simulator.php` | Nuova pagina di simulazione per testare il flusso di ingresso verso FaceAI con dati demo e foto di esempio. |
| `www/faceai_simulator_view.php` | Nuovo renderer condiviso per la simulazione FaceAI, con visualizzazione stile galleria legacy e configurazione JS per i test. |
## File Aggiornati
| File | Descrizione |
| --- | --- |
| `www/_inc_footer.jsp` | Rimossa l'indicazione del contatto Gmail aggiuntivo nel footer, lasciando solo i riferimenti principali di supporto e PEC. |
| `www/_js/rus-ecom-240621.js` | Inserita la logica di avvio FaceAI nelle pagine gara: il selettore legacy del punto foto viene sostituito da un pulsante Face ID, con gestione URL e lingua. |
| `www/associazione-en.jsp` | Aggiornati i contenuti in inglese di presentazione dell'associazione/rivista, con testo piu' attuale su pubblicazione settimanale, integrazione con la piattaforma e pubblico di riferimento. |
| `www/associazione.jsp` | Aggiornata la sezione italiana dedicata allo statuto e ai dati associativi, con formulazione piu' chiara e riferimenti aggiornati, incluso il RUNTS. |
| `www/atleticaImmagine_chiSiamo-en.jsp` | Aggiornato il testo inglese "Chi siamo" di Atletica Immagine, con nuova descrizione editoriale e del ruolo della piattaforma. |
| `www/atleticaImmagine_chiSiamo.jsp` | Aggiornato il testo italiano "Chi siamo" di Atletica Immagine, con nuova descrizione editoriale e del ruolo della piattaforma. |
| `www/controlCode-en.jsp` | Sostituito il contatto email post-registrazione con l'indirizzo centralizzato `foto@regalamiunsorriso.it`. |
| `www/controlCode.jsp` | Aggiornato il contatto email post-registrazione con l'indirizzo centralizzato `foto@regalamiunsorriso.it` e sistemata la formulazione del messaggio in italiano. |
| `www/includes/inc-header.php` | Aggiornato l'indirizzo email del proprietario/metadati del sito con il contatto centralizzato `foto@regalamiunsorriso.it`. |
| `www/lostPwd.jsp` | Aggiornato il contatto di riferimento nella pagina di recupero password con l'indirizzo centralizzato `foto@regalamiunsorriso.it`. |
| `www/mailMessage/noMorePic.html` | Uniformato il template email HTML usando solo `foto@regalamiunsorriso.it` per invio ricevute, supporto e assistenza password. |
| `www/mailMessage/noMorePic.txt` | Uniformato il template email testuale usando solo `foto@regalamiunsorriso.it` per invio ricevute, supporto e assistenza password. |
| `www/mailMessage/noMorePicCc.html` | Uniformato il template email HTML usando solo `foto@regalamiunsorriso.it` per invio ricevute, supporto e assistenza password. |
| `www/mailMessage/noMorePicScad.html` | Uniformato il template email HTML per account in scadenza usando solo `foto@regalamiunsorriso.it` per attivazione e supporto. |
| `www/mailMessage/noMorePicScad.txt` | Uniformato il template email testuale per account in scadenza usando solo `foto@regalamiunsorriso.it` per attivazione e supporto. |
| `www/mailMessage/perScadereMsg.html` | Semplificato il riferimento di supporto nella mail di promemoria, lasciando un solo indirizzo `foto@regalamiunsorriso.it`. |
| `www/mailMessage/userMsg_it.html` | Sostituiti nei messaggi utente italiani i vari indirizzi storici con il contatto unico `foto@regalamiunsorriso.it`. |
| `www/mailMessage/userMsg_itCC.html` | Sostituiti nei messaggi utente italiani i vari indirizzi storici con il contatto unico `foto@regalamiunsorriso.it`. |
| `www/newsCR-en.jsp` | Aggiornato il paragrafo promozionale in inglese dedicato ad Atletica Immagine, con testo piu' sintetico e attuale. |
| `www/newsCR.jsp` | Aggiornato il paragrafo promozionale in italiano dedicato ad Atletica Immagine, con testo piu' sintetico e attuale. |
| `www/pg/controlCode.jsp` | Aggiornato il contatto email post-registrazione con l'indirizzo centralizzato `foto@regalamiunsorriso.it`. |
| `www/pg/logon.jsp` | Aggiornato il contatto per il recupero password nella pagina di accesso con l'indirizzo centralizzato `foto@regalamiunsorriso.it`. |
| `www/pg/registra.jsp` | Aggiornate le istruzioni di registrazione: rivisti i livelli di contributo, chiarite le indicazioni operative, aggiornato il contatto di supporto e aggiunta la nota sulla cancellazione dopo un mese delle registrazioni incomplete. |
| `www/users-en.jsp` | Aggiornato l'elenco informativo in inglese per la registrazione utenti, con contributi rivisti, istruzioni piu' chiare, nuovo contatto e nota sulle registrazioni incomplete. |
| `www/users.jsp` | Aggiornato l'elenco informativo in italiano per la registrazione utenti, con contributi rivisti, istruzioni piu' chiare, nuovo contatto e nota sulle registrazioni incomplete. |
## Nota Generale
Le modifiche si concentrano in tre aree principali:
- integrazione del nuovo flusso FaceAI;
- uniformazione dei contatti email verso l'indirizzo unico `foto@regalamiunsorriso.it`;
- aggiornamento dei testi informativi e di registrazione in italiano e inglese.

19
sync/server.md Normal file
View file

@ -0,0 +1,19 @@
ssh marco@83.149.164.4 -p 410
user marco
ssh key login works through default key C:\Users\Maddo\.ssh\id_rsa
sudo doesn't really work properly, to do administrator commands one must use "sudo tcsh" and insert the password
the server prints this banner before asking for the login name:
** READ THIS BEFORE ATTEMPTING TO LOGON **
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your actions
may be monitored. If such monitoring reveals possible criminal activity,
system personnel may provide the evidence of such monitoring to law
enforcement officials.

117
sync/www-deploy-manifest.md Normal file
View file

@ -0,0 +1,117 @@
# WWW Deployment Manifest
This document lists the files under `www/` that changed after the initial `www` import baseline and should be copied to the remote staging path:
`/home/marco/regalamiunsorriso/incoming/www`
## Baseline Used
- Excluded the initial `www` import history by using commit `cc69770608bd0f1c32eeac01e16042f4e8a47012` (`First commit`) as the baseline.
- Included committed changes after that baseline up to `HEAD`.
- Included the current uncommitted workspace change in `www/controlCode.jsp`.
## New Files
- `www/faceai_config.php`
- `www/faceai_handoff.php`
- `www/faceai_return.php`
- `www/faceai_simulator.php`
- `www/faceai_simulator_view.php`
## Updated Files
- `www/_inc_footer.jsp`
- `www/_js/rus-ecom-240621.js`
- `www/associazione-en.jsp`
- `www/associazione.jsp`
- `www/atleticaImmagine_chiSiamo-en.jsp`
- `www/atleticaImmagine_chiSiamo.jsp`
- `www/controlCode-en.jsp`
- `www/controlCode.jsp`
- `www/includes/inc-header.php`
- `www/lostPwd.jsp`
- `www/mailMessage/noMorePic.html`
- `www/mailMessage/noMorePic.txt`
- `www/mailMessage/noMorePicCc.html`
- `www/mailMessage/noMorePicScad.html`
- `www/mailMessage/noMorePicScad.txt`
- `www/mailMessage/perScadereMsg.html`
- `www/mailMessage/userMsg_it.html`
- `www/mailMessage/userMsg_itCC.html`
- `www/newsCR-en.jsp`
- `www/newsCR.jsp`
- `www/pg/controlCode.jsp`
- `www/pg/logon.jsp`
- `www/pg/registra.jsp`
- `www/users-en.jsp`
- `www/users.jsp`
## Local Workspace-Only Change Included
- `www/controlCode.jsp` currently has an uncommitted local modification and should be deployed from the working tree version, not just from `HEAD`.
## Remote Copy Target
- Source root: `K:\various\regalamiunsorriso`
- Remote host: `marco@83.149.164.4:410`
- Remote path: `/home/marco/regalamiunsorriso/incoming/www`
- Total files in this manifest: `30`
## Transfer Notes
- Transfer completed by streaming a tar archive over SSH and extracting it into `/home/marco/regalamiunsorriso/incoming` so the `www/...` directory structure was preserved.
- Representative remote verification succeeded for new files and updated files, including `www/faceai_config.php`, `www/faceai_handoff.php`, `www/faceai_return.php`, `www/faceai_simulator.php`, `www/faceai_simulator_view.php`, `www/controlCode.jsp`, `www/_js/rus-ecom-240621.js`, `www/includes/inc-header.php`, and `www/pg/logon.jsp`.
- `www/controlCode.jsp` was uploaded from the local working tree, which includes an uncommitted change.
## Issues Encountered
- The remote login shell behaves as `tcsh`, so POSIX shell loops like `for ...; do ...; done` fail unless they are explicitly run through `sh -c`.
- The server `sh` does not accept the `-l` option, so verification commands must use `sh -c`, not `sh -lc`.
- The direct SSH and tar-based copy path works; the MCP SSH tools were not used for this transfer because they were previously failing authentication or transport checks.
## Single-File Live Promotion Test
- Tested file: `www/associazione-en.jsp`
- Staged source: `/home/marco/regalamiunsorriso/incoming/www/associazione-en.jsp`
- Live destination: `/home/sites/regalamiunsorriso/www/associazione-en.jsp`
- Original live metadata before copy: owner `jenkins`, group `www`, mode `100644`, size `6289`
- Live metadata after copy: owner `jenkins`, group `www`, mode `100644`, size `6139`
- Content verification after copy succeeded: `cksum` matched for staged and live files.
## Promotion Script
- Local template: `sync/promote-file.sh`
- Remote installed script: `/home/marco/promote-file.sh`
- Purpose: copy one source file to one destination file, then restore the destination file owner, group, and mode from the original live file.
- Supports an optional third argument: a metadata source file to use when the destination file does not exist yet and the target directory has mixed permission patterns.
### Command That Worked
```powershell
ssh -tt -i C:\Users\Maddo\.ssh\id_rsa -p 410 marco@83.149.164.4 "sudo tcsh -c '/home/marco/promote-file.sh /home/marco/regalamiunsorriso/incoming/www/associazione-en.jsp /home/sites/regalamiunsorriso/www/associazione-en.jsp'"
```
## Additional Problems Found During Live Promotion
- Uploading a multi-line script inline from PowerShell was unreliable in the local terminal because the prompt layer interfered with the here-string before SSH execution. Using a normal local file plus `scp` worked cleanly.
- The live-site verification command was interrupted once when run in parallel with the promotion command. Re-running verification separately avoided that issue.
- Promotion to `/home/sites/regalamiunsorriso/www` must run through `sudo tcsh`; copying as `marco` alone is not sufficient for the live path and would not preserve the required live ownership.
- Root-level PHP files on the live site do not have a single uniform mode. For example, `_inc_footer.php` and `gallery1.php` are `775`, while `test.php` is `644`. The promotion helper was extended to accept an explicit metadata source so new files can follow a chosen live pattern instead of relying on the first sibling match.
## Recommended Replication Procedure
1. Stage the file under `/home/marco/regalamiunsorriso/incoming/www/...`.
2. Inspect the live destination metadata before changing anything.
3. Run `/home/marco/promote-file.sh <staged-path> <live-path> [metadata-source]` through `sudo tcsh` in an SSH session opened with `-tt`.
4. Verify the live file with `ls -l`, `stat -f`, and `cksum` against the staged source.
## Full Live Promotion Result
- After the single-file test with `www/associazione-en.jsp`, the remaining `29` files in the manifest were promoted successfully to `/home/sites/regalamiunsorriso/www`.
- Existing destination files kept their original live owner, group, and mode.
- The new `faceai_*.php` files were created as `jenkins:www` with mode `775`, using `/home/sites/regalamiunsorriso/www/_inc_footer.php` as the explicit metadata source.
- Representative content verification succeeded with matching `cksum` values for:
- `www/faceai_config.php`
- `www/controlCode.jsp`
- `www/pg/logon.jsp`
- Representative metadata verification succeeded for updated files in root, `pg`, `includes`, and `mailMessage` directories.