asusmini: select Tangled stable and use standard deployment

This commit is contained in:
Anish Lakhwara committed 2026-11-30 20:13:24 -08:00
1 parent 55328cf620
commit ed1176cc4f
6 files changed
+121 -41

No files matched your search

+93 -23
View File
@@ -87,19 +87,24 @@ This opens your `$EDITOR` with the decrypted content. Save and close to re-encry
#### Manual Deployment
From the server:
From an administrative root shell on the server, with a clean checkout:
```bash
cd /etc/nixos # or wherever this repo is cloned
git pull
sudo nixos-rebuild switch --flake .#asusmini
cd /etc/commonscomputing-nix
git pull --ff-only
nixos-rebuild build --flake .#asusmini
nixos-rebuild switch --flake .#asusmini
```
For the first Spaces upgrade, take the offline backup described below between
`build` and `switch`. There is no separate activation script. Do not run
`nix flake update` unless you intend to update the pinned dependencies too.
#### Auto-Update
The timer is gated until `scripts/upgrade-knot.sh` completes the Tangled
migration and smoke tests. It then resumes weekly updates, including Tangled.
The initial lock selects tested v1.20.0 packages with their own dependencies
so the cutover reuses copied binaries without recompilation.
migration and smoke tests. It then resumes weekly updates. Tangled is pinned to
reviewed stable `v1.20.1`, not its development branch: later Tangled releases need
an explicit tag bump. Other flake inputs continue updating weekly.
A systemd timer runs weekly to:
1. Pull latest git changes
@@ -113,6 +118,35 @@ block updates. Git SSH to `git.commonscomputer.com:2222` uses the verified origi
`205.250.24.44` through a host-specific SSH configuration because Cloudflare does
not proxy that port. The existing deploy key remains in use.
**Setup required:**
```bash
# On the server, generate SSH key for git push
ssh-keygen -t ed25519 -f /root/.ssh/commons-nix-deploy -N ""
cat /root/.ssh/commons-nix-deploy.pub
# Add the public key as a write-enabled deploy key on our forge:
# https://git.commonscomputer.com/aynish/commoncomputing-nix
# If this is the chosen deploy key, configure SSH to use it:
cat >> /root/.ssh/config <<EOF
Host git.commonscomputer.com
IdentityFile /root/.ssh/commons-nix-deploy
EOF
# Verify the existing key before generating/replacing anything on a live host:
git -C /etc/commonscomputing-nix push --dry-run
```
**Manual trigger:**
```bash
sudo systemctl start auto-update
```
**Check status:**
```bash
sudo systemctl status auto-update
sudo journalctl -u auto-update
```
### Spaces Public Beta
The temporary PDS overlay selects published tag `v0.4.600` (runtime version
@@ -131,31 +165,67 @@ After activation, verify `/xrpc/_health` reports `0.4.6000` and inspect its
`#atproto_kem` verification method. These are migration checks, not a substitute
for an authenticated Spaces application test.
**Setup required:**
```bash
# On the server, generate SSH key for git push
ssh-keygen -t ed25519 -f /root/.ssh/commons-nix-deploy -N ""
cat /root/.ssh/commons-nix-deploy.pub
# Add the public key as a deploy key with write access to the GitHub repo
#### One-time backup before the Spaces and Tangled stable upgrade
# Configure git to use the key
cat >> /root/.ssh/config <<EOF
Host github.com
IdentityFile /root/.ssh/commons-nix-deploy
EOF
Use an administrative root shell in `/etc/commonscomputing-nix`. If needed,
bootstrap Git/curl/jq with:
`nix shell --inputs-from . nixpkgs#git nixpkgs#curl nixpkgs#jq --command bash`.
The new configuration installs these tools normally. Tangled stays on stable
`v1.20.1`; its unreleased development-branch security fixes are not included.
Spindle keeps its existing CORS policy and unlimited cache quota rather than
adopting the new wildcard-CORS and 5 GiB cache defaults.
Pause the timer and take its shared lock before updating the checkout:
```bash
systemctl stop auto-update.timer
exec 9>/run/lock/commonscomputing-update.lock
flock --nonblock 9
```
**Manual trigger:**
Stop if the lock is busy. The three existing server edits are duplicates of
committed fixes; discard only those paths, then use the normal pull/build steps:
```bash
sudo systemctl start auto-update
git restore -- hosts/asusmini/atproto.nix hosts/asusmini/default.nix scripts/upgrade-knot.sh
git pull --ff-only https://git.commonscomputer.com/aynish/commoncomputing-nix.git main
nixos-rebuild build --flake .#asusmini
```
**Check status:**
Tangled `v1.20.1` also adds automatic Spindle database migrations. After a
successful build, stop the three application services and take one consistent
backup. Spindle may wait for running jobs to drain before it stops:
```bash
sudo systemctl status auto-update
sudo journalctl -u auto-update
umask 077
backup=/var/backups/pds-spaces-$(date -u +%Y%m%dT%H%M%SZ)
mkdir -p "$backup"
readlink -f /run/current-system > "$backup/old-system"
cp flake.lock "$backup/flake.lock"
systemctl stop bluesky-pds knot-rs spindle
tar --acls --xattrs --numeric-owner -C / -cpf "$backup/state.tar" var/lib/pds var/lib/knot var/lib/spindle
tar --compare -f "$backup/state.tar" -C / var/lib/pds var/lib/knot var/lib/spindle
cp --dereference /run/agenix/pds-env "$backup/pds-env"
cp --dereference /run/agenix/knot-env "$backup/knot-env"
```
Stop on any failure. If backup fails before activation, restart the unchanged
services. Keep the backup root-only; it contains private keys.
Then use the normal `nixos-rebuild switch --flake .#asusmini` and ensure
`systemctl start bluesky-pds knot-rs spindle` succeeds. Check PDS local and
public health/migration counters, hosted PLC KEM keys, and Knot/Spindle/SSH health.
Verify root's `git push --dry-run` succeeds and the checkout is clean. After all
checks pass:
```bash
systemctl reset-failed auto-update.service
systemctl start auto-update.timer
exec 9>&-
```
Do not blindly roll back databases or PLC changes after activation has started.
## Development
### Updating Flake Inputs
+6 -4
View File
@@ -1,9 +1,11 @@
# Tangled Upgrade
The initial cutover uses tested v1.20.0 packages. `flake.lock` still selects
commit `2096d06d938e680297adeadd71b8320c9f3491d4`; the input URL tracks upstream
again so subsequent weekly updates can advance Tangled. Upstream's own nixpkgs
is retained to reuse the built release binaries.
This runbook covers the original Go-to-Rust cutover using v1.20.0. Do not rerun
that migration for an ordinary Rust Knot/Spindle version update.
The current flake pins reviewed stable `v1.20.1`, not the development branch.
Future Tangled upgrades require an explicit stable tag bump; other flake inputs
still update weekly. Upstream's own nixpkgs is retained for release builds.
## Run The Script
Generated
+12 -11
View File
@@ -50,11 +50,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1780397302,
"narHash": "sha256-SQmrkj17xBdvc8lVMbsY7pIJCjKftgNh42R1keP3dLQ=",
"lastModified": 1794750246,
"narHash": "sha256-7Yd8fQdT8G1p76nY5thZMAO4/hMyhG9iIL42i8OfbLU=",
"owner": "nix-community",
"repo": "fenix",
"rev": "f6670530f53e69cc284f7aef818eb0f08fe81905",
"rev": "03b9a946cbd2777de45d7ba96c29157e1f7db613",
"type": "github"
},
"original": {
@@ -298,11 +298,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1780337665,
"narHash": "sha256-RS3F+/6dtBIwd5+47GVen3jAk62/KumFZ4q3RVYafDk=",
"lastModified": 1794699679,
"narHash": "sha256-v46dxoiIRQrRDwO/OGb9F2cBEk9aqKQyzLz7wQi9oPY=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "55af1774e9e840d3b28d12fcfaa72d2e2caa8ac9",
"rev": "b664fd5c7e7055c9569960f7fe73f21c7d00c9cd",
"type": "github"
},
"original": {
@@ -388,15 +388,16 @@
"timeless-fonts-src": "timeless-fonts-src"
},
"locked": {
"lastModified": 1793599751,
"narHash": "sha256-4wVWMvjB/sI59PMBGbzoh42DXhTXA4EYCKy+qf8hrXg=",
"ref": "refs/heads/master",
"rev": "81208fca2ac303f8a6d0231d096f66d6fb28a7d3",
"revCount": 6150,
"lastModified": 1794841019,
"narHash": "sha256-G9GqopFb5msKSPs54IYLY6i6UotO1nm1T4jP9NI21K8=",
"ref": "refs/tags/v1.20.1",
"rev": "af4f4d69adfc252b6a06cf3394e37ddf6eb4a4e2",
"revCount": 6544,
"type": "git",
"url": "https://tangled.org/@tangled.org/core"
},
"original": {
"ref": "refs/tags/v1.20.1",
"type": "git",
"url": "https://tangled.org/@tangled.org/core"
}
+3 -3
View File
@@ -4,9 +4,9 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
tangled = {
# flake.lock initially selects tested v1.20.0; weekly updates track upstream.
# Keep upstream's own nixpkgs so copied release binaries remain reusable.
url = "git+https://tangled.org/@tangled.org/core";
# Track reviewed stable releases, not the development branch.
# Keep upstream's own nixpkgs so release binaries remain reusable.
url = "git+https://tangled.org/@tangled.org/core?ref=refs/tags/v1.20.1";
};
agenix = {
url = "github:ryantm/agenix";
+4
View File
@@ -41,9 +41,13 @@
enable = true;
keyPath = "/var/lib/spindle/key.pem";
contact.email = "pds@email.commonscomputer.com";
# Keep the existing unlimited cache policy rather than evicting at the new 5 GiB default.
quota.user.cacheStorageMiB = 0;
server = {
hostname = "spindle.commonscomputer.com";
owner = "did:plc:om5yygegi4yxcbay5gemn2wm";
# Preserve the existing policy; v1.20.1 defaults to allowing every origin.
corsOrigins = [ ];
};
};
+3
View File
@@ -80,6 +80,9 @@
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
git
curl
jq
];
# Some programs need SUID wrappers, can be configured further or are