photoncloud-monorepo/docs/por/T036-vm-cluster-deployment/node01/configuration.nix
centra 5586929e98 fix(nix): Add creditservice.enable + fix CLI args
- Add services.creditservice.enable = true to all node configs
- Add firewall port 3010 (gRPC) for creditservice
- Fix creditservice.nix CLI: --listen-addr/--http-addr (not --port/--data-dir)
- Add CREDITSERVICE_CHAINFIRE_ENDPOINT environment variable
- Updated S4 test script to expect 11 services (was 10)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 00:17:48 +09:00

140 lines
3.7 KiB
Nix

{ config, pkgs, lib, ... }:
{
imports = [
# hardware-configuration.nix auto-generated by nixos-anywhere
./disko.nix
];
# System identity
networking.hostName = "node01";
networking.domain = "plasma.local";
# Cluster node resolution
networking.hosts = {
"192.168.100.11" = [ "node01" "node01.plasma.local" ];
"192.168.100.12" = [ "node02" "node02.plasma.local" ];
"192.168.100.13" = [ "node03" "node03.plasma.local" ];
};
# Network configuration
networking.useDHCP = false;
networking.interfaces.eth0 = {
useDHCP = false;
ipv4.addresses = [{
address = "192.168.100.11";
prefixLength = 24;
}];
};
# eth1 for SLIRP/NAT SSH access in VM environment
networking.interfaces.eth1.useDHCP = true;
networking.defaultGateway = "192.168.100.1";
networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
# Firewall configuration
networking.firewall = {
enable = true;
allowedTCPPorts = [
22 # SSH
2379 # Chainfire API
2380 # Chainfire Raft
2381 # Chainfire Gossip
2479 # FlareDB API
2480 # FlareDB Raft
3080 # IAM API
8081 # PlasmaVMC API
8082 # PrismNET API
8053 # FlashDNS API
8084 # FiberLB API
8085 # LightningStor API
8086 # K8sHost API
9090 # Prometheus
3000 # Grafana
3010 # CreditService API
];
};
# Boot configuration
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# LVM support in initrd (systemd-based stage 1)
boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = [ "dm-snapshot" "dm-mod" "dm-crypt" ];
boot.initrd.services.lvm.enable = true;
# Ensure LVM is available
services.lvm.enable = true;
services.lvm.boot.thin.enable = true;
# Additional LVM device waiting
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_blk" "virtio_scsi" "sd_mod" ];
# Use traditional interface names (eth0, eth1) for QEMU compatibility
boot.kernelParams = [ "net.ifnames=0" "biosdevname=0" "console=ttyS0,115200n8" "loglevel=4" ];
# Haveged for entropy in VMs
services.haveged.enable = true;
# Enable PlasmaCloud services (control-plane profile)
services.chainfire.enable = true;
services.flaredb.enable = true;
services.iam = {
enable = true;
port = 3080; # Avoid conflict with Grafana on 3000
};
services.plasmavmc.enable = true;
services.prismnet.enable = true;
services.flashdns.enable = true;
services.fiberlb.enable = true;
services.lightningstor.enable = true;
services.k8shost.enable = true;
services.nightlight.enable = true;
services.creditservice.enable = true;
services.cloud-observability.enable = true;
# First-boot automation
services.first-boot-automation = {
enable = true;
configFile = "/etc/nixos/secrets/cluster-config.json";
enableChainfire = true;
enableFlareDB = true;
enableIAM = true;
enableHealthCheck = true;
};
# System packages
environment.systemPackages = with pkgs; [
vim
htop
curl
jq
tcpdump
lsof
netcat
];
# SSH configuration
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
PasswordAuthentication = false;
};
};
# Time zone and locale
time.timeZone = "UTC";
i18n.defaultLocale = "en_US.UTF-8";
# System user
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICaSw8CP4Si0Cn0WpYMhgdYNvsR3qFO0ZFiRjpGZXd6S centra@cn-nixos-think"
];
# Allow unfree packages (if needed for drivers)
nixpkgs.config.allowUnfree = true;
# System state version
system.stateVersion = "24.05";
}