fuzzyworld-tools / files / server / install.sh
install.sh
623239b7 2026-10-26 Pavel Safronov | 1 | #!/bin/bash |
| 2 | # Install or update the DreamHost side of fuzzyworld-tools. Run from the laptop: | |
| 3 | # server/install.sh copy tools, site files and hooks to `dh` | |
| 4 | # server/install.sh --publish ...then republish every public repo | |
| 5 | set -euo pipefail | |
| 6 | cd "$(dirname "$0")/.." | |
| 7 | HOST=${FW_HOST:-dh} | |
| 8 | ||
| 9 | ssh "$HOST" 'mkdir -p ~/fw/tools' | |
| 10 | rsync -az --delete --exclude '__pycache__' server/ "$HOST:fw/tools/server/" | |
| 11 | ssh "$HOST" bash -s <<'EOF' | |
| 12 | set -euo pipefail | |
| 13 | chmod +x ~/fw/tools/server/fw ~/fw/tools/server/hooks/* | |
45b1fe38 2026-10-27 Pavel Safronov | 14 | # DreamHost's process watchdog kills git-upload-pack when pack-objects uses its defaults |
| 15 | # (2 threads, unbounded delta window) on large repos, so clones/fetches over ssh of e.g. | |
| 16 | # when-am-i (284 MB) die with "git-pack-objects died". These limits keep it under the radar. | |
| 17 | git config --global pack.threads 1 | |
| 18 | git config --global pack.windowMemory 64m | |
| 19 | git config --global pack.deltaCacheSize 16m | |
| 20 | git config --global core.bigFileThreshold 16m | |
55e5fc3e 2026-11-04 Pavel Safronov | 21 | mkdir -p ~/bin ~/fw/state ~/fw/logs ~/fw/queue/pending ~/fw/queue/running ~/fw/ci ~/fw/issues |
1758548c 2026-10-27 Pavel Safronov | 22 | chmod +x ~/fw/tools/server/runner-api ~/fw/tools/server/mirror-only |
| 23 | # Pygments colors source code on the file pages (gen.py works without it, uncolored). | |
73733e6e 2026-11-01 Pavel Safronov | 24 | # Python-Markdown renders the README pages and the landing page text (`gen.py landing` needs it). |
| 25 | [ -d ~/fw/pylib/markdown ] || python3 -m pip install --quiet --target ~/fw/pylib "Markdown==3.7" | |
1758548c 2026-10-27 Pavel Safronov | 26 | [ -d ~/fw/pylib/pygments ] || python3 -m pip install --quiet --target ~/fw/pylib "Pygments==2.21.0" |
623239b7 2026-10-26 Pavel Safronov | 27 | ln -sfn ~/fw/tools/server/fw ~/bin/fw |
| 28 | site=~/code.fuzzyworld.net | |
| 29 | cp ~/fw/tools/server/site/htaccess "$site/.htaccess" | |
2483c47c 2026-10-28 Pavel Safronov | 30 | cp ~/fw/tools/server/site/_shared.css ~/fw/tools/server/site/_icons.css ~/fw/tools/server/site/style.css ~/fw/tools/server/site/robots.txt ~/fw/tools/server/site/favicon.ico "$site/" |
| 31 | chmod 644 "$site"/_shared.css "$site"/_icons.css "$site"/style.css "$site"/robots.txt "$site"/favicon.ico | |
f9ca0752 2026-10-27 Pavel Safronov | 32 | apps=~/apps.fuzzyworld.net |
| 33 | cp ~/fw/tools/server/site-apps/htaccess "$apps/.htaccess" | |
2483c47c 2026-10-28 Pavel Safronov | 34 | cp ~/fw/tools/server/site/_shared.css ~/fw/tools/server/site/_icons.css ~/fw/tools/server/site/style.css ~/fw/tools/server/site/favicon.ico "$apps/" |
| 35 | chmod 644 "$apps"/_shared.css "$apps"/_icons.css "$apps"/style.css "$apps"/favicon.ico | |
ea128c14 2026-10-28 Pavel Safronov | 36 | # Main fuzzyworld.net site |
| 37 | main_site=~/fuzzyworld.net | |
d62e3357 2026-11-01 Pavel Safronov | 38 | python3 ~/fw/tools/server/gen.py landing ~/fw/tools/server/site/index.html "$main_site/index.html" # nav and footer built in gen.py |
0330e724 2026-11-01 Pavel Safronov | 39 | cp ~/fw/tools/server/site/main.css "$main_site/" |
5a659fb7 2026-10-29 Pavel Safronov | 40 | mkdir -p "$main_site/projects" |
| 41 | cp ~/fw/tools/server/site/projects-redirect.html "$main_site/projects/index.html" # the old projects page, now /projects/ on code. | |
| 42 | chmod 644 "$main_site/projects/index.html" | |
ea128c14 2026-10-28 Pavel Safronov | 43 | cp ~/fw/tools/server/site/_shared.css ~/fw/tools/server/site/_icons.css "$main_site/" |
5963bb34 2026-11-01 Pavel Safronov | 44 | cp ~/fw/tools/server/site/favicon.ico "$main_site/" |
| 45 | chmod 644 "$main_site"/index.html "$main_site"/main.css "$main_site"/_shared.css "$main_site"/_icons.css "$main_site"/favicon.ico | |
623239b7 2026-10-26 Pavel Safronov | 46 | ~/bin/fw install-hooks |
f9ca0752 2026-10-27 Pavel Safronov | 47 | ~/bin/fw apps-index |
ec9751fa 2026-10-27 Pavel Safronov | 48 | ~/bin/fw content |
a16147a4 2026-10-27 Pavel Safronov | 49 | # Scheduled jobs: replace only our own block in the crontab, keeping anything else. |
| 50 | chmod +x ~/fw/tools/server/jobs/*.sh | |
| 51 | { { crontab -l 2>/dev/null || true; } | sed '/^# fw:begin/,/^# fw:end/d'; cat ~/fw/tools/server/jobs/crontab; } | crontab - | |
623239b7 2026-10-26 Pavel Safronov | 52 | EOF |
| 53 | if [ "${1:-}" = --publish ]; then ssh "$HOST" '~/bin/fw publish-all'; fi | |
| 54 | echo "installed on $HOST" |