|
| 1 | +# Tahoe-LAFS Infrastructure |
| 2 | + |
| 3 | +The software that defines the Tahoe-LAFS project's infrastructure. |
| 4 | + |
| 5 | +## Abstract |
| 6 | + |
| 7 | +This repository was initially created in Sep 2022 as an effort to deploy and |
| 8 | +manage a `testgrid` server using NixOS (now retired). |
| 9 | + |
| 10 | +Since January 2025, some members of the community are seeking to re-use this repository |
| 11 | +to deploy and manage some new [systems](#managed-systems). |
| 12 | + |
| 13 | +In addition to the [Nix](https://nixos.org/) code covering the software installed on those servers, |
| 14 | +an [OpenToFu](https://opentofu.org/) plan should handle the definition of the related infrastructure (e.g.: VMs and DNS records). |
| 15 | + |
| 16 | +**Warning**: The content of this repository is currently a work in progress. See the [Roadmap](docs/Roadmap.md) for more information. |
| 17 | + |
| 18 | +## How to Contribute |
| 19 | + |
| 20 | +- Read the doc and the code, consult the existing issues and visit https://tahoe-lafs.org/ to get in touch with the community |
| 21 | +- Describe the bug/problem or the missing info/feature in a new issue in this repository |
| 22 | +- Submit pull requests (preferably one per issue) and verify the check status |
| 23 | + |
| 24 | + **Caveat**: because they need access to the repository secrets, changes related to OpenToFu will only be triggered on local branches (which means a maintainer will have to be involved - see [Roadmap](docs/Roadmap.md)). Changes related to Nix may not suffer the same restriction. |
| 25 | + |
| 26 | +- Once a pull request as been approved and merged, verify the expected changes and provide feedback in the issue(s) if needed |
| 27 | + |
| 28 | +## Managed Systems |
| 29 | + |
| 30 | +Here is a short description of the systems managed from this repository. |
| 31 | + |
| 32 | +### Testgrid |
| 33 | + |
| 34 | +Initially deployed re-using the NixOS configuration written in 2022, this server is a Tahoe-LAFS stand-alone grid allowing contributors to test any client software (e.g.: mobile apps). |
| 35 | + |
| 36 | +**Warning**: This server should be re-configured on regular basis, |
| 37 | +which means the availability of the related services and their data will NOT be guaranteed very long. |
| 38 | + |
| 39 | +More info: |
| 40 | + |
| 41 | +- [README](./testgrid.tahoe-lafs.org/README) file |
| 42 | +- [TestGrid](https://tahoe-lafs.org/trac/tahoe-lafs/wiki/TestGrid) wiki page |
| 43 | + |
| 44 | +### Webforge |
| 45 | + |
| 46 | +Tahoe-LAFS issue tracking, wiki and web server meant to replace the current [Trac](https://tahoe-lafs.org/trac/tahoe-lafs) server. |
| 47 | + |
| 48 | +**Notice**: This server could be managed only for a limited period of time, |
| 49 | +depending if/when the community wants to migrate the content elsewhere (e.g.: Codeberg). |
| 50 | + |
| 51 | +More info: |
| 52 | + |
| 53 | +- [MoveOffTrac](https://github.com/tahoe-lafs/MoveOffTrac) repository |
| 54 | +- [MoveOffTrac](https://tahoe-lafs.org/trac/tahoe-lafs/wiki/MoveOffTrac) wiki page |
| 55 | + |
| 56 | +## Deployment Workflow |
| 57 | + |
| 58 | +This section describes how the resources defined in this repository should be deployed. |
| 59 | + |
| 60 | +### Underlying Infrastructure |
| 61 | + |
| 62 | +1. Ensure the relevant ssh public keys are defined in the relevant Hetzner project (e.g.: Tahoe-LAFS) |
| 63 | +2. Create a new Debian VPS referring to at least one ssh key in the same project |
| 64 | +3. Infect the VPS with NixOS (e.g.: using `cloud-init`) |
| 65 | +4. Publish the new A/AAAA/PTR/CNAME DNS records the related zone (e.g.: `tahoe-lafs.org` hosted by Gandi) |
| 66 | + |
| 67 | +### OS and Software |
| 68 | + |
| 69 | +### Provisioning |
| 70 | + |
| 71 | +This section describes how to proceed for the first deployment of a NixOS server. |
| 72 | + |
| 73 | +The NixOS configuration has to be manually deployed at least once using: |
| 74 | + |
| 75 | +``` |
| 76 | +nixos-rebuild switch --target-host the-remote-host-to-deploy |
| 77 | +``` |
| 78 | + |
| 79 | +This first deployment should bootstrap (or fix) the requirements for the automation of the next ones: |
| 80 | + |
| 81 | +1. Retrieve the the public ssh key of the server deployed earlier and |
| 82 | + add/update the ssh `known_hosts` files (in this repository and locally) |
| 83 | +2. Convert this public ssh key in a gpg one to encrypt the secrets with sops, |
| 84 | + so the server it-self will be able to decrypt the secrets it needs. |
| 85 | + |
| 86 | +### Continuous Deployment |
| 87 | + |
| 88 | +Subsequent deployment should be triggered by GHA when merging a PR into the main branch. |
| 89 | + |
| 90 | +#### Underlying Infrastructure |
| 91 | + |
| 92 | +Assuming OpenToFu is used, any changes to the existing plan should be automatically verified and |
| 93 | +described in a comment added on the pull request. |
| 94 | + |
| 95 | +Most failures should be detailed with the relevant error messages also published in this comment. |
| 96 | + |
| 97 | +#### OS and Software |
| 98 | + |
| 99 | +Assuming this repository has been configured with: |
| 100 | + |
| 101 | +- a secret ssh (private) key to interact with the OS already [provisioned](#provisioning), |
| 102 | +- some (public) deployment (ssh) keys allowing each [provisioned](#provisioning) servers to checkout the Nix code, |
| 103 | + |
| 104 | +a pull request would automatically run `nix flake check` which should trigger the `nix build` of |
| 105 | +all the `nixosConfiguration` and their dependencies (could take a while). |
| 106 | + |
| 107 | +And here is how the automated deployment should work once a pull request is merged: |
| 108 | + |
| 109 | +1. the GHA runner initiate an remote shell via ssh using the private ssh key, |
| 110 | +2. the authenticated user triggers an hardened deployment script (the only command available to him), |
| 111 | +3. this script checks out the Nix code from the repository at the targeted revision and |
| 112 | +4. call the `nixos-rebuild` to **`switch`** to the `nixosConfiguration` on the local host. |
| 113 | + |
| 114 | +The output of the deployment script should be visible in the GHA logs. |
0 commit comments