run certbot through uvx
thierry ·
I wasn't happy with certbot's install alternatives:
I did not want to use Snap; I'd like to avoid Ubuntu-specific tech.
I did not want to use Pip; I don't want to install
gccon my machine hosting websites.The container image might have been nice, but none were packed with the Infomaniak DNS module I needed.
Since I've been really enjoying uv to manage Python dependencies, I thought uvx could handle the setup for me. However, I did not want to run the install setup as root, so I went with the following:
# I won't install gcc, but I'll pipe your install script into a shell…
$ curl -LsSf https://astral.sh/uv/install.sh | sh
# Install certbot with the Infomaniak auth module
$ uvx --with certbot-dns-infomaniak certbot --help
# Run certbot as root
$ sudo .local/bin/uvx
--offline --cache-dir .cache/uv \
--with certbot-dns-infomaniak \
certbot certonly \
--authenticator dns-infomaniak \
--dns-infomaniak-credentials /path/to/secret.creds \
-d 'tty.cafe' -d '*.tty.cafe'I still had to troubleshoot some authentication error. My previous token was for Infomaniak API v1, but the current auth module uses the API v2. After surfacing the scope issue, issuing a new token solved the problem. The error message I got was unrelated to authentication, so I had to dig to find the root of the problem.
It's like I really like finding the most convoluted way of doing things, but I'm happy with the result!
GCC would have take about 200 MiB, but uvx only uses 69 MiB and was much faster.
$ apt-cache show $(apt-cache depends --recurse --important gcc | grep -v '^ ') \
| awk '/Installed-Size:/ { sum += $2 } END { print (1000*sum/2**20), "MiB" }'
208.504 MiB
$ du -csh .cache/ .config/ .local/
32M .cache
37M .local
32K .config
69M total