photoncloud-monorepo/nix/modules/lightningstor.nix
centra 54e3a16091 fix(nix): Align service ExecStart with actual binary CLI interfaces
- chainfire: Fix binary name (chainfire-server → chainfire)
- fiberlb: Use --grpc-addr instead of --port
- flaredb: Use --addr instead of --api-addr/--raft-addr
- flashdns: Add --grpc-addr and --dns-addr flags
- iam: Use --addr instead of --port/--data-dir
- k8shost: Add --iam-server-addr for dynamic IAM port connection
- lightningstor: Add --in-memory-metadata for ChainFire fallback
- plasmavmc: Add ChainFire service dependency and endpoint env var
- prismnet: Use --grpc-addr instead of --port

These fixes are required for T039 production deployment. The
plasmavmc change specifically fixes the ChainFire port mismatch
(was hardcoded 50051, now uses chainfire.port = 2379).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:58:40 +09:00

76 lines
2.1 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.lightningstor;
in
{
options.services.lightningstor = {
enable = lib.mkEnableOption "lightningstor service";
port = lib.mkOption {
type = lib.types.port;
default = 8000;
description = "Port for lightningstor API";
};
dataDir = lib.mkOption {
type = lib.types.path;
default = "/var/lib/lightningstor";
description = "Data directory for lightningstor";
};
settings = lib.mkOption {
type = lib.types.attrs;
default = {};
description = "Additional configuration settings";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.lightningstor-server or (throw "lightningstor-server package not found");
description = "Package to use for lightningstor";
};
};
config = lib.mkIf cfg.enable {
# Create system user
users.users.lightningstor = {
isSystemUser = true;
group = "lightningstor";
description = "LightningStor service user";
home = cfg.dataDir;
};
users.groups.lightningstor = {};
# Create systemd service
systemd.services.lightningstor = {
description = "LightningStor Object Storage Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "iam.service" "flaredb.service" ];
requires = [ "iam.service" "flaredb.service" ];
serviceConfig = {
Type = "simple";
User = "lightningstor";
Group = "lightningstor";
Restart = "on-failure";
RestartSec = "10s";
# State directory management
StateDirectory = "lightningstor";
StateDirectoryMode = "0750";
# Security hardening
NoNewPrivileges = true;
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = true;
ReadWritePaths = [ cfg.dataDir ];
# Start command - use in-memory metadata until ChainFire integration is stabilized
ExecStart = "${cfg.package}/bin/lightningstor-server --grpc-addr 0.0.0.0:${toString cfg.port} --data-dir ${cfg.dataDir} --in-memory-metadata";
};
};
};
}