tywin: enable storj on d0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2023-06-28 22:12:56 +01:00
parent 4e2fc5cdbd
commit 4b13bd1444
3 changed files with 39 additions and 16 deletions

View File

@ -99,6 +99,8 @@
ip daddr 10.64.50.20 tcp dport 8444 counter accept comment "Chia"
ip daddr 10.64.50.20 tcp dport 28967 counter accept comment "zfs.tywin.storj"
ip daddr 10.64.50.20 udp dport 28967 counter accept comment "zfs.tywin.storj"
ip daddr 10.64.50.20 tcp dport 28968 counter accept comment "d0.tywin.storj"
ip daddr 10.64.50.20 udp dport 28968 counter accept comment "d0.tywin.storj"
}
}
@ -108,6 +110,8 @@
iifname eth0 tcp dport 8444 counter dnat to 10.64.50.20
iifname eth0 tcp dport 28967 counter dnat to 10.64.50.20
iifname eth0 udp dport 28967 counter dnat to 10.64.50.20
iifname eth0 tcp dport 28968 counter dnat to 10.64.50.20
iifname eth0 udp dport 28968 counter dnat to 10.64.50.20
}
chain postrouting {

View File

@ -90,15 +90,36 @@
email = "jake+storj@hillion.co.uk";
wallet = "0x03cebe2608945D51f0bcE6c5ef70b4948fCEcfEe";
};
custom.storj.instances.zfs = {
configDir = "/data/storj/config";
identityDir = "/data/storj/identity";
storage = "500GB";
consoleAddress = "100.115.31.91:14002";
serverPort = 28967;
externalAddress = "zfs.tywin.storj.hillion.co.uk:28967";
authorizationTokenFile = config.age.secrets."storj/zfs_auth".path;
};
networking.firewall.interfaces."tailscale0".allowedTCPPorts = [ 14002 ];
custom.storj.instances =
let
mkStorj = index: {
name = "d${toString index}";
value = {
configDir = "/mnt/d${toString index}/storj/config";
identityDir = "/mnt/d${toString index}/storj/identity";
serverPort = 28967 + 1 + index;
externalAddress = "d${toString index}.tywin.storj.hillion.co.uk:${toString (28967 + 1 + index)}";
consoleAddress = "100.115.31.91:${toString (14002 + 1 + index)}";
storage = "1000GB";
};
};
instances = builtins.genList (x: x) 1;
in
builtins.listToAttrs (builtins.map mkStorj instances) // {
zfs = {
configDir = "/data/storj/config";
identityDir = "/data/storj/identity";
storage = "500GB";
consoleAddress = "100.115.31.91:14002";
serverPort = 28967;
externalAddress = "zfs.tywin.storj.hillion.co.uk:28967";
authorizationTokenFile = config.age.secrets."storj/zfs_auth".path;
};
};
networking.firewall.interfaces."tailscale0".allowedTCPPorts = [ 14002 14003 ];
};
}

View File

@ -78,13 +78,14 @@ in
"--operator.wallet '${cfg.wallet}'"
"--console.address '${value.consoleAddress}'"
"--server.address ':${toString value.serverPort}'"
"--server.private-address ':0'"
"--storage.allocated-disk-space '${value.storage}'"
] ++ (if value.externalAddress == null then [ ] else [
"--contact.external-address '${value.externalAddress}'"
]));
in
with pkgs;
if value.authorizationTokenFile == null then "" else with pkgs; ''
(if value.authorizationTokenFile == null then "" else ''
if ! grep -c BEGIN ${value.identityDir}/ca.cert; then
rm -rf ${value.identityDir}/storagenode
${storj}/bin/identity create storagenode \
@ -96,8 +97,8 @@ in
mv ${value.identityDir}/storagenode/* ${value.identityDir}
rm -d ${value.identityDir}/storagenode
fi
'' + ''
if ! test -d ${value.configDir}/storage/blobs; then
'') + ''
if ! test -f ${value.configDir}/config.yaml; then
${storj}/bin/storagenode setup ${args}
fi
${storj}/bin/storagenode run ${args}
@ -125,6 +126,3 @@ in
};
};
}