Pega88 / chainlink-gcp

Hosting a Chainlink node on Kubernetes using Terraform
27 stars 10 forks source link

Eth Node inaccessible #5

Open blackramit opened 3 years ago

blackramit commented 3 years ago

For those who come along, I ran into this issue after firing up the GKE environment and noticing my Pods were going through CrashLoopBackOff. I was getting a 502 from the targeted Eth Node in chainlink-node.tf

devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ kubectl logs pod/chainlink-75dd5b6bdf-8b7zc --tail 15
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations"  WHERE (id = $1) gormigrate.v1@v1.6.0/gormigrate.go:389 rows_affected=0 time=0.002688183
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations"  WHERE (id = $1) gormigrate.v1@v1.6.0/gormigrate.go:389 rows_affected=0 time=0.0018155
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations"  WHERE (id = $1) gormigrate.v1@v1.6.0/gormigrate.go:389 rows_affected=0 time=0.000888291
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations"  WHERE (id = $1) gormigrate.v1@v1.6.0/gormigrate.go:389 rows_affected=0 time=0.000422136
2021-09-03T18:35:03Z [DEBUG] SELECT count(*) FROM "migrations"  WHERE (id = $1) gormigrate.v1@v1.6.0/gormigrate.go:389 rows_affected=0 time=0.000611819
2021-09-03T18:35:03Z [DEBUG] P2P_PEER_ID was not set, using the first available key chainlink/application.go:255     peerID=p2p_12D3KooWLpuf9HMEni3HUn45EA1YQLxMbFLPN8jQ2SNCpiYXLoKz
2021-09-03T18:35:03Z [DEBUG] Off-chain reporting disabled                       chainlink/application.go:186
2021-09-03T18:35:03Z [WARN]  /chainlink/.password has overly permissive file permissions, reducing them from -rw-r--r-- to -rw------- cmd/local_client.go:168
2021-09-03T18:35:03Z [WARN]  open /chainlink/.password: read-only file system   cmd/local_client.go:60
2021-09-03T18:35:04Z [INFO]  Unlocked account 0x9f08E5d2130714dd0dE0944a9C9deF7EFe77E638 store/key_store.go:76            address=0x9f08E5d2130714dd0dE0944a9C9deF7EFe77E638
2021-09-03T18:35:05Z [DEBUG] Unlocked P2P key                                   offchainreporting/keystore.go:56 peerID=p2p_12D3KooWLpuf9HMEni3HUn45EA1YQLxMbFLPN8jQ2SNCpiYXLoKz
2021-09-03T18:35:06Z [DEBUG] Unlocked OCR key                                   offchainreporting/keystore.go:63
2021-09-03T18:35:06Z [INFO]  API exposed for user blackramit@bitvirtual.net     cmd/local_client.go:98
2021-09-03T18:35:06Z [DEBUG] eth.Client#Dial(...)                               eth/client.go:127
error starting app: websocket: bad handshake (HTTP status 502 Bad Gateway)

Validated with wscat:

devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ wscat -c wss://ropsten-rpc.linkpool.io/ws
error: Unexpected server response: 502

Setup my own Eth Node on Infura and validated it connects properly:

> devadmin@ThunderCloud:/mnt/e/Development/chainlink-gcp$ wscat -c wss://ropsten.infura.io/ws/v3/a13a37a22d784e39926def7c35e9e415
Connected (press CTRL+C to quit)

Then I modified the chainlink-node.tf with my changes;

resource "kubernetes_config_map" "chainlink-env" {
  metadata {
    name      = "chainlink-env"
    namespace = "chainlink"
  }

  resource "kubernetes_config_map" "chainlink-env" {
  metadata {
    name      = "chainlink-env"
    namespace = "chainlink"
  }

  data = {
    #"env" = file("config/.env")
    ROOT = "/chainlink"
    LOG_LEVEL = "debug"
    ETH_CHAIN_ID = 3
    MIN_OUTGOING_CONFIRMATIONS = 2
    LINK_CONTRACT_ADDRESS = "0x20fe562d797a42dcb3399062ae9546cd06f63280"
    CHAINLINK_TLS_PORT = 0
    SECURE_COOKIES = false
    GAS_UPDATER_ENABLED = true
    ALLOW_ORIGINS = "*"
    DATABASE_URL = format("postgresql://%s:%s@postgres:5432/chainlink?sslmode=disable",var.postgres_username,random_password.postgres-password.result)
    DATABASE_TIMEOUT = 0
    ETH_URL = "wss://ropsten.infura.io/ws/v3/a13a37a22d784e39926def7c35e9e415"
  }
}
Pega88 commented 3 years ago

should indeed not be hardcoded. might be good to move this into the tfvars if you feel like making a PR?