forked from cardano-scaling/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhydraw.nix
100 lines (93 loc) · 2.96 KB
/
hydraw.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Hydraw running on hydra running on cardano
{ config, pkgs, lib, ... }:
let
cardano-node = import
(pkgs.fetchgit {
url = "https://github.com/input-output-hk/cardano-node";
rev = "1.35.4";
sha256 = "1j01m2cp2vdcl26zx9xmipr551v3b2rz9kfn9ik8byfwj1z7652r";
})
{ };
in
{
# Add iohk substituters
nix.settings.substituters = [
"https://cache.nixos.org"
"https://cache.iog.io"
];
nix.settings.trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
# Using entrypoint from: https://github.com/input-output-hk/cardano-world/blob/master/nix/cardano/entrypoints.nix
virtualisation.oci-containers.containers.cardano-node = {
image = "inputoutput/cardano-node:1.35.3-new";
volumes = [
"/data/cardano-node:/data"
];
environment = {
DATA_DIR = "/data";
ENVIRONMENT = "preview";
SOCKET_PATH = "/data/node.socket";
};
};
# The 1.35.3-new cardano-node image does not contain a cli, so let's add it
# using nix instead.
environment.systemPackages = [ cardano-node.cardano-cli ];
# Our hydra-node instance
virtualisation.oci-containers.containers.hydra-node =
# NOTE: These are for the "preview" network
let
hydraScriptsTxId = "bde2ca1f404200e78202ec37979174df9941e96fd35c05b3680d79465853a246";
networkMagic = "2";
in
{
image = "ghcr.io/input-output-hk/hydra-node:0.8.1";
volumes = [
"/data/cardano-node:/cardano-node:ro"
"/data/hydra-node:/data:ro"
];
ports = [
"4001:4001"
"5001:5001"
];
cmd = builtins.concatLists [
[ "--node-id" "314" ]
[ "--api-host" "0.0.0.0" ]
[ "--host" "0.0.0.0" ]
[ "--monitoring-port" "6001" ]
[ "--hydra-scripts-tx-id" hydraScriptsTxId ]
[ "--hydra-signing-key" "/data/credentials/sebastian.hydra.sk" ]
[ "--cardano-signing-key" "/data/credentials/sebastian.cardano.sk" ]
[ "--ledger-protocol-parameters" "/data/protocol-parameters.json" ]
[ "--testnet-magic" networkMagic ]
[ "--node-socket" "/cardano-node/node.socket" ]
];
};
# The hydraw application / bridge
virtualisation.oci-containers.containers.hydraw = {
image = "ghcr.io/cardano-scaling/hydraw:latest";
volumes = [
"/data/hydra-node/credentials:/credentials:ro"
];
entrypoint = "hydraw";
environment = {
HYDRAW_CARDANO_SIGNING_KEY = "/credentials/sebastian.cardano.sk";
HYDRA_API_HOST = "localhost:4001";
};
extraOptions = [ "--network=host" ];
};
# Configure the reverse proxy to point at it
services.nginx.virtualHosts."hydraw.fk.ncoding.at" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:1337";
proxyWebsockets = true;
extraConfig = ''
proxy_buffering off;
client_max_body_size 500M;
'';
};
};
}