colmena: configuration et doc
This commit is contained in:
parent
dd227a92dc
commit
ef1453ab1e
5 changed files with 106 additions and 84 deletions
33
README.md
33
README.md
|
@ -71,3 +71,36 @@ commande :
|
||||||
```bash
|
```bash
|
||||||
$ nix fmt
|
$ nix fmt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Colmena
|
||||||
|
|
||||||
|
Pour faciliter le redeploiement des machines, l'outils colmena est utilisé.
|
||||||
|
Pour cela, l'ensemble des machines doivent être écrite dans la `flake` au
|
||||||
|
format `colmena.<name>`. Des tags peuvent être ajouté avec `deployment.tags`
|
||||||
|
afin redéployer un groupe de machines en même temps.
|
||||||
|
|
||||||
|
Pour utiliser les commandes suivantes, il est nécessaire d'avoir colmena sur
|
||||||
|
son ordinateur. La commande `nix develop` s'en chargera.
|
||||||
|
|
||||||
|
Remarque :
|
||||||
|
|
||||||
|
> Si l'ensemble des fichiers du repertoire ne sont pas commit, alors colmena
|
||||||
|
> considérera que le répertoire est "impure". S'il est vraiment nécessaire
|
||||||
|
> d'appliquer la confifuration, il est possible de le faire à l'aide du flag
|
||||||
|
> `--impure`.
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ colmena build # Build toutes les machines
|
||||||
|
$ colmena build --on <machine> # Build uniquement la machine <machine>
|
||||||
|
$ colmena build --on @<tag> # Build les machines possédant ce tag
|
||||||
|
```
|
||||||
|
|
||||||
|
### Apply
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ colmena apply # Apply toutes les machines
|
||||||
|
$ colmena apply --on <machine> # Apply uniquement la machine <machine>
|
||||||
|
$ colmena apply --on @<tag> # Apply les machines possédant ce tag
|
||||||
|
```
|
||||||
|
|
116
flake.nix
116
flake.nix
|
@ -34,39 +34,9 @@
|
||||||
}:
|
}:
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
imports = [ inputs.treefmt-nix.flakeModule ];
|
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||||
|
|
||||||
systems = [ "x86_64-linux" ];
|
systems = [ "x86_64-linux" ];
|
||||||
|
|
||||||
flake = with nixpkgs.lib; {
|
flake = with nixpkgs.lib;
|
||||||
colmena = {
|
|
||||||
meta = {
|
|
||||||
nixpkgs = import nixpkgs {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
overlays = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
jitsi = {
|
|
||||||
deployment = {
|
|
||||||
targetHost = "jitsi.pub.infra.auro.re";
|
|
||||||
targetPort = 22;
|
|
||||||
targetUser = "root";
|
|
||||||
tags = [ "services" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./profiles/common
|
|
||||||
agenix.nixosModules.default
|
|
||||||
disko.nixosModules.disko
|
|
||||||
./profiles/vm
|
|
||||||
./disks/layout_vm.nix
|
|
||||||
./hosts/vm/jitsi
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixosConfigurations =
|
|
||||||
let
|
let
|
||||||
defaultConfig = [
|
defaultConfig = [
|
||||||
./profiles/common
|
./profiles/common
|
||||||
|
@ -79,32 +49,70 @@
|
||||||
./disks/layout_vm.nix
|
./disks/layout_vm.nix
|
||||||
]
|
]
|
||||||
++ defaultConfig;
|
++ defaultConfig;
|
||||||
in
|
machines = {
|
||||||
{
|
jitsi = {
|
||||||
grafana = nixosSystem {
|
domain = "pub.infra.auro.re";
|
||||||
specialArgs = inputs;
|
tags = [ "vm" ];
|
||||||
modules = [
|
config = [ ./hosts/vm/jitsi ] ++ defaultVM;
|
||||||
./hosts/vm/grafana
|
|
||||||
]
|
|
||||||
++ defaultVM;
|
|
||||||
};
|
};
|
||||||
log-2 = nixosSystem {
|
grafana = {
|
||||||
specialArgs = inputs;
|
domain = "ext.infra.auro.re";
|
||||||
modules = [
|
tags = [ "vm" ];
|
||||||
|
config = [
|
||||||
|
./hosts/vm/grafana
|
||||||
|
] ++ defaultVM;
|
||||||
|
};
|
||||||
|
log-2 = {
|
||||||
|
domain = "int.infra.auro.re";
|
||||||
|
tags = [ "vm" "log" ];
|
||||||
|
config = [
|
||||||
./hosts/vm/log-2
|
./hosts/vm/log-2
|
||||||
./disks/layout_vm_log.nix
|
./disks/layout_vm_log.nix
|
||||||
]
|
] ++ defaultVM;
|
||||||
++ defaultVM;
|
|
||||||
};
|
};
|
||||||
# VL: Peut-être avoir de l'auto-discovery: On a beaucoup trop de machines
|
};
|
||||||
jitsi = nixosSystem {
|
colmena_conf = builtins.mapAttrs
|
||||||
|
(
|
||||||
|
name: conf: {
|
||||||
|
deployment = {
|
||||||
|
targetHost = "${name}.${conf.domain}";
|
||||||
|
targetPort = 22;
|
||||||
|
targetUser = "root";
|
||||||
|
tags = conf.tags;
|
||||||
|
};
|
||||||
|
networking = {
|
||||||
|
hostName = name;
|
||||||
|
domain = conf.domain;
|
||||||
|
};
|
||||||
|
imports = conf.config;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
machines;
|
||||||
|
nixos_conf = builtins.mapAttrs
|
||||||
|
(
|
||||||
|
name: conf: nixosSystem {
|
||||||
specialArgs = inputs;
|
specialArgs = inputs;
|
||||||
modules = [
|
modules = [{
|
||||||
./hosts/vm/jitsi
|
networking = {
|
||||||
]
|
hostName = name;
|
||||||
++ defaultVM;
|
domain = conf.domain;
|
||||||
|
};
|
||||||
|
}] ++ conf.config;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
machines;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
colmena = {
|
||||||
|
meta = {
|
||||||
|
nixpkgs = import nixpkgs {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
overlays = [ ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // colmena_conf;
|
||||||
|
|
||||||
|
nixosConfigurations = nixos_conf;
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = { config, pkgs, system, ... }:
|
perSystem = { config, pkgs, system, ... }:
|
||||||
|
@ -116,13 +124,9 @@
|
||||||
# Formatter
|
# Formatter
|
||||||
treefmt.config = {
|
treefmt.config = {
|
||||||
package = pkgs.treefmt;
|
package = pkgs.treefmt;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
# *.nix
|
nixpkgs-fmt.enable = true; # *.nix
|
||||||
nixpkgs-fmt.enable = true;
|
prettier.enable = true; # *.md (and more)
|
||||||
|
|
||||||
# *.md (and more)
|
|
||||||
prettier.enable = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
./grafana.nix
|
./grafana.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "grafana";
|
|
||||||
domain = "ext.infra.auro.re";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
./jitsi.nix
|
./jitsi.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "jitsi";
|
|
||||||
domain = "pub.infra.auro.re";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
|
|
||||||
disko.devices.disk.logs.device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1";
|
disko.devices.disk.logs.device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1";
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "log-2";
|
|
||||||
domain = "int.infra.auro.re";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
Loading…
Reference in a new issue