From f6b17203eec7ea3a4f87d6cac61cf2480ad6157c Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 16:08:43 +0800 Subject: [PATCH 1/7] rename makefile cmd to docker-compose-up and start in background --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 97a79f53..7f199ffc 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,8 @@ ___DOCKER___: ## docker-build-and-publish-images: ## builds and publishes operator and aggregator docker images using Ko KO_DOCKER_REPO=ghcr.io/layr-labs/incredible-squaring ko build aggregator/cmd/main.go --preserve-import-paths KO_DOCKER_REPO=ghcr.io/layr-labs/incredible-squaring ko build operator/cmd/main.go --preserve-import-paths -docker-start-everything: docker-build-and-publish-images ## starts aggregator and operator docker containers - docker compose pull && docker compose up +docker-compose-up: docker-build-and-publish-images ## starts aggregator and operator docker containers + docker compose pull && docker compose up -d __CLI__: ## From 0ba80ed549e9097c51f43bb418025543fdc759f1 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 16:08:52 +0800 Subject: [PATCH 2/7] fix docker-compose file --- docker-compose.yml | 105 +++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 46 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index aebbc4f1..3e1b4771 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ networks: services: anvil: - image: ghcr.io/foundry-rs/foundry + image: ghcr.io/foundry-rs/foundry:nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a container_name: anvil ports: # opening the port so we can easily cast to anvil from localhost @@ -19,6 +19,15 @@ services: command: --host 0.0.0.0 --load-state /root/.anvil/state.json networks: - incredible-squaring-network + + anvil-advance-chain-script: + image: ghcr.io/foundry-rs/foundry:nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a + depends_on: + - anvil + entrypoint: cast + command: rpc anvil_mine 100 --rpc-url http://anvil:8545 + networks: + - incredible-squaring-network aggregator: image: ghcr.io/layr-labs/incredible-squaring/aggregator/cmd/main.go:latest @@ -26,6 +35,8 @@ services: depends_on: anvil: condition: service_started + anvil-advance-chain-script: + condition: service_completed_successfully volumes: - ./:/incredible-squaring/ working_dir: /incredible-squaring @@ -47,6 +58,8 @@ services: condition: service_started aggregator: condition: service_started + anvil-advance-chain-script: + condition: service_completed_successfully ports: - "9090:9090" # prometheus metrics port (defined in operator-docker-compose.anvil.yaml file) volumes: @@ -69,50 +82,50 @@ services: # networks: # - incredible-squaring-network - # METRICS RELATED - grafana: - image: grafana/grafana:9.4.1 - container_name: grafana - volumes: - - grafana_data:/var/lib/grafana - - ./grafana/provisioning:/etc/grafana/provisioning - environment: - # See https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables - # and https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/ - # They recommend using env vars instead of overwriting config.ini - - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} - - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} - - GF_USERS_ALLOW_SIGN_UP=false - restart: unless-stopped - ports: - - 3000:3000 - networks: - - incredible-squaring-network + # # METRICS RELATED + # grafana: + # image: grafana/grafana:9.4.1 + # container_name: grafana + # volumes: + # - grafana_data:/var/lib/grafana + # - ./grafana/provisioning:/etc/grafana/provisioning + # environment: + # # See https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables + # # and https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/ + # # They recommend using env vars instead of overwriting config.ini + # - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} + # - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} + # - GF_USERS_ALLOW_SIGN_UP=false + # restart: unless-stopped + # ports: + # - 3000:3000 + # networks: + # - incredible-squaring-network - prometheus: - image: prom/prometheus:v2.42.0 - container_name: prometheus - volumes: - - ./prometheus:/etc/prometheus - - prometheus_data:/prometheus - command: - - "--config.file=/etc/prometheus/prometheus.yml" - - "--storage.tsdb.path=/prometheus" - - "--web.console.libraries=/etc/prometheus/console_libraries" - - "--web.console.templates=/etc/prometheus/consoles" - - "--storage.tsdb.retention.time=200h" - - "--web.enable-lifecycle" - - --web.enable-remote-write-receiver - restart: unless-stopped - expose: - - 9090 - networks: - - incredible-squaring-network - # so that we can access the host from within the container - # needed to get the metrics from host.docker.internal:9184/metrics - extra_hosts: - - "host.docker.internal:host-gateway" + # prometheus: + # image: prom/prometheus:v2.42.0 + # container_name: prometheus + # volumes: + # - ./prometheus:/etc/prometheus + # - prometheus_data:/prometheus + # command: + # - "--config.file=/etc/prometheus/prometheus.yml" + # - "--storage.tsdb.path=/prometheus" + # - "--web.console.libraries=/etc/prometheus/console_libraries" + # - "--web.console.templates=/etc/prometheus/consoles" + # - "--storage.tsdb.retention.time=200h" + # - "--web.enable-lifecycle" + # - --web.enable-remote-write-receiver + # restart: unless-stopped + # expose: + # - 9090 + # networks: + # - incredible-squaring-network + # # so that we can access the host from within the container + # # needed to get the metrics from host.docker.internal:9184/metrics + # extra_hosts: + # - "host.docker.internal:host-gateway" -volumes: - prometheus_data: {} - grafana_data: {} +# volumes: +# prometheus_data: {} +# grafana_data: {} From 37019279e92f12b95d7712bbc80094cbf2ab1707 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 16:09:06 +0800 Subject: [PATCH 3/7] fix operator-docker-compose.anvil.yaml config file addresses --- config-files/operator-docker-compose.anvil.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config-files/operator-docker-compose.anvil.yaml b/config-files/operator-docker-compose.anvil.yaml index 4864cca4..46242e92 100644 --- a/config-files/operator-docker-compose.anvil.yaml +++ b/config-files/operator-docker-compose.anvil.yaml @@ -8,8 +8,8 @@ operator_address: 0x860B6912C2d0337ef05bbC89b0C2CB6CbAEAB4A5 # This is the address of the contracts which are deployed in the anvil saved state # The saved eigenlayer state is located in tests/anvil/credible_squaring_avs_deployment_output.json # TODO(samlaf): automate updating these addresses when we deploy new contracts -avs_registry_coordinator_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 -operator_state_retriever_address: 0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8 +avs_registry_coordinator_address: 0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9 +operator_state_retriever_address: 0x95401dc811bb5740090279Ba06cfA8fcF6113778 # ETH RPC URL eth_rpc_url: http://anvil:8545 @@ -46,4 +46,4 @@ enable_node_api: true register_operator_on_startup: true # address of token to deposit tokens into when registering on startup # addresses.erc20MockStrategy in tests/anvil/credible_squaring_avs_deployment_output.json -token_strategy_addr: 0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f \ No newline at end of file +token_strategy_addr: 0x09635F643e140090A9A8Dcd712eD6285858ceBef \ No newline at end of file From 0c282f2219818b42104fed055ff429a71f980383 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 16:12:33 +0800 Subject: [PATCH 4/7] fix docker-compose-up-test workflow (start docker compose in background) --- .github/workflows/docker-compose-up-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-up-test.yaml b/.github/workflows/docker-compose-up-test.yaml index 5f573d66..93e83d3f 100644 --- a/.github/workflows/docker-compose-up-test.yaml +++ b/.github/workflows/docker-compose-up-test.yaml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v2 - name: Run Docker Compose - run: docker compose up + run: docker compose up -d - name: Sleep run: sleep 60 From ad29687ce5f74d1cba8f01c8314b9091ea954d8d Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 17:11:27 +0800 Subject: [PATCH 5/7] uncomment grafana/prom in docker-compose.yml --- docker-compose.yml | 90 +++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3e1b4771..3760d7a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,50 +82,50 @@ services: # networks: # - incredible-squaring-network - # # METRICS RELATED - # grafana: - # image: grafana/grafana:9.4.1 - # container_name: grafana - # volumes: - # - grafana_data:/var/lib/grafana - # - ./grafana/provisioning:/etc/grafana/provisioning - # environment: - # # See https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables - # # and https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/ - # # They recommend using env vars instead of overwriting config.ini - # - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} - # - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} - # - GF_USERS_ALLOW_SIGN_UP=false - # restart: unless-stopped - # ports: - # - 3000:3000 - # networks: - # - incredible-squaring-network + # METRICS RELATED + grafana: + image: grafana/grafana:9.4.1 + container_name: grafana + volumes: + - grafana_data:/var/lib/grafana + - ./grafana/provisioning:/etc/grafana/provisioning + environment: + # See https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables + # and https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/ + # They recommend using env vars instead of overwriting config.ini + - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} + - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} + - GF_USERS_ALLOW_SIGN_UP=false + restart: unless-stopped + ports: + - 3000:3000 + networks: + - incredible-squaring-network - # prometheus: - # image: prom/prometheus:v2.42.0 - # container_name: prometheus - # volumes: - # - ./prometheus:/etc/prometheus - # - prometheus_data:/prometheus - # command: - # - "--config.file=/etc/prometheus/prometheus.yml" - # - "--storage.tsdb.path=/prometheus" - # - "--web.console.libraries=/etc/prometheus/console_libraries" - # - "--web.console.templates=/etc/prometheus/consoles" - # - "--storage.tsdb.retention.time=200h" - # - "--web.enable-lifecycle" - # - --web.enable-remote-write-receiver - # restart: unless-stopped - # expose: - # - 9090 - # networks: - # - incredible-squaring-network - # # so that we can access the host from within the container - # # needed to get the metrics from host.docker.internal:9184/metrics - # extra_hosts: - # - "host.docker.internal:host-gateway" + prometheus: + image: prom/prometheus:v2.42.0 + container_name: prometheus + volumes: + - ./prometheus:/etc/prometheus + - prometheus_data:/prometheus + command: + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus" + - "--web.console.libraries=/etc/prometheus/console_libraries" + - "--web.console.templates=/etc/prometheus/consoles" + - "--storage.tsdb.retention.time=200h" + - "--web.enable-lifecycle" + - --web.enable-remote-write-receiver + restart: unless-stopped + expose: + - 9090 + networks: + - incredible-squaring-network + # so that we can access the host from within the container + # needed to get the metrics from host.docker.internal:9184/metrics + extra_hosts: + - "host.docker.internal:host-gateway" -# volumes: -# prometheus_data: {} -# grafana_data: {} +volumes: + prometheus_data: {} + grafana_data: {} From 49f7897337bfc1699e70b2d2e672a545a4e2a852 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 17:11:49 +0800 Subject: [PATCH 6/7] remove docker-compose-up make dependency to build-and-publish-images --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7f199ffc..6b7fba5c 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ ___DOCKER___: ## docker-build-and-publish-images: ## builds and publishes operator and aggregator docker images using Ko KO_DOCKER_REPO=ghcr.io/layr-labs/incredible-squaring ko build aggregator/cmd/main.go --preserve-import-paths KO_DOCKER_REPO=ghcr.io/layr-labs/incredible-squaring ko build operator/cmd/main.go --preserve-import-paths -docker-compose-up: docker-build-and-publish-images ## starts aggregator and operator docker containers +docker-compose-up: ## runs docker compose pull first and then up docker compose pull && docker compose up -d __CLI__: ## From 6ecb355c7c0287c066b7a261fd0687f1da8d560f Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Mon, 13 May 2024 17:12:06 +0800 Subject: [PATCH 7/7] fix status check in docker-compose-up-test.yaml workflow --- .github/workflows/docker-compose-up-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-compose-up-test.yaml b/.github/workflows/docker-compose-up-test.yaml index 93e83d3f..3c7b3ee4 100644 --- a/.github/workflows/docker-compose-up-test.yaml +++ b/.github/workflows/docker-compose-up-test.yaml @@ -21,7 +21,7 @@ jobs: - name: Check services running run: | - if docker compose ps -aq | xargs docker inspect -f '{{ .State.Status }}' | grep -v running; then + if docker compose ps -a --filter="status=exited" --services | grep -v anvil-advance-chain-script | xargs grep -q; then echo "Some services are not running" exit 1 fi