Skip to content

Commit e9da018

Browse files
authored
Merge pull request #1324 from input-output-hk/deploy_local_network
Deploy local network
2 parents e66686a + 1a8a067 commit e9da018

File tree

6 files changed

+110
-21
lines changed

6 files changed

+110
-21
lines changed

nix/cardano-services/deployments/backend.provider.nix

+2
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,7 @@
7979
POSTGRES_SSL_HANDLE = "true";
8080
POSTGRES_SSL_CA_FILE_HANDLE = "/tls/ca.crt";
8181
};
82+
volumeMounts."s3-config-mount".mountPath = "/config";
83+
volumes."s3-config-mount".persistentVolumeClaim.claimName = "${config.namespace}-local-conifig-s3-pvc";
8284
};
8385
}

nix/cardano-services/deployments/default.nix

+75-4
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ in
193193
env.OVERRIDE_FUZZY_OPTIONS = "true";
194194
};
195195
handle-provider.enabled = true;
196-
# asset-provider.enabled = true;
196+
# asset-provider.enabled = true;
197197
};
198198

199199
projectors = {
@@ -337,13 +337,13 @@ in
337337
env.OVERRIDE_FUZZY_OPTIONS = "true";
338338
};
339339
handle-provider.enabled = true;
340-
# asset-provider.enabled = true;
340+
# asset-provider.enabled = true;
341341
};
342342

343343
projectors = {
344344
handle.enabled = true;
345345
stake-pool.enabled = true;
346-
# asset.enabled = true;
346+
# asset.enabled = true;
347347
};
348348

349349
values = {
@@ -384,7 +384,7 @@ in
384384
env.OVERRIDE_FUZZY_OPTIONS = "true";
385385
};
386386
handle-provider.enabled = true;
387-
# asset-provider.enabled = true;
387+
# asset-provider.enabled = true;
388388
};
389389

390390
projectors = {
@@ -941,6 +941,77 @@ in
941941
};
942942
};
943943

944+
"local-network@us-east-1@v1" = final: {
945+
namespace = "local-network";
946+
name = "${final.namespace}-cardanojs-v1";
947+
network = "local";
948+
region = "us-east-1";
949+
950+
providers = {
951+
backend = {
952+
enabled = true;
953+
env.USE_SUBMIT_API = "true";
954+
env.USE_BLOCKFROST = lib.mkForce "false";
955+
env.SUBMIT_API_URL = "http://${final.namespace}-cardano-core.${final.namespace}.svc.cluster.local:8090";
956+
};
957+
stake-pool-provider = {
958+
enabled = true;
959+
env.OVERRIDE_FUZZY_OPTIONS = "true";
960+
};
961+
};
962+
963+
projectors = {
964+
stake-pool.enabled = true;
965+
};
966+
967+
values = {
968+
blockfrost-worker.enabled = false;
969+
pg-boss-worker.enabled = true;
970+
971+
backend.allowedOrigins = lib.concatStringsSep "," allowedOriginsDev;
972+
backend.routes = let
973+
inherit (oci.meta) versions;
974+
in
975+
lib.concatLists [
976+
(map (v: "/v${v}/health") versions.root)
977+
(map (v: "/v${v}/live") versions.root)
978+
(map (v: "/v${v}/meta") versions.root)
979+
(map (v: "/v${v}/ready") versions.root)
980+
(map (v: "/v${v}/asset") versions.assetInfo)
981+
(map (v: "/v${v}/chain-history") versions.chainHistory)
982+
(map (v: "/v${v}/network-info") versions.networkInfo)
983+
(map (v: "/v${v}/rewards") versions.rewards)
984+
(map (v: "/v${v}/tx-submit") versions.txSubmit)
985+
(map (v: "/v${v}/utxo") versions.utxo)
986+
(map (v: "/v${v}/handle") versions.handle)
987+
(map (v: "/v${v}/provider-server") versions.stakePool)
988+
(map (v: "/v${v}/stake-pool-provider-server") versions.stakePool)
989+
];
990+
991+
cardano-services = {
992+
ingresOrder = 99;
993+
additionalRoutes = [
994+
{
995+
pathType = "Prefix";
996+
path = "/v1.0.0/stake-pool";
997+
backend.service = {
998+
name = "${final.namespace}-cardanojs-v1-stake-pool-provider";
999+
port.name = "http";
1000+
};
1001+
}
1002+
{
1003+
pathType = "Prefix";
1004+
path = "/v3.0.0/chain-history";
1005+
backend.service = {
1006+
name = "${final.namespace}-cardanojs-v1-backend";
1007+
port.name = "http";
1008+
};
1009+
}
1010+
];
1011+
};
1012+
};
1013+
};
1014+
9441015
"live-sanchonet@us-east-2@v1" = final: {
9451016
namespace = "live-sanchonet";
9461017
name = "${final.namespace}-cardanojs-v1";

nix/cardano-services/deployments/options.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ in {
88
};
99

1010
network = lib.mkOption {
11-
type = types.enum ["mainnet" "preprod" "preview" "sanchonet"];
11+
type = types.enum ["mainnet" "preprod" "preview" "sanchonet" "local"];
1212
description = "Network of the deployment";
1313
};
1414
};

