README.md
xonecas.io
My projects and their git history, as a site. site serve reads the git repos and renders each page when it is asked
for, with htmx swapping pages in place of full reloads. It also serves git clone of every project at /<name>.git.
git push over SSH ─► login-shell ─► repos/xonecas.io/<name>.git ─┐
├─► site index ─► data/projects.json ─► site serve
sources.txt ─► site import ─► repos/<host>/<owner>/<repo>.git ───┤
overrides.txt ──┘
Start
make site # builds bin/site
make import # mirrors every repo in sources.txt into repos/
make index # reads repos/ into data/projects.json
make serve # serves the site on http://vm:8080
Run everything from this folder. bin/site help lists the commands, and bin/site <command> -h lists a command's flags.
Push a repo from anywhere
You push to your own account on the server, with its password or any key. The first push creates the repo, the way
gh repo create would, and each push updates the site.
Once, on the server, in the site folder, as the user that owns it:
make login-shell
It makes login-shell.sh your login shell. Pushes and clones of <name>.git, and remote, go to bin/site. Everything
else (your logins, ssh commands, scp, sftp) still gets your own shell, and a repo that already exists in your home is
pushed to as before. To undo it: sudo chsh -s /bin/bash $USER.
Then, from any machine:
git remote add origin sean@xonecas.io:my-thing.git # or: git remote set-url origin ...
git push -u origin main
ssh sean@xonecas.io remote list # remote new|add|rm work the same way
If it says does not appear to be a git repository, make login-shell hasn't run on the server for that user.
Manage repos
| To | Run |
|---|---|
| Start a repo the site hosts | git push to sean@xonecas.io:my-thing.git, or remote new my-thing first, which prints that URL |
| Show a repo you already have | bin/site remote add ~/code/other-thing (a path) or bin/site remote add https://host/owner/repo.git |
| Stop showing a repo | bin/site remote rm <path or url> (a hosted repo's data is kept) |
| List the repos | bin/site remote list |
| Fetch every added repo again | make import |
| Update the site | make index (the running site reads the new data on its next request) |
A push to a hosted repo runs site index by itself; its log is repos/xonecas.io/<name>.git/build.log.
After remote add or rm, run make index.
repos/ is git-ignored. On the VM it is lost when the VM is recreated, so host repos on the machine that serves the site.
Fix how a project shows
Edit overrides.txt, one rule per line, then make index:
merge <remote URL> <remote URL> make two remotes one project
rename <name> <new name> rename a project
hide <name> hide a project
show <name> list a fork or an empty repo, which are hidden by default
tag <name> +frontend -backend add or drop tags
Layout
| Path | Holds |
|---|---|
cmd/site |
the site command: import, remote, shell, index, serve, help |
internal/store |
the repo store: sources.txt, mirrors, hosted repos, the hosts' metadata |
internal/project |
groups repos into projects, and their tags, description and overrides |
internal/server |
serves the site: picks each page, reads git once per data file, and serves clones |
internal/site |
renders each page, and the htmx parts in its templates |
internal/repo |
runs git against a bare repo |
tickets/ |
the Rats board |
make test runs the tests.