From 54771d312e5e50bbd240b8455878f3d1ad14cead Mon Sep 17 00:00:00 2001 From: BigBoss Date: Sun, 7 May 2023 12:09:49 -0400 Subject: [PATCH] clean up docker compose, genesis, localnet --- build/config/config.node1.validator.json | 3 +++ build/config/genesis.json | 15 +++++++++++++-- build/deployments/.env.example | 14 ++++++-------- build/deployments/docker-compose.yaml | 20 ++++---------------- build/localnet/cluster-manager/utils.go | 6 +++++- shared/k8s/debug.go | 1 + 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/build/config/config.node1.validator.json b/build/config/config.node1.validator.json index e6762ec93..02cd0ef38 100644 --- a/build/config/config.node1.validator.json +++ b/build/config/config.node1.validator.json @@ -50,5 +50,8 @@ "port": "50832", "timeout": 30000, "use_cors": false + }, + "servicer": { + "enabled": true } } diff --git a/build/config/genesis.json b/build/config/genesis.json index 56bae5831..bc09fa945 100755 --- a/build/config/genesis.json +++ b/build/config/genesis.json @@ -4094,11 +4094,22 @@ } ], "servicers": [ + { + "address": "00104055c00bed7c983a48aac7dc6335d7c607a7", + "public_key": "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", + "chains": ["0001"], + "service_url": "node1.consensus:42069", + "staked_amount": "1000000000000", + "paused_height": -1, + "unstaking_height": -1, + "output": "00104055c00bed7c983a48aac7dc6335d7c607a7", + "actor_type": 2 + }, { "address": "00604d18001a2012830b93efcc23100450e5a512", "public_key": "6ac62bddc541432cff818a02bab732f815ef2e6f7099e7dddc793d62d482b451", "chains": ["0001"], - "service_url": "node1.servicer:42069", + "service_url": "node5.servicer:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4111,7 +4122,7 @@ "address": "00504987d4b181c1e97b1da9af42f3db733b1ff4", "public_key": "2777a49cdfde21867a538ddcfca05002f0115b1955a75b80e965ed63fc95f809", "chains": ["0001"], - "service_url": "node1.fisherman:42069", + "service_url": "node6.fisherman:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, diff --git a/build/deployments/.env.example b/build/deployments/.env.example index 743f38a87..b20f26e43 100644 --- a/build/deployments/.env.example +++ b/build/deployments/.env.example @@ -1,31 +1,29 @@ -# docker compose stuff -# override with your own values if the default host port mappings in docker-compose do not suit you # NODE1_DEBUG_PORT=127.0.0.1:7081 -# NODE1_PORT_9081=127.0.0.1:9081 # NODE1_P2P_PORT=127.0.0.1:42070 # NODE1_RPC_PORT=127.0.0.1:50832 + # NODE2_DEBUG_PORT=127.0.0.1:7082 -# NODE2_PORT_9081=127.0.0.1:9082 # NODE2_P2P_PORT=127.0.0.1:42071 # NODE2_RPC_PORT=127.0.0.1:50833 + # NODE3_DEBUG_PORT=127.0.0.1:7083 -# NODE3_PORT_9081=127.0.0.1:9083 # NODE3_P2P_PORT=127.0.0.1:42072 # NODE3_RPC_PORT=127.0.0.1:50834 + # NODE4_DEBUG_PORT=127.0.0.1:7084 -# NODE4_PORT_9081=127.0.0.1:9084 # NODE4_P2P_PORT=127.0.0.1:42073 # NODE4_RPC_PORT=127.0.0.1:50835 + # NODE5_DEBUG_PORT:-0.0.0.0:7085 -# NODE5_PORT_9081:-0.0.0.0:9085 # NODE5_P2P_PORT:-0.0.0.0:42074 # NODE5_RPC_PORT:-0.0.0.0:50836 # NODE5_SERVICER_ENABLED=true + # NODE6_DEBUG_PORT:-0.0.0.0:7085 -# NODE6_PORT_9081:-0.0.0.0:9085 # NODE6_P2P_PORT:-0.0.0.0:42074 # NODE6_RPC_PORT:-0.0.0.0:50836 # NODE6_FISHERMAN_ENABLED=true + # GRAFANA_PORT_3000=127.0.0.1:3000 # POSTGRES_PORT_5432=127.0.0.1:5432 # LOKI_PORT_3100=127.0.0.1:3100 diff --git a/build/deployments/docker-compose.yaml b/build/deployments/docker-compose.yaml index e50fc4206..937525e0c 100755 --- a/build/deployments/docker-compose.yaml +++ b/build/deployments/docker-compose.yaml @@ -36,14 +36,12 @@ services: context: ../.. dockerfile: ./build/Dockerfile.localdev expose: - - "7080" # dlv debug - - "9080" + - "7081" # dlv debug - "9000" - "42069" - "50832" ports: - "${NODE1_DEBUG_PORT:-0.0.0.0:7081}:7081" - - "${NODE1_PORT_9081:-0.0.0.0:9081}:9080" - "${NODE1_P2P_PORT:-0.0.0.0:42070}:42069" - "${NODE1_RPC_PORT:-0.0.0.0:50832}:50832" volumes: @@ -70,12 +68,10 @@ services: expose: - "7082" # dlv debug - "42069" - - "9080" - "9000" - "50832" ports: - - "${NODE2_DEBUG_PORT:-0.0.0.0:7082}:7081" - - "${NODE2_PORT_9081:-0.0.0.0:9082}:9080" + - "${NODE2_DEBUG_PORT:-0.0.0.0:7082}:7082" - "${NODE2_P2P_PORT:-0.0.0.0:42071}:42069" - "${NODE2_RPC_PORT:-0.0.0.0:50833}:50832" volumes: @@ -98,12 +94,10 @@ services: expose: - "7083" # dlv debug - "42069" - - "9080" - "9000" - "50832" ports: - - "${NODE3_DEBUG_PORT:-0.0.0.0:7083}:7081" - - "${NODE3_PORT_9081:-0.0.0.0:9083}:9080" + - "${NODE3_DEBUG_PORT:-0.0.0.0:7083}:7083" - "${NODE3_P2P_PORT:-0.0.0.0:42072}:42069" - "${NODE3_RPC_PORT:-0.0.0.0:50834}:50832" volumes: @@ -126,12 +120,10 @@ services: expose: - "7084" # dlv debug - "42069" - - "9080" - "9000" - "50832" ports: - - "${NODE4_DEBUG_PORT:-0.0.0.0:7084}:7081" - - "${NODE4_PORT_9081:-0.0.0.0:9084}:9080" + - "${NODE4_DEBUG_PORT:-0.0.0.0:7084}:7084" - "${NODE4_P2P_PORT:-0.0.0.0:42073}:42069" - "${NODE4_RPC_PORT:-0.0.0.0:50835}:50832" volumes: @@ -163,12 +155,10 @@ services: expose: - "7085" # dlv debug - "42069" - - "9080" - "9000" - "50832" ports: - "${NODE5_DEBUG_PORT:-0.0.0.0:7085}:7085" - - "${NODE5_PORT_9081:-0.0.0.0:9085}:9080" - "${NODE5_P2P_PORT:-0.0.0.0:42074}:42069" - "${NODE5_RPC_PORT:-0.0.0.0:50836}:50832" volumes: @@ -201,12 +191,10 @@ services: expose: - "7086" # dlv debug - "42069" - - "9080" - "9000" - "50832" ports: - "${NODE6_DEBUG_PORT:-0.0.0.0:7086}:7086" - - "${NODE6_PORT_9081:-0.0.0.0:9086}:9080" - "${NODE6_P2P_PORT:-0.0.0.0:42075}:42069" - "${NODE6_RPC_PORT:-0.0.0.0:50837}:50832" volumes: diff --git a/build/localnet/cluster-manager/utils.go b/build/localnet/cluster-manager/utils.go index 0b6bb38b2..51f7595da 100644 --- a/build/localnet/cluster-manager/utils.go +++ b/build/localnet/cluster-manager/utils.go @@ -21,7 +21,11 @@ func isValidator(service *v1.Service) bool { // // it follows the pattern defined in the pocket helm chart. func extractValidatorId(validatorName string) string { - return validatorServiceNamePatternRegex.FindStringSubmatch(validatorName)[1] + match := validatorServiceNamePatternRegex.FindStringSubmatch(validatorName) + if len(match) != 2 { + logger.Fatal().Msgf("Could not extract validator id from service name: %s", validatorName) + } + return match[1] } // TODO: Create a type for `validatorKeyMap` and document what the expected key-value types contain diff --git a/shared/k8s/debug.go b/shared/k8s/debug.go index 3999da927..49241cb1b 100644 --- a/shared/k8s/debug.go +++ b/shared/k8s/debug.go @@ -47,6 +47,7 @@ func FetchValidatorPrivateKeys(clientset *kubernetes.Clientset) (map[string]stri func getNamespace() (string, error) { _, err := os.Stat(kubernetesServiceAccountNamespaceFile) if err != nil { + logger.Global.Err(err).Msg("could not stat namespace file, using \"" + defaultNamespace + "\"") return defaultNamespace, nil }