nix/cardano-services/deployments/provider.resource.nix

+26-12
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ in {
4747
args = mkOption {
4848
type = types.listOf types.str;
4949
};
50+
51+
volumeMounts = mkOption {
52+
type = types.attrsOf types.attrs;
53+
default = {};
54+
};
55+
56+
volumes = mkOption {
57+
type = types.attrsOf types.attrs;
58+
default = {};
59+
};
5060
};
5161
});
5262

@@ -133,20 +143,24 @@ in {
133143
};
134144
env = utils.mkPodEnv value.env;
135145

136-
volumeMounts = [
137-
{
138-
mountPath = "/tls";
139-
name = "tls";
140-
}
141-
];
142-
}
143-
];
144-
volumes = [
145-
{
146-
name = "tls";
147-
secret.secretName = "postgresql-server-cert";
146+
volumeMounts =
147+
[
148+
{
149+
mountPath = "/tls";
150+
name = "tls";
151+
}
152+
]
153+
++ (lib.mapAttrsToList (name: v: v // {inherit name;}) value.volumeMounts);
148154
}
149155
];
156+
volumes =
157+
[
158+
{
159+
name = "tls";
160+
secret.secretName = "postgresql-server-cert";
161+
}
162+
]
163+
++ (lib.mapAttrsToList (name: v: v // {inherit name;}) value.volumes);
150164
};
151165
};
152166
};

nix/cardano-services/operables.nix

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ in {
1616
export API_URL=''${API_URL:-http://0.0.0.0:3000}
1717
export CLI="${runCardanoServices package}/dist/cjs/cli.js"
1818
export CARDANO_NODE_CONFIGS_DIR="${cardanoServicesPath package}/config/network"
19-
2019
if [ -n "$NETWORK" ]; then
21-
export CARDANO_NODE_CONFIG_PATH="$CARDANO_NODE_CONFIGS_DIR/''${NETWORK}/cardano-node/config.json"
20+
if [ "$NETWORK" = "local" ]; then
21+
export CARDANO_NODE_CONFIG_PATH="/config/network/cardano-node/config.json"
22+
else
23+
export CARDANO_NODE_CONFIG_PATH="$CARDANO_NODE_CONFIGS_DIR/''${NETWORK}/cardano-node/config.json"
24+
fi
2225
fi
23-
2426
exec $CLI "$@"
2527
'';
2628
meta.description = "A transparent (thin) wrapper around the Cardano Services CLI";

nix/cardano-services/packages.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ in {
5656
buildInputs = oldAttrs.buildInputs ++ [nixpkgs.pkg-config nixpkgs.libusb1];
5757
# run actual build
5858
buildPhase = ''
59-
yarn workspace @cardano-sdk/cardano-services run build
59+
yarn build:cjs
6060
'';
6161
# override installPhase to only install what's necessary
6262
installPhase = ''

0 commit comments

Comments
 (0)