tools/snap/README.md
These instructions are recommended when testing anything about the snap setup for ease of debugging. The architecture of the built snap is limited to the architecture of the system it is built on.
These steps need to be done once to set up your VM and do not need to be run again to rebuild the snap.
adduser certbot && usermod -aG sudo certbot && su - certbot.sudo apt update && sudo apt install -y git python.sudo snap install lxd; sudo /snap/bin/lxd waitready && sudo /snap/bin/lxd init --auto (errors here are ok; it may already
have been installed on your system).sudo usermod -a -G lxd ${USER} && newgrp lxd.sudo snap install --classic snapcraft.cd ~ (or any other directory where you want our source files to be)git clone https://github.com/certbot/certbotcd certbot (All further instructions are relative to this directory.)If the snap has been built before, the instructions below clean up the build environment so it can reliably be used again.
snapcraft clean --use-lxdmv certbot_*_amd64.snap certbot_amd64.snap.bakThese are the steps to build and install the Certbot snap. If you have run these steps before, you may want to run the commands in the section above to clean things up or save a previous build before building the snap again (running snapcraft again will overwrite the previous snap).
snapcraft --use-lxd.sudo snap install --dangerous --classic certbot_*_amd64.snap. You can transfer the snap to a different machine to run it there instead if you prefer.Run Certbot as normal. For example, certbot plugins should display the Apache and Nginx plugins.
These instructions use the certbot-dns-dnsimple plugin as an example, but all of Certbot's other plugin snaps can be built in the same way.
If the plugin snap has been built before, the instructions below clean up the build environment so it can reliably be used again.
cd certbot-dns-dnsimplesnapcraft clean --use-lxdmv certbot-dns-dnsimple_*_amd64.snap certbot-dns-simple_amd64.snap.bakcd ..These are the steps to build and install the Certbot DNSimple plugin snap. If you have run these steps before, you may want to run the commands in the section above to clean things up or save a previous build before building the snap again (running snapcraft again will overwrite the previous snap).
tools/snap/generate_dnsplugins_all.sh to generate all necessary files for all plugin snaps.cd certbot-dns-dnsimplesnapcraft --use-lxdsudo snap set certbot trust-plugin-with-root=ok.sudo snap install --dangerous certbot-dns-dnsimple_*_amd64.snap. Again, you can transfer the snap to a different machine to run it there instead if you prefer.sudo snap connect certbot:plugin certbot-dns-dnsimple.sudo snap connect certbot-dns-dnsimple:certbot-metadata certbot:certbot-metadata. Install the plugin again to test refresh; if the plugin's hook creates any logs, they are at /var/snap/certbot-dns-dnsimple/current/debuglog.Run Certbot as normal. For example, certbot plugins should display the DNSimple plugin as installed.
To build for an unavailable architecture or for multiple architectures simultaneously, we recommend using snapcraft's remote build feature. It is easiest to run this from a local machine.
sudo apt update && sudo apt install -y git python.sudo snap install --classic snapcraft.cd ~ (or any other directory where you want our source files to be)git clone https://github.com/certbot/certbotcd certbot (All further instructions are relative to this directory.)snapcraft to request access to your Launchpad account, run
snapcraft remote-build --launchpad-accept-public-upload --status. A URL where you need
to grant this access will be printed to your terminal and automatically open in your browser
if one is available.Certbot provides a wrapper around snapcraft's remote build to make building all of our plugins easier. To see all available
options, run python3 tools/snap/build_remote.py --help.
For example, to build all available snaps for all architectures, run python3 tools/snap/build_remote.py ALL --archs amd64 arm64 armhf.
To build only the certbot snap on only amd64, run python3 tools/snap/build_remote.py certbot --archs armhf.
The command will upload the entire contents of the working directory, so if the remote build
appears to hang, try using a clean clone of the certbot repository.