Move clicks.codes to systemd

previously we were using pm2 to manage clicks.codes. This was bad for several
reasons, but one of the largest was that it was challenging to auto-restart on
server start. By instead using systemd, we get this for free, as well as
integrating our logging with the rest of our services, etc.!

In a followup commit, we may add a script to automatically pull from git and
restart if necessary, unless we decide that this should be done through CI such
as Jenkins

Change-Id: Icb5f86cd1b5cc6c48d5f700fd7f6be6b448fe8f4
Reviewed-on: https://git.clicks.codes/c/Clicks/NixFiles/+/184
Reviewed-by: Samuel Shuert <coded@clicks.codes>
Tested-by: Skyler Grey <minion@clicks.codes>
2 files changed
tree: c7fc70c3c9f27e55880b36e1d31fea8ae4ce6ec1
  1. .vscode/
  2. homes/
  3. modules/
  4. packages/
  5. secrets/
  6. services/
  7. variables/
  8. .editorconfig
  9. .envrc
  10. .gitignore
  11. .gitmodules
  12. .gitreview
  13. .sops.yaml
  14. flake.lock
  15. flake.nix
  16. LICENSE
  17. README.md
README.md

Clicks' NixFiles

Deploying

To deploy these files to our server we use deploy-rs. If you've got a flakes-enabled nix installed on your system you can run

nix run github:serokell/deploy-rs

You can also install deploy-rs to your profile, at which point you'll be able to run

deploy

Updating secrets

Secrets are stored in SOPS and deployed using scalpel.

If you have a service which needs to store secrets in its config file, please set systemd reloadTriggers and restartTriggers to automatically reload/restart the service whenever the configuration changes.

It's notable that changing the secrets will not trigger a reload/restart of the service. If you want to update the secrets without updating the rest of the configuration you currently need to manually restart the service. It's possible that this could be solved by using systemd paths to watch the files (see https://superuser.com/questions/1171751/restart-systemd-service-automatically-whenever-a-directory-changes-any-file-ins) but this is not a priority