2023-08-31 01:55:45 +03:00
|
|
|
{ config, depot, lib, ... }:
|
2022-10-19 21:25:19 +03:00
|
|
|
|
|
|
|
{
|
2024-07-16 15:06:08 +03:00
|
|
|
hostLinks = lib.genAttrs config.services.ipfs.nodes.node (name: let
|
|
|
|
host = depot.hours.${name};
|
2022-11-14 01:01:09 +02:00
|
|
|
intf = host.interfaces.primary;
|
|
|
|
self = config.hostLinks.${name}.ipfs;
|
|
|
|
in {
|
|
|
|
ipfs = {
|
|
|
|
ipv4 = if intf ? addrPublic then intf.addrPublic else intf.addr;
|
|
|
|
port = 4001;
|
|
|
|
extra = {
|
|
|
|
peerId = {
|
|
|
|
VEGAS = "Qmd7QHZU8UjfYdwmjmq1SBh9pvER9AwHpfwQvnvNo3HBBo";
|
|
|
|
prophet = "12D3KooWQWsHPUUeFhe4b6pyCaD1hBoj8j6Z7S7kTznRTh1p1eVt";
|
|
|
|
}.${name};
|
2022-11-14 01:49:38 +02:00
|
|
|
multiaddrs = [
|
2023-10-27 20:22:39 +03:00
|
|
|
"/ip4/${self.ipv4}/udp/${self.portStr}/quic-v1"
|
2022-11-14 01:49:38 +02:00
|
|
|
"/ip4/${self.ipv4}/tcp/${self.portStr}"
|
|
|
|
];
|
2022-11-14 01:01:09 +02:00
|
|
|
};
|
|
|
|
};
|
2024-07-16 15:06:08 +03:00
|
|
|
});
|
2022-10-19 21:25:19 +03:00
|
|
|
services.ipfs = {
|
|
|
|
nodes = {
|
|
|
|
node = [ "VEGAS" "prophet" ];
|
2022-10-20 01:08:12 +03:00
|
|
|
clusterPeer = [ "VEGAS" "prophet" ];
|
2023-06-02 19:06:34 +03:00
|
|
|
gateway = [ "VEGAS" "prophet" ];
|
2023-06-02 18:51:00 +03:00
|
|
|
io-tweaks = [ "VEGAS" ];
|
2023-06-02 19:06:34 +03:00
|
|
|
remote-api = [ "VEGAS" ];
|
2022-10-19 21:25:19 +03:00
|
|
|
};
|
2024-07-04 19:30:38 +03:00
|
|
|
meshLinks.gateway = {
|
|
|
|
name = "ipfsGateway";
|
|
|
|
link.protocol = "http";
|
|
|
|
};
|
2022-10-19 21:25:19 +03:00
|
|
|
nixos = {
|
|
|
|
node = [
|
|
|
|
./node.nix
|
|
|
|
];
|
|
|
|
gateway = [
|
|
|
|
./gateway.nix
|
|
|
|
./monitoring.nix
|
|
|
|
];
|
2022-10-20 01:08:12 +03:00
|
|
|
clusterPeer = [
|
|
|
|
./cluster.nix
|
|
|
|
];
|
2023-06-02 18:51:00 +03:00
|
|
|
io-tweaks = ./io-tweaks.nix;
|
2023-06-02 19:06:34 +03:00
|
|
|
remote-api = ./remote-api.nix;
|
2022-10-19 21:25:19 +03:00
|
|
|
};
|
2024-07-08 20:08:51 +03:00
|
|
|
secrets = let
|
|
|
|
inherit (config.services.ipfs) nodes;
|
|
|
|
in {
|
|
|
|
clusterSecret = {
|
|
|
|
nodes = nodes.clusterPeer;
|
|
|
|
};
|
|
|
|
pinningServiceCredentials = {
|
|
|
|
nodes = nodes.clusterPeer;
|
|
|
|
owner = "ipfs";
|
|
|
|
};
|
|
|
|
};
|
2022-10-19 21:25:19 +03:00
|
|
|
};
|
2023-06-05 23:34:20 +03:00
|
|
|
|
|
|
|
monitoring.blackbox.targets.ipfs-gateway = {
|
2023-08-31 01:55:45 +03:00
|
|
|
address = "https://bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354.ipfs.${depot.lib.meta.domain}/";
|
2023-06-05 23:34:20 +03:00
|
|
|
module = "https2xx";
|
|
|
|
};
|
2023-11-03 00:43:58 +02:00
|
|
|
|
|
|
|
dns.records = {
|
2023-12-04 01:01:33 +02:00
|
|
|
"ipfs.admin".target = map
|
|
|
|
(node: depot.hours.${node}.interfaces.primary.addrPublic)
|
|
|
|
config.services.ipfs.nodes.remote-api;
|
2024-07-04 19:30:38 +03:00
|
|
|
pin.consulService = "ipfs-gateway";
|
|
|
|
};
|
|
|
|
|
|
|
|
ways = {
|
|
|
|
p2p = {
|
|
|
|
consulService = "ipfs-gateway";
|
2024-07-04 23:15:30 +03:00
|
|
|
extras.locations."/" = {
|
2024-07-04 19:30:38 +03:00
|
|
|
extraConfig = ''
|
|
|
|
add_header X-Content-Type-Options "";
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ipfs = {
|
2023-11-03 00:56:38 +02:00
|
|
|
consulService = "ipfs-gateway";
|
2024-07-04 19:30:38 +03:00
|
|
|
wildcard = true;
|
|
|
|
extras.extraConfig = ''
|
|
|
|
add_header X-Content-Type-Options "";
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
'';
|
2023-11-03 00:56:38 +02:00
|
|
|
};
|
2024-07-04 19:30:38 +03:00
|
|
|
ipns = {
|
2023-11-03 00:56:38 +02:00
|
|
|
consulService = "ipfs-gateway";
|
2024-07-04 19:30:38 +03:00
|
|
|
wildcard = true;
|
|
|
|
extras.extraConfig = ''
|
|
|
|
add_header X-Content-Type-Options "";
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
'';
|
2023-11-03 00:56:38 +02:00
|
|
|
};
|
2023-11-03 00:43:58 +02:00
|
|
|
};
|
2022-10-19 21:25:19 +03:00
|
|
|
}
|