fuzzyworld

fuzzyworld-tools / files / server / install.sh

install.sh

Blame: the commit that last changed each line · file · history

623239b7 2026-10-26 Pavel Safronov1#!/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
5set -euo pipefail
6cd "$(dirname "$0")/.."
7HOST=${FW_HOST:-dh}
8
9ssh "$HOST" 'mkdir -p ~/fw/tools'
10rsync -az --delete --exclude '__pycache__' server/ "$HOST:fw/tools/server/"
11ssh "$HOST" bash -s <<'EOF'
12set -euo pipefail
13chmod +x ~/fw/tools/server/fw ~/fw/tools/server/hooks/*
45b1fe38 2026-10-27 Pavel Safronov14# 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.
17git config --global pack.threads 1
18git config --global pack.windowMemory 64m
19git config --global pack.deltaCacheSize 16m
20git config --global core.bigFileThreshold 16m
55e5fc3e 2026-11-04 Pavel Safronov21mkdir -p ~/bin ~/fw/state ~/fw/logs ~/fw/queue/pending ~/fw/queue/running ~/fw/ci ~/fw/issues
1758548c 2026-10-27 Pavel Safronov22chmod +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 Safronov24# 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 Safronov26[ -d ~/fw/pylib/pygments ] || python3 -m pip install --quiet --target ~/fw/pylib "Pygments==2.21.0"
623239b7 2026-10-26 Pavel Safronov27ln -sfn ~/fw/tools/server/fw ~/bin/fw
28site=~/code.fuzzyworld.net
29cp ~/fw/tools/server/site/htaccess "$site/.htaccess"
2483c47c 2026-10-28 Pavel Safronov30cp ~/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/"
31chmod 644 "$site"/_shared.css "$site"/_icons.css "$site"/style.css "$site"/robots.txt "$site"/favicon.ico
f9ca0752 2026-10-27 Pavel Safronov32apps=~/apps.fuzzyworld.net
33cp ~/fw/tools/server/site-apps/htaccess "$apps/.htaccess"
2483c47c 2026-10-28 Pavel Safronov34cp ~/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/"
35chmod 644 "$apps"/_shared.css "$apps"/_icons.css "$apps"/style.css "$apps"/favicon.ico
ea128c14 2026-10-28 Pavel Safronov36# Main fuzzyworld.net site
37main_site=~/fuzzyworld.net
d62e3357 2026-11-01 Pavel Safronov38python3 ~/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 Safronov39cp ~/fw/tools/server/site/main.css "$main_site/"
5a659fb7 2026-10-29 Pavel Safronov40mkdir -p "$main_site/projects"
41cp ~/fw/tools/server/site/projects-redirect.html "$main_site/projects/index.html" # the old projects page, now /projects/ on code.
42chmod 644 "$main_site/projects/index.html"
ea128c14 2026-10-28 Pavel Safronov43cp ~/fw/tools/server/site/_shared.css ~/fw/tools/server/site/_icons.css "$main_site/"
5963bb34 2026-11-01 Pavel Safronov44cp ~/fw/tools/server/site/favicon.ico "$main_site/"
45chmod 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 Safronov46~/bin/fw install-hooks
f9ca0752 2026-10-27 Pavel Safronov47~/bin/fw apps-index
ec9751fa 2026-10-27 Pavel Safronov48~/bin/fw content
a16147a4 2026-10-27 Pavel Safronov49# Scheduled jobs: replace only our own block in the crontab, keeping anything else.
50chmod +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 Safronov52EOF
53if [ "${1:-}" = --publish ]; then ssh "$HOST" '~/bin/fw publish-all'; fi
54echo "installed on $HOST"