Document automated binary release system
- Replace source build instructions with release workflow - Document tag-based release process with Gitea Actions - Include NixOS config update process for releases - Highlight benefits of static binary approach
This commit is contained in:
parent
f9bf3ce610
commit
b310206f1f
65
CLAUDE.md
65
CLAUDE.md
@ -295,60 +295,61 @@ Development: ~/projects/nixosbox → git commit → git push
|
|||||||
Deployment: git pull → /var/lib/cm-dashboard/nixos-config → rebuild
|
Deployment: git pull → /var/lib/cm-dashboard/nixos-config → rebuild
|
||||||
```
|
```
|
||||||
|
|
||||||
## NixOS Configuration Updates
|
## Automated Binary Release System
|
||||||
|
|
||||||
When code changes are made to cm-dashboard, the NixOS configuration at `~/projects/nixosbox` must be updated to deploy the changes.
|
**IMPLEMENTED:** cm-dashboard now uses automated binary releases instead of source builds.
|
||||||
|
|
||||||
### Update Process
|
### Release Workflow
|
||||||
|
|
||||||
1. **Get Latest Commit Hash**
|
1. **Automated Release Creation**
|
||||||
|
- Gitea Actions workflow builds static binaries on tag push
|
||||||
|
- Creates release with `cm-dashboard-linux-x86_64.tar.gz` tarball
|
||||||
|
- No manual intervention required for binary generation
|
||||||
|
|
||||||
|
2. **Creating New Releases**
|
||||||
```bash
|
```bash
|
||||||
git log -1 --format="%H"
|
cd ~/projects/cm-dashboard
|
||||||
|
git tag v0.1.X
|
||||||
|
git push origin v0.1.X
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This automatically:
|
||||||
|
- Builds static binaries with `RUSTFLAGS="-C target-feature=+crt-static"`
|
||||||
|
- Creates GitHub-style release with tarball
|
||||||
|
- Uploads binaries via Gitea API
|
||||||
|
|
||||||
2. **Update NixOS Configuration**
|
3. **NixOS Configuration Updates**
|
||||||
Edit `~/projects/nixosbox/hosts/common/cm-dashboard.nix`:
|
Edit `~/projects/nixosbox/hosts/common/cm-dashboard.nix`:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
src = pkgs.fetchgit {
|
version = "v0.1.X";
|
||||||
url = "https://gitea.cmtec.se/cm/cm-dashboard.git";
|
src = pkgs.fetchurl {
|
||||||
rev = "NEW_COMMIT_HASH_HERE";
|
url = "https://gitea.cmtec.se/cm/cm-dashboard/releases/download/${version}/cm-dashboard-linux-x86_64.tar.gz";
|
||||||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Placeholder
|
sha256 = "sha256-NEW_HASH_HERE";
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Get Correct Source Hash**
|
4. **Get Release Hash**
|
||||||
Build with placeholder hash to get the actual hash:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/projects/nixosbox
|
cd ~/projects/nixosbox
|
||||||
nix-build --no-out-link -E 'with import <nixpkgs> {}; fetchgit {
|
nix-build --no-out-link -E 'with import <nixpkgs> {}; fetchurl {
|
||||||
url = "https://gitea.cmtec.se/cm/cm-dashboard.git";
|
url = "https://gitea.cmtec.se/cm/cm-dashboard/releases/download/v0.1.X/cm-dashboard-linux-x86_64.tar.gz";
|
||||||
rev = "NEW_COMMIT_HASH";
|
|
||||||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
}' 2>&1 | grep "got:"
|
}' 2>&1 | grep "got:"
|
||||||
```
|
```
|
||||||
|
|
||||||
Example output:
|
5. **Commit and Deploy**
|
||||||
|
|
||||||
```
|
|
||||||
error: hash mismatch in fixed-output derivation '/nix/store/...':
|
|
||||||
specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
|
||||||
got: sha256-x8crxNusOUYRrkP9mYEOG+Ga3JCPIdJLkEAc5P1ZxdQ=
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Update Configuration with Correct Hash**
|
|
||||||
Replace the placeholder with the hash from the error message (the "got:" line).
|
|
||||||
|
|
||||||
5. **Commit NixOS Configuration**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/projects/nixosbox
|
cd ~/projects/nixosbox
|
||||||
git add hosts/common/cm-dashboard.nix
|
git add hosts/common/cm-dashboard.nix
|
||||||
git commit -m "Update cm-dashboard to latest version (SHORT_HASH)"
|
git commit -m "Update cm-dashboard to v0.1.X with static binaries"
|
||||||
git push
|
git push
|
||||||
```
|
```
|
||||||
|
|
||||||
6. **Rebuild System**
|
### Benefits
|
||||||
The user handles the system rebuild step - this cannot be automated.
|
|
||||||
|
- **No compilation overhead** on each host
|
||||||
|
- **Consistent static binaries** across all hosts
|
||||||
|
- **Faster deployments** - download vs compile
|
||||||
|
- **No library dependency issues** - static linking
|
||||||
|
- **Automated pipeline** - tag push triggers everything
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user