aws-ia / cfn-ps-chainlinklabs-chainlink-node

Apache License 2.0
0 stars 1 forks source link

The chainlink image of version 1.13.0 or higher does not work. #11

Open YutaOkoshi opened 9 months ago

YutaOkoshi commented 9 months ago

Various information was passed to chainlink in .password, but this method is not supported in the latest Chainlink images.

https://docs.chain.link/chainlink-nodes/configuring-nodes

All scripts for starting EC2 instances need to be replaced. Or it would be less man-hours to make the Chainlink image work on Fargate.

YutaOkoshi commented 9 months ago

And, Environment variables have also changed considerably. https://github.com/smartcontractkit/chainlink/blame/develop/core/config/env/env.go

config validation failed: invalid environment: 11 errors:        - environment variable DATABASE_URL must not be set: unsupported with config v2
        - environment variable ROOT must not be set: unsupported with config v2
        - environment variable DATABASE_LOCKING_MODE must not be set: unsupported with config v2
        - environment variable JSON_CONSOLE must not be set: unsupported with config v2
        - environment variable LOG_LEVEL must not be set: unsupported with config v2
        - environment variable ALLOW_ORIGINS must not be set: unsupported with config v2
        - environment variable SECURE_COOKIES must not be set: unsupported with config v2
        - environment variable CHAINLINK_TLS_PORT must not be set: unsupported with config v2
        - environment variable ETH_URL must not be set: unsupported with config v2
        - environment variable ETH_CHAIN_ID must not be set: unsupported with config v2
        - environment variable LINK_CONTRACT_ADDRESS must not be set: unsupported with config v2
YutaOkoshi commented 9 months ago

I did this work with Chainlink Node and AWS Console,So I did ran smartcontract/chainlink:2.7.0. But if you AutoScaling it, it will breaks. I don't know the correct methodization.

  1. AWS Console

    • Create SSL certificate in ACM (done before Cfn deployment)
    • Remove DB password setting of Aurora instance from SecretsManager management and set master password manually (done after Cfn deployment)
  2. On ChainlinkNode:

    
    $ sudo su ec2-user
    $ docker rm -f chainlink

The basics follow: https://docs.chain.link/chainlink-nodes/configuring-nodes

$ echo "RootDir = '/chainlink'

[Log] Level = 'debug'

[WebServer] AllowOrigins = '*' SecureCookies = false

[WebServer.TLS] HTTPSPort = 0

[[EVM]] ChainID = '1'

[[EVM.Nodes]] Name = 'something' WSURL = 'wss://something' HTTPURL = 'https://something'

[P2P.V1] Enabled = false

[P2P.V2] Enabled = false

[Database.Lock] Enabled = true LeaseDuration = '10s' LeaseRefreshInterval = '1s' " > /home/ec2-user/.chainlink/config.toml

The basics follow: https://docs.chain.link/chainlink-nodes/configuring-nodes

$ echo "[Password] Keystore = 'psqlpassword'

[Database] URL = 'postgresql://usename:psqlpassword@postgresqlHostName:5432/postgres' " > /home/ec2-user/.chainlink/secrets.toml

If CloudFormation parameters ChainlinkNodeGUIPassword and ChainlinkNodeGUIEmail are written, OK.

If this is not working, you will get a log message "API credentials must be supplied".

$ echo "CHANGE_THIS_EXAMPLE_EMAIL CHANGE_THIS_EXAMPLE_PASSWORD " > /home/ec2-user/.chainlink/.api

$ sudo chmod 777 -R /home/ec2-user/.chainlink $ sudo chown 1000:1000 -R /home/ec2-user/.chainlink

$ latestimage=$(curl -s -S "https://registry.hub.docker.com/v2/repositories/smartcontract/chainlink/tags/" | jq -r '."results"[]["name"]' | head -n 1)

$ cd /home/ec2-user/.chainlink && docker run -d \ -u 1000:1000 \ --log-driver=awslogs --log-opt awslogs-group=ChainlinkLogs \ --restart unless-stopped \ --name chainlink \ -p6688:6688 \ -v /home/ec2-user/.chainlink:/chainlink \ smartcontract/chainlink:$latestimage \ node --config /chainlink/config.toml --secrets /chainlink/secrets.toml start -a /chainlink/.api

Connection to PostgreSQL is made one node at a time, so only one node is healthy.

$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2fc97f22d5be smartcontract/chainlink:2.7.0 "chainlink node --co…" 2 hours ago Up 2 hours (healthy) 0.0.0.0:6688->6688/tcp, :::6688->6688/tcp chainlink

check

$ curl -XGET localhost:6688/health | jq '.' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 922 100 922 0 0 438k 0 --:--:-- --:--:-- --:--:-- 450k { "data": [ { "type": "checks", "id": "JobSpawner", "attributes": { "name": "JobSpawner", "status": "passing", "output": "" } }, { "type": "checks", "id": "MailboxMonitor", "attributes": { "name": "MailboxMonitor", "status": "passing", "output": "" } }, { "type": "checks", "id": "TelemetryManager", "attributes": { "name": "TelemetryManager", "status": "passing", "output": "" } }, { "type": "checks", "id": "EVM.80001.Relayer.Mercury.WSRPCPool", "attributes": { "name": "EVM.80001.Relayer.Mercury.WSRPCPool", "status": "passing", "output": "" } }, { "type": "checks", "id": "EventBroadcaster", "attributes": { "name": "EventBroadcaster", "status": "passing", "output": "" } }, { "type": "checks", "id": "PipelineRunner", "attributes": { "name": "PipelineRunner", "status": "passing", "output": "" } }, { "type": "checks", "id": "PromReporter", "attributes": { "name": "PromReporter", "status": "passing", "output": "" } }, { "type": "checks", "id": "PipelineORM", "attributes": { "name": "PipelineORM", "status": "passing", "output": "" } } ] }

YutaOkoshi commented 9 months ago

I didn't have time to incorporate it into the Chainlink Node startup template, so someone please do so.