]>
Commit | Line | Data |
---|---|---|
8415083e | 1 | { privateFiles }: |
ae485806 | 2 | { config, pkgs, myconfig, resources, ... }: |
8415083e IB |
3 | { |
4 | boot.kernelPackages = pkgs.linuxPackages_latest; | |
5 | _module.args.privateFiles = privateFiles; | |
9f202523 | 6 | _module.args.hostFQDN = "backup-2.v.immae.eu"; |
8415083e IB |
7 | imports = builtins.attrValues (import ../..); |
8 | ||
9 | deployment = { | |
10 | targetEnv = "hetznerCloud"; | |
11 | hetznerCloud = { | |
12 | authToken = myconfig.env.hetznerCloud.authToken; | |
13 | datacenter = "hel1-dc2"; | |
14 | location ="hel1"; | |
15 | serverType = "cx11"; | |
16 | }; | |
17 | }; | |
18 | ||
ae485806 IB |
19 | fileSystems = { |
20 | "/backup2" = { | |
21 | fsType = "ext4"; | |
22 | device = "UUID=b9425333-f567-435d-94d8-b26c22d93426"; | |
23 | }; | |
24 | }; | |
25 | ||
26 | networking = { | |
27 | firewall.enable = true; | |
28 | interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList | |
29 | (n: ips: { address = ips.ip4; prefixLength = 32; }) | |
30 | (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.backup-2.ips); | |
31 | interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList | |
32 | (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) | |
33 | myconfig.env.servers.backup-2.ips); | |
285380fe IB |
34 | |
35 | defaultMailServer = { | |
36 | directDelivery = true; | |
37 | hostName = "eldiron.immae.eu:25"; | |
38 | useTLS = true; | |
39 | useSTARTTLS = true; | |
40 | root = "postmaster@immae.eu"; | |
41 | }; | |
42 | }; | |
43 | ||
4227853a IB |
44 | services.cron = { |
45 | mailto = "cron@immae.eu"; | |
46 | enable = true; | |
47 | }; | |
48 | ||
285380fe IB |
49 | services.rsyncBackup = { |
50 | mountpoint = "/backup2"; | |
51 | mailto = myconfig.env.rsync_backup.mailto; | |
52 | profiles = myconfig.env.rsync_backup.profiles; | |
53 | ssh_key_public = myconfig.env.rsync_backup.ssh_key.public; | |
54 | ssh_key_private = myconfig.env.rsync_backup.ssh_key.private; | |
ae485806 IB |
55 | }; |
56 | ||
9f202523 | 57 | myServices.monitoring.enable = true; |
ec9b6564 IB |
58 | myServices.databasesReplication = { |
59 | postgresql = { | |
60 | enable = true; | |
61 | base = "/backup2"; | |
62 | hosts = { | |
63 | eldiron = { | |
64 | slot = "backup_2"; | |
65 | connection = "postgresql://backup-2:${myconfig.env.ldap.backup-2.password}@eldiron.immae.eu"; | |
66 | }; | |
67 | }; | |
68 | }; | |
9f6a7862 IB |
69 | mariadb = { |
70 | enable = true; | |
71 | base = "/backup2"; | |
72 | hosts = { | |
73 | eldiron = { | |
74 | serverId = 2; | |
75 | # mysql resolves "backup-2" host and checks the ip, but uses /etc/hosts which only contains ip4 | |
76 | host = myconfig.env.servers.eldiron.ips.main.ip4; | |
77 | port = "3306"; | |
78 | user = "backup-2"; | |
79 | password = myconfig.env.ldap.backup-2.password; | |
80 | dumpUser = "root"; | |
81 | dumpPassword = myconfig.env.databases.mysql.systemUsers.root; | |
82 | }; | |
83 | }; | |
84 | }; | |
dded6699 IB |
85 | redis = { |
86 | enable = true; | |
87 | base = "/backup2"; | |
88 | hosts = { | |
89 | eldiron = { | |
90 | host = "127.0.0.1"; | |
91 | port = "16379"; | |
92 | }; | |
93 | }; | |
94 | }; | |
16b80abd IB |
95 | openldap = { |
96 | enable = true; | |
97 | base = "/backup2"; | |
98 | hosts = { | |
99 | eldiron = { | |
100 | url = "ldaps://${myconfig.env.ldap.host}:636"; | |
101 | dn = myconfig.env.ldap.replication_dn; | |
102 | password = myconfig.env.ldap.replication_pw; | |
103 | base = myconfig.env.ldap.base; | |
104 | }; | |
105 | }; | |
106 | }; | |
ec9b6564 IB |
107 | }; |
108 | ||
8415083e IB |
109 | # This value determines the NixOS release with which your system is |
110 | # to be compatible, in order to avoid breaking some software such as | |
111 | # database servers. You should change this only after NixOS release | |
112 | # notes say you should. | |
113 | # https://nixos.org/nixos/manual/release-notes.html | |
114 | system.stateVersion = "19.03"; # Did you read the comment? | |
115 | } |