nixos-config/config/services/kubo.nix

83 lines
2.1 KiB
Nix
Raw Normal View History

2023-05-21 17:32:58 +00:00
{
pkgs,
config,
lib,
...
}: {
2023-05-30 07:36:52 +00:00
imports = [../../modules/kubo.nix ./kubo-common.nix];
2023-05-21 17:32:58 +00:00
services.kubo = {
settings = {
Addresses = {
2023-05-30 07:36:52 +00:00
API = lib.mkForce [
"/ip4/0.0.0.0/tcp/5001"
"/ip6/::/tcp/5001"
2023-05-21 17:32:58 +00:00
]; # Only exposed over the tailed scale
};
API.HTTPHeaders = {
Access-Control-Allow-Origin = [
"http://bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm.ipfs.localhost:41876"
"http://localhost:3000"
"http://127.0.0.1:5001"
"https://webui.ipfs.io"
];
Access-Control-Allow-Methods = ["PUT" "POST"];
};
Datastore = {
Spec = {
mounts = [
{
child = {
type = "storjds";
dbURI = "postgres:///kubo_storjds?sslmode=disable&host=/run/postgresql";
bucket = "ipfs";
nodeConnectionPoolCapacity = "100";
nodeConnectionPoolKeyCapacity = "5";
nodeConnectionPoolIdleExpiration = "2m";
satelliteConnectionPoolCapacity = "10";
satelliteConnectionPoolKeyCapacity = "0";
satelliteConnectionPoolIdleExpiration = "2m";
};
mountpoint = "/";
prefix = "storj.datastore";
type = "measure";
}
];
type = "mount";
};
};
};
};
sops.secrets."services/ipfs/access_grant".owner = "ipfs";
services.postgresql.ensureDatabases = [
"kubo_storjds"
];
services.postgresql.ensureUsers = [
{
name = "ipfs";
ensurePermissions = {
"DATABASE kubo_storjds" = "ALL PRIVILEGES";
};
}
];
networking.firewall.allowedTCPPorts = [
4001
4002
];
networking.firewall.allowedUDPPorts = [
4001
];
services.caddy.virtualHosts."ipfs-nocdn.chir.rs" = {
useACMEHost = "chir.rs";
logFormat = pkgs.lib.mkForce "";
extraConfig = ''
import baseConfig
reverse_proxy http://127.0.0.1:41876
'';
};
2023-06-10 08:18:18 +00:00
fileSystems."/persist/var/lib/ipfs/root" = {
device = "/";
options = ["bind" "ro"];
};
2023-05-21 17:32:58 +00:00
}