diff --git a/src/procedures/skynet/server_update_nixos.md b/src/procedures/skynet/server_update_nixos.md new file mode 100644 index 0000000..23605fc --- /dev/null +++ b/src/procedures/skynet/server_update_nixos.md @@ -0,0 +1,84 @@ +# Updating Servers (NixOS) +A short guide on how to update NixOS servers. +This is required at least once a semester in order to keep the systems up to date. + +These are some of the easiest servers we have to update. +This is how you update it locally, and then deploy. + +## Update +Invoke the devshell for the NixOS repo locally on your computer (TODO: Setup nix and into to devshell). +This will give you all the tools you need to update the NixOS servers. + +In that shell you can run these commands. + +```shell +# this will update every input, sometimes that is not desired +nix flake update + +# This will update a single input, nixpkgs which will update the OS's +nix flake update nixpkgs colmena + +# Update multiple at once, these are the core tools and utilities +# Recommended command +nix flake update nixpkgs flake-utils agenix arion alejandra colmena +``` + +## Build +Now that the inputs have been updated it is time to build it locally to ensure no errors pop up. +For any errors that pop up you can use ``--key-result`` in order to explore the system output. + +```shell +# This will build all the servers locally +colmena build + +# Build a single one +colmena build --on glados + +# Build a logical group of them +colmena build --on @active-dns + +# Build all but keep the outputs in ``.gcroots`` +# This is useful if you need to explore the config locally +colmena build --keep-result +``` + + +## Deploy +It is now time to commit and deploy the updates. + + +### Manually +Most of the flags from the build step above apply for teh deploy step. +You dont need to have the files committed to do this, so it cna be useful for testing. + +```shell +# This will build all the servers locally +colmena deploy + +# Build a single one +colmena deploy --on glados + +# Build a logical group of them +colmena deploy --on @active-dns +``` + + +### Pipeline +To deploy via the pipeline simply commit and push to Forgejo. +The pipeline will build and deploy to almost all the servers. +Downside of this is slow iteration for testing, but it is useful if you are pretty sure of teh changes. + +#### Git Server/Runner +The CI/CD pipelines we have run on Glados and Wheatly, as such the pipelines are not able to update these two servers on their own. +These need to be updated manually using any of these commands: + +```shell +# This will deploy all the servers +colmena deploy + +# Deploy a single one +colmena deploy --on glados wheatly + +# Deploy a logical group of them +colmena deploy --on @active-git +``` \ No newline at end of file