Shorten the README's install script section to bullets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eacd0bfd27
commit
15f63b6846
1 file changed
+15
-85
@@ -49,93 +49,23 @@ REST API and prints them on an EPSON ESC/POS network receipt printer.
|
|||||||
sudo ./install.sh printer.example.com you@example.com 192.168.1.245
|
sudo ./install.sh printer.example.com you@example.com 192.168.1.245
|
||||||
```
|
```
|
||||||
|
|
||||||
The script sets up a fresh Debian or Ubuntu host, and re-runs upgrade what
|
- Sets up a fresh Debian or Ubuntu host: the latest release, a systemd
|
||||||
it set up. It does not upgrade a host set up by the 0.1 install script, which
|
service, and [Caddy](https://caddyserver.com) for HTTPS with an automatic
|
||||||
used nginx and acme.sh. Ports 80 and 443 must be free for Caddy.
|
certificate. It does not upgrade a host set up by the 0.1 script.
|
||||||
|
- Arguments: the server's domain, whose DNS must point at the server, with
|
||||||
The arguments are the server's domain, the email address for the ACME
|
ports 80 and 443 free and reachable; the email address for the certificate
|
||||||
certificate account, and the printer's address:
|
account; and the printer's IP address or host name, without a port.
|
||||||
|
- A given release, v0.2.0 or later:
|
||||||
- The domain must be a DNS name with at least one dot, such as
|
|
||||||
`printer.example.com`, made of letters, digits, hyphens and dots; not an IP
|
|
||||||
address. Its DNS must point at the server, and ports 80 and 443 must be
|
|
||||||
reachable, for the certificate to be issued.
|
|
||||||
- The printer address is an IP address or host name without a port; IPv6
|
|
||||||
addresses may contain colons. A port other than 9100 goes in
|
|
||||||
`printer.port` in the config.
|
|
||||||
|
|
||||||
The script does the following:
|
|
||||||
|
|
||||||
- It installs curl and gnupg, then downloads the latest release for the
|
|
||||||
host's architecture and checks it against the release's `checksums.txt`
|
|
||||||
(sha256). If the check fails, nothing else is installed. To install a given
|
|
||||||
release, v0.2.0 or later, name its tag:
|
|
||||||
`sudo UBERBRINGER_VERSION=v0.2.0 ./install.sh <domain> <acme-email> <printer-address>`.
|
`sudo UBERBRINGER_VERSION=v0.2.0 ./install.sh <domain> <acme-email> <printer-address>`.
|
||||||
- It installs the binary to `/usr/local/bin/uberbringer` and the systemd unit
|
- The config is `/etc/uberbringer/config.toml`. The first API token is in
|
||||||
from the release archive to
|
`/etc/uberbringer/initial-token`: copy it to your client, then delete the
|
||||||
`/usr/local/lib/systemd/system/uberbringer.service`. The service runs as a
|
file. Issue more with
|
||||||
dedicated `uberbringer` user.
|
|
||||||
- It writes `/etc/uberbringer/config.toml` (0640, root:uberbringer) with a
|
|
||||||
fresh secret.
|
|
||||||
- It reads the config with the new binary (`uberbringer config get`) before
|
|
||||||
it restarts the service, and stops if the config does not load. After the
|
|
||||||
restart it waits up to 15 seconds for the daemon to answer, and stops if it
|
|
||||||
does not.
|
|
||||||
- It installs [Caddy](https://caddyserver.com) from Caddy's own apt repository
|
|
||||||
as the HTTPS reverse proxy, and stops if that repository can't be read.
|
|
||||||
Caddy obtains and renews the certificate itself and redirects HTTP to
|
|
||||||
HTTPS.
|
|
||||||
- The site is `/etc/caddy/uberbringer.caddy`; `/etc/caddy/Caddyfile`
|
|
||||||
imports it. The package's default Caddyfile is replaced and kept as
|
|
||||||
`Caddyfile.default`.
|
|
||||||
- Caddy proxies to `webserver.bind_ip` and `webserver.port` from the
|
|
||||||
config, passes the client address in `X-Real-IP`, and adds HSTS and other
|
|
||||||
security headers.
|
|
||||||
- Caddy limits request bodies to `webserver.body_limit` from the config
|
|
||||||
(4 MiB by default). It answers a larger body itself, with the same `413`
|
|
||||||
`body_too_large` JSON the daemon sends. Its other errors, such as a `502`
|
|
||||||
while the daemon restarts or is down, have an empty body; Caddy logs
|
|
||||||
their cause to `journalctl -u caddy`.
|
|
||||||
- Requests are logged to `/var/log/caddy/uberbringer-access.log`, without
|
|
||||||
query strings.
|
|
||||||
- The configuration is validated as the `caddy` user before it is used. If
|
|
||||||
Caddy rejects it, the previous Caddyfile and site file are put back and
|
|
||||||
the script stops with Caddy's error.
|
|
||||||
- It writes the first API token to `/etc/uberbringer/initial-token` (0600,
|
|
||||||
readable by root only) instead of printing it. Copy the token to your
|
|
||||||
client, then delete the file.
|
|
||||||
|
|
||||||
The install log, apt output included, is `/var/log/uberbringer-install.log`.
|
|
||||||
|
|
||||||
Running the script again upgrades the binary, the unit and Caddy, and
|
|
||||||
restarts the service. It rewrites `/etc/caddy/uberbringer.caddy`, so local
|
|
||||||
edits to that file are lost. It keeps:
|
|
||||||
|
|
||||||
- **The config.** The printer-address argument is ignored on a re-run, so
|
|
||||||
edit `printer.address` in `/etc/uberbringer/config.toml` instead. The daemon
|
|
||||||
reads the config only when it starts: after an edit, run
|
|
||||||
`systemctl restart uberbringer`. After changing `webserver.body_limit`,
|
|
||||||
`bind_ip` or `port`, re-run the script instead, which copies them into
|
|
||||||
Caddy's site and restarts the service.
|
|
||||||
- **Your Caddyfile edits.** Put your other sites in the Caddyfile, and
|
|
||||||
global options at its top, above every import and site. Once you have
|
|
||||||
edited it, a re-run adds the `import` line only if no line imports the
|
|
||||||
site file, by its path or by a glob such as `import /etc/caddy/*.caddy`
|
|
||||||
(keeping the previous copy as `Caddyfile.bak`). The file keeps its owner
|
|
||||||
and mode. Überbringer's own site can't be changed there, because
|
|
||||||
`uberbringer.caddy` defines it.
|
|
||||||
- **The certificate.** Caddy stores it and renews it before it expires.
|
|
||||||
- **Tokens.** A re-run creates none. Issue more with
|
|
||||||
`uberbringer token --config /etc/uberbringer/config.toml --subject <client>`.
|
`uberbringer token --config /etc/uberbringer/config.toml --subject <client>`.
|
||||||
|
- Re-running the script upgrades the install and keeps the config. After
|
||||||
The systemd unit ships as
|
editing the config, run `systemctl restart uberbringer`; after changing
|
||||||
[packaging/uberbringer.service](packaging/uberbringer.service):
|
`webserver.body_limit`, `bind_ip` or `port`, re-run the script instead.
|
||||||
|
- Change the systemd unit with `systemctl edit uberbringer`.
|
||||||
- **Changing it.** Use `systemctl edit uberbringer`, never the installed unit
|
- The install log is `/var/log/uberbringer-install.log`.
|
||||||
file. Those drop-ins survive re-runs.
|
|
||||||
- **Sandboxing.** The unit has no capabilities and a read-only file system,
|
|
||||||
and it can reach the network over IPv4 and IPv6 only. Check it on the host
|
|
||||||
with `systemd-analyze security uberbringer`.
|
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user