Automated deployments #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would like to implement automated (semi-automatic) deployments of the NixOS machines. This would decrease the effort for deploying changes to (all) the affected hosts, including keys management. Putting a system in place and clearly defining the trust boundaries would be beneficial in my opinion.
Using GitHub/Forgejo Actions, I have the following approach(es) in mind:
Push based system
Features/changes to the config are implemented in their separate branches. On every push, the modified derivations are built, as to check if they are valid. Once merged into the main branch, or when pushed to a
test-<hostname>branch, the changes are pushed to the host and the services are restarted. The changes would be built on a build-host, with additional resources (mainly memory).Caveats would be:
Pull based system
Features/changes to the config are implemented in their separate branches, though 'hotfixes' should be possible as well. On every push, the modified derivations can be built, as to check if they are valid, but in this case I think it is less appropriate. Once merged into the main branch, or when pushed to a
test-<hostname>branch, either a) the host periodically checks for changes (usingsystem.autoUpgrade?) and pull them in, or b) some kind of webhook system is implemented to let the host(s) know to pull the new changes. The changes would either be built on the systems themselves, as to spread the resource consumption, or be built once again on a centralized build-host.Caveats I can think of:
Discussion
In both systems, the main branch should be protected with appropriate rules. I think putting signed commits and checking for those signatures in place is appropriate as well.
In both cases, rollbacks are a challenge to implement (myself).
deploy-rsimplements a magic rollback.Documentation
Continuous integration with GitHub Actions
Setting up distributed builds
Deployment tools: colmena, deploy-rs, comin
Forgejo Actions Reference
NixOS deployment: from push to pull
Remote deployment NixOS & Flakes Book
CI/CD rebuilds via github