From 35632d6646be30881e8b12bc9a5a500a4a6c10e4 Mon Sep 17 00:00:00 2001 From: Gytis Ivaskevicius Date: Thu, 5 Sep 2024 13:48:47 +0300 Subject: [PATCH 1/2] chore: update sanchonet deployments --- nix/cardano-services/deployments/default.nix | 50 +++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/nix/cardano-services/deployments/default.nix b/nix/cardano-services/deployments/default.nix index 2f7f2a63f47..9e4d8e59f09 100644 --- a/nix/cardano-services/deployments/default.nix +++ b/nix/cardano-services/deployments/default.nix @@ -252,32 +252,27 @@ in providers = { backend = { enabled = true; - env.USE_SUBMIT_API = "false"; }; stake-pool-provider = { enabled = true; env.OVERRIDE_FUZZY_OPTIONS = "true"; }; - handle-provider.enabled = true; - #asset-provider.enabled = true; - chain-history-provider.enabled = true; + chain-history-provider = { + enabled = true; + }; }; projectors = { - handle.enabled = true; - stake-pool.enabled = true; asset.enabled = true; + stake-pool = { + enabled = true; + }; }; values = { - useAccelerator = false; - ws-server.enabled = true; stakepool.databaseName = "stakepoolv2"; - backend.allowedOrigins = lib.concatStringsSep "," allowedOriginsDev; - - pg-boss-worker.enabled = true; - blockfrost-worker.enabled = false; + pg-boss-worker.enabled = true; cardano-services = { ingresOrder = 98; }; @@ -842,24 +837,29 @@ in providers = { backend = { enabled = true; - env.USE_SUBMIT_API = "false"; env.NODE_ENV = "production"; }; - stake-pool-provider.enabled = true; + stake-pool-provider = { + enabled = true; + env.OVERRIDE_FUZZY_OPTIONS = "true"; + env.NODE_ENV = "production"; + }; + chain-history-provider = { + enabled = true; + env.NODE_ENV = "production"; + }; }; projectors = { stake-pool = { enabled = true; - env.PROJECTION_NAMES = lib.mkForce "stake-pool,stake-pool-metadata-job,stake-pool-metrics-job"; + env.NODE_ENV = "production"; }; }; values = { blockfrost-worker.enabled = false; pg-boss-worker.enabled = true; - pg-boss-worker.queues = "pool-metadata,pool-metrics"; - cardano-services = { ingresOrder = 99; }; @@ -876,31 +876,35 @@ in providers = { backend = { enabled = true; - env.USE_SUBMIT_API = "false"; env.NODE_ENV = "production"; }; - stake-pool-provider.enabled = true; + stake-pool-provider = { + enabled = true; + env.OVERRIDE_FUZZY_OPTIONS = "true"; + env.NODE_ENV = "production"; + }; + chain-history-provider = { + enabled = true; + env.NODE_ENV = "production"; + }; }; projectors = { stake-pool = { enabled = true; - env.PROJECTION_NAMES = lib.mkForce "stake-pool,stake-pool-metadata-job,stake-pool-metrics-job"; + env.NODE_ENV = "production"; }; }; values = { blockfrost-worker.enabled = false; pg-boss-worker.enabled = true; - pg-boss-worker.queues = "pool-metadata,pool-metrics"; - cardano-services = { ingresOrder = 99; }; }; }; - } # Convenient for cases when you need to create multiple temporary deployments with the same configuration // (builtins.mapAttrs (_: value: (final: From 21e71620e07d745d6558e3c610bdfe3aed802ad8 Mon Sep 17 00:00:00 2001 From: Gytis Ivaskevicius Date: Thu, 5 Sep 2024 16:31:25 +0300 Subject: [PATCH 2/2] refactor: cleanup NODE_ENV and OVERRIDE_FUZZY_OPTIONS --- nix/cardano-services/deployments/asset.nix | 1 + .../deployments/backend.provider.nix | 1 + .../blockfrost-worker-deployment.nix | 1 + .../deployments/chain-history.nix | 1 + nix/cardano-services/deployments/default.nix | 51 ++----------------- nix/cardano-services/deployments/handle.nix | 2 + .../deployments/pg-boss-worker-deployment.nix | 1 + .../deployments/stake-pool.nix | 2 + 8 files changed, 13 insertions(+), 47 deletions(-) diff --git a/nix/cardano-services/deployments/asset.nix b/nix/cardano-services/deployments/asset.nix index e37aec5ddf2..15cf4567449 100644 --- a/nix/cardano-services/deployments/asset.nix +++ b/nix/cardano-services/deployments/asset.nix @@ -31,6 +31,7 @@ SERVICE_NAMES = "asset"; TOKEN_METADATA_SERVER_URL = values.cardano-services.tokenMetadataServerUrl; USE_TYPEORM_ASSET_PROVIDER = "true"; + NODE_ENV = values.cardano-services.nodeEnv; POSTGRES_POOL_MAX_ASSET = "500"; POSTGRES_HOST_ASSET = values.postgresName; diff --git a/nix/cardano-services/deployments/backend.provider.nix b/nix/cardano-services/deployments/backend.provider.nix index d06f7f5fa6c..dccbf125e59 100644 --- a/nix/cardano-services/deployments/backend.provider.nix +++ b/nix/cardano-services/deployments/backend.provider.nix @@ -32,6 +32,7 @@ USE_KORA_LABS = "true"; DISABLE_STAKE_POOL_METRIC_APY = "true"; PAGINATION_PAGE_SIZE_LIMIT = "5500"; + NODE_ENV = values.cardano-services.nodeEnv; HANDLE_PROVIDER_SERVER_URL = if config.network == "mainnet" diff --git a/nix/cardano-services/deployments/blockfrost-worker-deployment.nix b/nix/cardano-services/deployments/blockfrost-worker-deployment.nix index aa4eec03fe1..41c19a1fe9b 100644 --- a/nix/cardano-services/deployments/blockfrost-worker-deployment.nix +++ b/nix/cardano-services/deployments/blockfrost-worker-deployment.nix @@ -49,6 +49,7 @@ env = utils.mkPodEnv { NETWORK = config.network; LOGGER_MIN_SEVERITY = values.cardano-services.loggingLevel; + NODE_ENV = values.cardano-services.nodeEnv; BLOCKFROST_API_KEY = { valueFrom.secretKeyRef = { diff --git a/nix/cardano-services/deployments/chain-history.nix b/nix/cardano-services/deployments/chain-history.nix index 9f4a3119707..686467f6be8 100644 --- a/nix/cardano-services/deployments/chain-history.nix +++ b/nix/cardano-services/deployments/chain-history.nix @@ -32,6 +32,7 @@ USE_KORA_LABS = "true"; DISABLE_STAKE_POOL_METRIC_APY = "true"; PAGINATION_PAGE_SIZE_LIMIT = "5500"; + NODE_ENV = values.cardano-services.nodeEnv; ALLOWED_ORIGINS = values.backend.allowedOrigins; diff --git a/nix/cardano-services/deployments/default.nix b/nix/cardano-services/deployments/default.nix index 9e4d8e59f09..0aaeea90669 100644 --- a/nix/cardano-services/deployments/default.nix +++ b/nix/cardano-services/deployments/default.nix @@ -66,6 +66,7 @@ in stake-pool-provider = { resources.limits = mkPodResources "300Mi" "500m"; resources.requests = mkPodResources "150Mi" "100m"; + env.OVERRIDE_FUZZY_OPTIONS = builtins.toJSON (!(lib.hasPrefix "live" final.namespace)); }; handle-provider = { @@ -108,6 +109,9 @@ in stakepool.databaseName = "stakepool"; ingress.enabled = true; cardano-services = { + nodeEnv = if lib.hasPrefix "live" final.namespace + then "production" + else null; image = oci.image.name; buildInfo = oci.meta.buildInfo; versions = oci.meta.versions; @@ -204,7 +208,6 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; handle-provider.enabled = true; #asset-provider.enabled = true; @@ -255,7 +258,6 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; chain-history-provider = { enabled = true; @@ -292,14 +294,12 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; handle-provider.enabled = true; #asset-provider.enabled = true; chain-history-provider = { enabled = true; replicas = 2; - env.NODE_ENV = "production"; }; }; @@ -346,7 +346,6 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; handle-provider.enabled = true; #asset-provider.enabled = true; @@ -387,7 +386,6 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; handle-provider.enabled = true; asset-provider.enabled = true; @@ -424,22 +422,17 @@ in backend = { enabled = true; replicas = 2; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider.enabled = true; chain-history-provider = { enabled = true; replicas = 2; - env.NODE_ENV = "production"; }; # asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; # }; }; @@ -484,22 +477,17 @@ in backend = { enabled = true; replicas = 2; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider.enabled = true; chain-history-provider = { enabled = true; replicas = 2; - env.NODE_ENV = "production"; }; #asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; #}; }; @@ -542,21 +530,16 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider = { enabled = true; - env.NODE_ENV = "production"; }; chain-history-provider.enabled = true; #asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; #}; }; @@ -588,21 +571,16 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider = { enabled = true; - env.NODE_ENV = "production"; }; chain-history-provider.enabled = true; #asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; #}; }; @@ -634,21 +612,16 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider = { enabled = true; - env.NODE_ENV = "production"; }; chain-history-provider.enabled = true; #asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; #}; }; @@ -680,21 +653,16 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; handle-provider = { enabled = true; - env.NODE_ENV = "production"; }; chain-history-provider.enabled = true; #asset-provider = { # enabled = true; - # env.NODE_ENV = "production"; #}; }; @@ -771,7 +739,6 @@ in }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; }; }; @@ -837,23 +804,18 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; chain-history-provider = { enabled = true; - env.NODE_ENV = "production"; }; }; projectors = { stake-pool = { enabled = true; - env.NODE_ENV = "production"; }; }; @@ -876,23 +838,18 @@ in providers = { backend = { enabled = true; - env.NODE_ENV = "production"; }; stake-pool-provider = { enabled = true; - env.OVERRIDE_FUZZY_OPTIONS = "true"; - env.NODE_ENV = "production"; }; chain-history-provider = { enabled = true; - env.NODE_ENV = "production"; }; }; projectors = { stake-pool = { enabled = true; - env.NODE_ENV = "production"; }; }; diff --git a/nix/cardano-services/deployments/handle.nix b/nix/cardano-services/deployments/handle.nix index da526d1b415..f1cb93d18b4 100644 --- a/nix/cardano-services/deployments/handle.nix +++ b/nix/cardano-services/deployments/handle.nix @@ -27,6 +27,7 @@ NETWORK = config.network; OGMIOS_SRV_SERVICE_NAME = values.backend.ogmiosSrvServiceName; SERVICE_NAMES = "handle"; + NODE_ENV = values.cardano-services.nodeEnv; ALLOWED_ORIGINS = values.backend.allowedOrigins; @@ -70,6 +71,7 @@ OGMIOS_SRV_SERVICE_NAME = values.backend.ogmiosSrvServiceName; PROJECTION_NAMES = "handle"; HANDLE_POLICY_IDS = "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"; + NODE_ENV = values.cardano-services.nodeEnv; POSTGRES_POOL_MAX = "2"; POSTGRES_HOST = values.postgresName; diff --git a/nix/cardano-services/deployments/pg-boss-worker-deployment.nix b/nix/cardano-services/deployments/pg-boss-worker-deployment.nix index cd835cedba2..b575a149ae3 100644 --- a/nix/cardano-services/deployments/pg-boss-worker-deployment.nix +++ b/nix/cardano-services/deployments/pg-boss-worker-deployment.nix @@ -57,6 +57,7 @@ NETWORK = config.network; LOGGER_MIN_SEVERITY = values.cardano-services.loggingLevel; QUEUES = values.pg-boss-worker.queues; + NODE_ENV = values.cardano-services.nodeEnv; METADATA_FETCH_MODE = values.pg-boss-worker.metadata-fetch-mode; diff --git a/nix/cardano-services/deployments/stake-pool.nix b/nix/cardano-services/deployments/stake-pool.nix index 0f3e5013fbd..249ad9a70c6 100644 --- a/nix/cardano-services/deployments/stake-pool.nix +++ b/nix/cardano-services/deployments/stake-pool.nix @@ -30,6 +30,7 @@ SERVICE_NAMES = "stake-pool"; USE_TYPEORM_STAKE_POOL_PROVIDER = "true"; TOKEN_METADATA_SERVER_URL = values.cardano-services.tokenMetadataServerUrl; + NODE_ENV = values.cardano-services.nodeEnv; ALLOWED_ORIGINS = values.backend.allowedOrigins; @@ -72,6 +73,7 @@ LOGGER_MIN_SEVERITY = values.cardano-services.loggingLevel; OGMIOS_SRV_SERVICE_NAME = values.backend.ogmiosSrvServiceName; PROJECTION_NAMES = "stake-pool,stake-pool-metadata-job,stake-pool-metrics-job,stake-pool-rewards-job"; + NODE_ENV = values.cardano-services.nodeEnv; POSTGRES_POOL_MAX = "2"; POSTGRES_HOST = values.postgresName;