cdn.si

rendered markdown titpetric

Publishing with rsync

rsync mirrors a folder into your tree in one SSH session. The login is the authentication: the username is the GitHub login and github.com/<user>.keys is the set of keys that may publish. No registration is needed first.

The commands below use port 8022, the port of the server at cdn.si. The user page prints the same commands for the port the instance runs on.

The command

rsync -a --delete -e 'ssh -p 8022' ./ alice@cdn.si:/docs/

Run it from the folder you want to publish, as in a CI step after the build. The destination is a path below your tree, so a second project goes to /reports/, /site/ or any other folder.

rsync -a --delete -e 'ssh -p 8022' ./ alice@cdn.si:/docs/
rsync -a -e 'ssh -p 8022' ./coverage/ alice@cdn.si:/docs/coverage/

Reading the result needs no key:

curl https://cdn.si/alice/docs/README.md

What a session guarantees

A session writes into a copy of the live tree, _staging in the data directory. The copy replaces the live tree only after the whole transfer ends and the resulting size is within the 50 MiB quota. A push that fails or exceeds the quota leaves the previous tree in place; the client sees a non-zero exit after the transfer completes.

A .md file is rendered as an HTML page when it is read. Links written relative to it resolve in the same folder, so [next](usage-curl.md) in /alice/docs/README.md opens /alice/docs/usage-curl.md.

Addresses

ssh:// URLs are not rsync remote syntax: rsync splits the address at the first colon. Write user@host:path and pass the port with -e, or leave the port out on 22.

# wrong: rsync reads "ssh" as the host name
rsync -a ./ ssh://alice@cdn.si/docs/

# right
rsync -a -e 'ssh -p 8022' ./ alice@cdn.si:/docs/

The key login can be checked on its own:

ssh -p 8022 alice@cdn.si whoami

Publishing with curl covers a single file and a token.