add deploy/create/install apps, fix templates and docs
- Add apps: create (scaffold host from template), deploy (multi-host deployment with -n filter), install (NixOS installation from live ISO) - Register all apps in flake.nix (create, deploy, install, rebuild) - Add deploy.json config (cryodev-main, SSH port 2299) - Fix generic-server template: was using Pi hardware/boot config, now correct x86_64 with systemd-boot, UEFI, ROOT/BOOT/SWAP labels - Fix template networking.nix: use HOSTNAME placeholder instead of hardcoded cryodev-pi (both templates) - Fix headplane upstream pnpm-deps hash mismatch via overlay - Fix all docs: replace root@ with user@, --ssh-option with NIX_SSHOPTS, add deploy app references, update first-install guide to use create app and document service deactivation steps
This commit is contained in:
parent
1653398873
commit
10bb0c8e34
16 changed files with 366 additions and 55 deletions
|
|
@ -22,26 +22,21 @@ Bei der Erstinstallation gibt es ein Henne-Ei-Problem:
|
|||
|
||||
## Schritt 1: Host-Konfiguration vorbereiten
|
||||
|
||||
> Falls der Host bereits in `hosts/` und `flake.nix` existiert, ueberspringe 1.1-1.3.
|
||||
> Falls der Host bereits in `hosts/` und `flake.nix` existiert, ueberspringe 1.1-1.2.
|
||||
|
||||
### 1.1 Template kopieren
|
||||
### 1.1 Host aus Template erstellen
|
||||
|
||||
```bash
|
||||
cp -r templates/generic-server hosts/<hostname>
|
||||
nix run .#create -- -t generic-server -n <hostname>
|
||||
```
|
||||
|
||||
### 1.2 Hostname setzen
|
||||
Das Script:
|
||||
- Kopiert das Template nach `hosts/<hostname>/`
|
||||
- Setzt den Hostname in `networking.nix`
|
||||
- Erstellt eine leere `secrets.yaml`
|
||||
- Fuegt die Dateien zu Git hinzu
|
||||
|
||||
`hosts/<hostname>/networking.nix`:
|
||||
|
||||
```nix
|
||||
{
|
||||
networking.hostName = "<hostname>";
|
||||
networking.domain = "cryodev.xyz";
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3 In flake.nix registrieren
|
||||
### 1.2 In flake.nix registrieren
|
||||
|
||||
```nix
|
||||
nixosConfigurations = {
|
||||
|
|
@ -49,6 +44,8 @@ nixosConfigurations = {
|
|||
};
|
||||
```
|
||||
|
||||
Ausserdem `hardware.nix` und `disks.sh` fuer die Zielhardware anpassen.
|
||||
|
||||
### 1.4 Services temporaer deaktivieren
|
||||
|
||||
Alle Services, die SOPS-Secrets referenzieren, muessen fuer die Erstinstallation deaktiviert werden. Andernfalls schlaegt die Installation fehl, weil die Secrets noch nicht entschluesselt werden koennen.
|
||||
|
|
@ -252,9 +249,14 @@ Ebenso in `hosts/<hostname>/services/sops.nix` die Secrets-Definitionen wieder e
|
|||
### 3.5 Deployen
|
||||
|
||||
```bash
|
||||
nixos-rebuild switch --flake .#<hostname> \
|
||||
--target-host <user>@<IP> --use-remote-sudo \
|
||||
--ssh-option="-p 2299"
|
||||
nix run .#deploy -- -n <hostname>
|
||||
```
|
||||
|
||||
Dies nutzt die Konfiguration aus `deploy.json`. Alternativ manuell:
|
||||
|
||||
```bash
|
||||
NIX_SSHOPTS="-p 2299" nixos-rebuild switch --flake .#<hostname> \
|
||||
--target-host <user>@<IP> --use-remote-sudo
|
||||
```
|
||||
|
||||
## Schritt 4: Platzhalter-Secrets ersetzen
|
||||
|
|
@ -291,9 +293,7 @@ Nachdem der Server mit Headscale und Forgejo laeuft, die Platzhalter durch echte
|
|||
5. **Erneut deployen**:
|
||||
|
||||
```bash
|
||||
nixos-rebuild switch --flake .#<hostname> \
|
||||
--target-host <user>@<IP> --use-remote-sudo \
|
||||
--ssh-option="-p 2299"
|
||||
nix run .#deploy -- -n <hostname>
|
||||
```
|
||||
|
||||
## Naechste Schritte
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue