Files
zombie-fps/tools/apply_nginx_compression.py
T
enne2 956a15a525 Add industrial metal soundtrack with seamless loop
- assets/audio/music/zombie_industrial_loop.ogg: 57.60 s Ogg Vorbis loop
  generated locally with YuE2-3B on the Tesla V100 (score written for this
  track; vocals removed with HTDemucs). The loop is spliced at the track's
  structural repeat with a 0.6 s crossfade: measured seam dip <= 1.6 dB.
- scripts/main.gd: "Music" AudioStreamPlayer at -11 dB, started at boot on
  desktop and on the start click on Web (browser autoplay policy). It forces
  stream.loop at runtime because the Web staging step re-imports the OGG with
  loop=false.
- tools/test_music.gd: soundtrack test (loop, length, volume, playback,
  still playing after player death).
- docs/MUSIC.md: source, loop construction, verification, licence.
- docs/WEB-DEPLOY.md: release ab6054111f5919a8 notes.

Initial commit of the project.
2026-10-10 23:11:13 +02:00

31 lines
1.2 KiB
Python

"""Run with sudo on bastion after upload. Backup, validate, reload, rollback on failure."""
from pathlib import Path
import subprocess,sys,uuid,shutil
source=Path(sys.argv[1])
config=Path('/etc/nginx/conf.d/enne2.conf')
snippet=Path('/etc/nginx/snippets/zombie-fps.conf')
backup=Path('/etc/nginx/zombie-fps-backup-'+uuid.uuid4().hex[:12])
backup.mkdir(mode=0o700)
shutil.copy2(config,backup/'enne2.conf')
had_snippet=snippet.exists()
if had_snippet: shutil.copy2(snippet,backup/'zombie-fps.conf')
old=config.read_text()
include=' include /etc/nginx/snippets/zombie-fps.conf;\n'
anchor=' location /pub/ {'
assert old.count(anchor)==1
new=old if include in old else old.replace(anchor,include+'\n'+anchor,1)
shutil.copyfile(source,snippet)
snippet.chmod(0o644)
config.write_text(new)
try:
subprocess.run(['/usr/sbin/nginx','-t'],check=True)
subprocess.run(['systemctl','reload','nginx'],check=True)
except Exception:
shutil.copy2(backup/'enne2.conf',config)
if had_snippet: shutil.copy2(backup/'zombie-fps.conf',snippet)
else: snippet.unlink(missing_ok=True)
subprocess.run(['/usr/sbin/nginx','-t'],check=True)
subprocess.run(['systemctl','reload','nginx'],check=True)
raise
print('Nginx validated and reloaded; protected backup:',backup)