first commit
This commit is contained in:
129
hosts/AZ-CLD-1/configuration.nix
Normal file
129
hosts/AZ-CLD-1/configuration.nix
Normal file
@@ -0,0 +1,129 @@
|
||||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./disko-config.nix
|
||||
];
|
||||
|
||||
boot.loader.grub = {
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
networking.hostName = "AZ-CLD-1"; # Define your hostname.
|
||||
# Pick only one of the below networking options.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "de_DE.UTF-8";
|
||||
# console = {
|
||||
# font = "Lat2-Terminus16";
|
||||
# keyMap = "us";
|
||||
# useXkbConfig = true; # use xkb.options in tty.
|
||||
# };
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
# services.xserver.enable = true;
|
||||
|
||||
# Configure keymap in X11
|
||||
# services.xserver.xkb.layout = "us";
|
||||
# services.xserver.xkb.options = "eurosign:e,caps:escape";
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
# services.printing.enable = true;
|
||||
|
||||
# Enable sound.
|
||||
# services.pulseaudio.enable = true;
|
||||
# OR
|
||||
# services.pipewire = {
|
||||
# enable = true;
|
||||
# pulse.enable = true;
|
||||
# };
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
# services.libinput.enable = true;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
# users.users.alice = {
|
||||
# isNormalUser = true;
|
||||
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
# packages = with pkgs; [
|
||||
# tree
|
||||
# ];
|
||||
# };
|
||||
|
||||
# programs.firefox.enable = true;
|
||||
|
||||
# List packages installed in system profile.
|
||||
# You can use https://search.nixos.org/ to find more packages (and options).
|
||||
environment.systemPackages = with pkgs; [
|
||||
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
git
|
||||
];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [2022];
|
||||
settings = {
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.allowedTCPPorts = [ 587 ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
# system.copySystemConfiguration = true;
|
||||
|
||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||
#
|
||||
# Most users should NEVER change this value after the initial install, for any reason,
|
||||
# even if you've upgraded your system to a new NixOS release.
|
||||
#
|
||||
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||
# to actually do that.
|
||||
#
|
||||
# This value being lower than the current NixOS release does NOT mean your system is
|
||||
# out of date, out of support, or vulnerable.
|
||||
#
|
||||
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||
# and migrated your data accordingly.
|
||||
#
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "25.05"; # Did you read the comment?
|
||||
}
|
||||
8
hosts/AZ-CLD-1/default.nix
Normal file
8
hosts/AZ-CLD-1/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
imports = [
|
||||
../common
|
||||
./configuration.nix
|
||||
./secrets.nix
|
||||
./services
|
||||
];
|
||||
}
|
||||
39
hosts/AZ-CLD-1/disko-config.nix
Normal file
39
hosts/AZ-CLD-1/disko-config.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/vda"; # CHANGE ME
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for GRUB MBR
|
||||
priority = 1;
|
||||
};
|
||||
esp = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["defaults" "umask=0077"];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = ["noatime" "nodiratime" "discard"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
hosts/AZ-CLD-1/hardware-configuration.nix
Normal file
28
hosts/AZ-CLD-1/hardware-configuration.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
26
hosts/AZ-CLD-1/secrets.nix
Normal file
26
hosts/AZ-CLD-1/secrets.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
age = {
|
||||
secrets = {
|
||||
traefik-env = {
|
||||
file = ../../secrets/traefik-env.age;
|
||||
};
|
||||
n8n-env = {
|
||||
file = ../../secrets/n8n-env.age;
|
||||
};
|
||||
outline-env = {
|
||||
file = ../../secrets/outline-env.age;
|
||||
owner = "outline";
|
||||
};
|
||||
vaultwarden-env = {
|
||||
file = ../../secrets/vaultwarden-env.age;
|
||||
};
|
||||
hetzner-s3-az-intern-secret-key = {
|
||||
file = ../../secrets/hetzner-s3-az-intern-secret-key.age;
|
||||
owner = "outline";
|
||||
};
|
||||
hetzner-s3-az-intern-access-key = {
|
||||
file = ../../secrets/hetzner-s3-az-intern-access-key.age;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
9
hosts/AZ-CLD-1/services/default.nix
Normal file
9
hosts/AZ-CLD-1/services/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
imports = [
|
||||
./gitea.nix
|
||||
./n8n.nix
|
||||
./outline.nix
|
||||
./postgres.nix
|
||||
./traefik.nix
|
||||
];
|
||||
}
|
||||
37
hosts/AZ-CLD-1/services/gitea.nix
Normal file
37
hosts/AZ-CLD-1/services/gitea.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server = {
|
||||
ROOT_URL = "https://git.az-gruppe.com";
|
||||
HTTP_PORT = 3030;
|
||||
};
|
||||
mailer.SENDMAIL_PATH = "/run/wrappers/bin/sendmail";
|
||||
service.DISABLE_REGISTRATION = true;
|
||||
};
|
||||
lfs.enable = true;
|
||||
dump = {
|
||||
enable = true;
|
||||
type = "tar.gz";
|
||||
interval = "03:30:00";
|
||||
backupDir = "/var/backup/gitea";
|
||||
};
|
||||
};
|
||||
# Traefik configuration specific to gitea
|
||||
services.traefik.dynamicConfigOptions.http = {
|
||||
services.gitea.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://localhost:3030/";
|
||||
}
|
||||
];
|
||||
|
||||
routers.gitea = {
|
||||
rule = "Host(`git.az-gruppe.com`)";
|
||||
tls = {
|
||||
certResolver = "ionos";
|
||||
};
|
||||
service = "gitea";
|
||||
entrypoints = "websecure";
|
||||
};
|
||||
};
|
||||
}
|
||||
26
hosts/AZ-CLD-1/services/n8n.nix
Normal file
26
hosts/AZ-CLD-1/services/n8n.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{config, ...}: {
|
||||
services.n8n = {
|
||||
enable = true;
|
||||
webhookUrl = "https://wf.az-group.com";
|
||||
};
|
||||
systemd.services.n8n.serviceConfig = {
|
||||
EnvironmentFile = ["${config.age.secrets.n8n-env.path}"];
|
||||
};
|
||||
# Traefik configuration specific to n8n
|
||||
services.traefik.dynamicConfigOptions.http = {
|
||||
services.n8n.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://localhost:5678/";
|
||||
}
|
||||
];
|
||||
|
||||
routers.n8n = {
|
||||
rule = "Host(`wf.az-gruppe.com`)";
|
||||
tls = {
|
||||
certResolver = "ionos";
|
||||
};
|
||||
service = "n8n";
|
||||
entrypoints = "websecure";
|
||||
};
|
||||
};
|
||||
}
|
||||
36
hosts/AZ-CLD-1/services/outline.nix
Normal file
36
hosts/AZ-CLD-1/services/outline.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{config, ...}: {
|
||||
services.outline = {
|
||||
enable = true;
|
||||
port = 3031;
|
||||
publicUrl = "https://wiki.az-gruppe.com";
|
||||
databaseUrl = "postgresql://outline:outline@127.0.0.1:5432/outline";
|
||||
storage = {
|
||||
storageType = "s3";
|
||||
region = "eu-central";
|
||||
uploadBucketUrl = "https://nbg1.your-objectstorage.com";
|
||||
uploadBucketName = "az-wiki";
|
||||
secretKeyFile = config.age.secrets.hetzner-s3-az-intern-secret-key.path;
|
||||
accessKey = "CRT7V4HR5CG9NHICD2WW";
|
||||
};
|
||||
};
|
||||
systemd.services.outline.serviceConfig = {
|
||||
EnvironmentFile = ["${config.age.secrets.outline-env.path}"];
|
||||
};
|
||||
# Traefik configuration specific to littlelink
|
||||
services.traefik.dynamicConfigOptions.http = {
|
||||
services.outline.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://localhost:3031/";
|
||||
}
|
||||
];
|
||||
|
||||
routers.outline = {
|
||||
rule = "Host(`wiki.az-gruppe.com`)";
|
||||
tls = {
|
||||
certResolver = "ionos";
|
||||
};
|
||||
service = "outline";
|
||||
entrypoints = "websecure";
|
||||
};
|
||||
};
|
||||
}
|
||||
66
hosts/AZ-CLD-1/services/postgres.nix
Normal file
66
hosts/AZ-CLD-1/services/postgres.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{pkgs, ...}: {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
enableTCPIP = true;
|
||||
package = pkgs.postgresql_17;
|
||||
settings = {
|
||||
ssl = true;
|
||||
};
|
||||
extensions = with pkgs.postgresql17Packages; [
|
||||
pgvector
|
||||
];
|
||||
initialScript = pkgs.writeText "backend-initScript" ''
|
||||
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow';
|
||||
CREATE DATABASE baserow;
|
||||
ALTER DATABASE baserow OWNER to baserow;
|
||||
|
||||
CREATE USER kestra WITH ENCRYPTED PASSWORD 'kestra';
|
||||
CREATE DATABASE kestra;
|
||||
ALTER DATABASE kestra OWNER to kestra;
|
||||
|
||||
CREATE USER n8n WITH ENCRYPTED PASSWORD 'n8n';
|
||||
CREATE DATABASE n8n;
|
||||
ALTER DATABASE n8n OWNER to n8n;
|
||||
|
||||
CREATE USER outline WITH ENCRYPTED PASSWORD 'outline';
|
||||
CREATE DATABASE outline;
|
||||
ALTER DATABASE outline OWNER to outline;
|
||||
'';
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
# Local connections (Unix socket)
|
||||
local all postgres peer
|
||||
local outline outline scram-sha-256
|
||||
local n8n n8n scram-sha-256
|
||||
|
||||
# Localhost connections (IPv4 and IPv6)
|
||||
host all postgres 127.0.0.1/32 scram-sha-256
|
||||
host all postgres ::1/128 scram-sha-256
|
||||
|
||||
host outline outline 127.0.0.1/32 scram-sha-256
|
||||
host outline outline ::1/128 scram-sha-256
|
||||
|
||||
host n8n n8n 127.0.0.1/32 scram-sha-256
|
||||
host n8n n8n ::1/128 scram-sha-256
|
||||
|
||||
# Podman network connections for Baserow
|
||||
host baserow baserow 10.89.0.0/24 scram-sha-256
|
||||
host kestra kestra 10.89.0.0/24 scram-sha-256
|
||||
|
||||
# Deny all other connections
|
||||
local all all reject
|
||||
host all all 0.0.0.0/0 reject
|
||||
host all all ::/0 reject
|
||||
'';
|
||||
};
|
||||
services.postgresqlBackup = {
|
||||
enable = true;
|
||||
startAt = "03:10:00";
|
||||
databases = ["baserow" "kestra" "n8n" "outline"];
|
||||
};
|
||||
networking.firewall = {
|
||||
extraCommands = ''
|
||||
iptables -A INPUT -p tcp -s 127.0.0.1 --dport 5432 -j ACCEPT
|
||||
iptables -A INPUT -p tcp -s 10.89.0.0/24 --dport 5432 -j ACCEPT
|
||||
'';
|
||||
};
|
||||
}
|
||||
74
hosts/AZ-CLD-1/services/traefik.nix
Normal file
74
hosts/AZ-CLD-1/services/traefik.nix
Normal file
@@ -0,0 +1,74 @@
|
||||
{config, ...}: {
|
||||
services.traefik = {
|
||||
enable = true;
|
||||
staticConfigOptions = {
|
||||
log = {level = "WARN";};
|
||||
certificatesResolvers = {
|
||||
ionos = {
|
||||
acme = {
|
||||
email = "sascha.koenig@azintec.com";
|
||||
storage = "/var/lib/traefik/acme.json";
|
||||
caserver = "https://acme-v02.api.letsencrypt.org/directory";
|
||||
dnsChallenge = {
|
||||
provider = "ionos";
|
||||
resolvers = ["1.1.1.1:53" "8.8.8.8:53"];
|
||||
propagation = {
|
||||
delayBeforeChecks = 60;
|
||||
disableChecks = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
api = {};
|
||||
entryPoints = {
|
||||
web = {
|
||||
address = ":80";
|
||||
http.redirections.entryPoint = {
|
||||
to = "websecure";
|
||||
scheme = "https";
|
||||
};
|
||||
};
|
||||
websecure = {
|
||||
address = ":443";
|
||||
};
|
||||
};
|
||||
};
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
services = {
|
||||
dummy = {
|
||||
loadBalancer.servers = [
|
||||
{url = "http://192.168.0.1";} # Diese URL wird nie verwendet
|
||||
];
|
||||
};
|
||||
};
|
||||
middlewares = {
|
||||
auth = {
|
||||
basicAuth = {
|
||||
users = ["sascha.koenig:$apr1$1xqdta2b$DIVNvvp5iTUGNccJjguKh."];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
routers = {
|
||||
api = {
|
||||
rule = "Host(`r.az-gruppe.com`)";
|
||||
service = "api@internal";
|
||||
middlewares = ["auth"];
|
||||
entrypoints = ["websecure"];
|
||||
tls = {
|
||||
certResolver = "ionos";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.traefik.serviceConfig = {
|
||||
EnvironmentFile = ["${config.age.secrets.traefik-env.path}"];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [80 443];
|
||||
}
|
||||
Reference in New Issue
Block a user