Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move localnet monitoring to profile #2574

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 16 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ VERSION := $(shell ./version.sh)
COMMIT := $(shell [ -z "${COMMIT_ID}" ] && git log -1 --format='%H' || echo ${COMMIT_ID} )
BUILDTIME := $(shell date -u +"%Y%m%d.%H%M%S" )
DOCKER ?= docker
# allow setting of DOCKER_COMPOSE_ARGS to pass additional args to docker compose
# useful for setting profiles
DOCKER_COMPOSE ?= $(DOCKER) compose $(COMPOSE_ARGS)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
GOFLAGS:=""

Expand Down Expand Up @@ -209,11 +212,11 @@ start-localnet: zetanode start-localnet-skip-build
start-localnet-skip-build:
@echo "--> Starting localnet"
export LOCALNET_MODE=setup-only && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) -f docker-compose.yml up -d

# stop-localnet should include all profiles so other containers are also removed
stop-localnet:
cd contrib/localnet/ && $(DOCKER) compose --profile all down --remove-orphans
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile all down --remove-orphans

###############################################################################
### E2E tests ###
Expand All @@ -236,37 +239,37 @@ solana:

start-e2e-test: zetanode
@echo "--> Starting e2e test"
cd contrib/localnet/ && $(DOCKER) compose up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

start-e2e-admin-test: zetanode
@echo "--> Starting e2e admin test"
export E2E_ARGS="--skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER) compose --profile eth2 -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile eth2 -f docker-compose.yml up -d

start-e2e-performance-test: zetanode
@echo "--> Starting e2e performance test"
export E2E_ARGS="--test-performance" && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) -f docker-compose.yml up -d

start-e2e-import-mainnet-test: zetanode
@echo "--> Starting e2e import-data test"
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml up -d
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) -f docker-compose.yml up -d

start-stress-test: zetanode
@echo "--> Starting stress test"
cd contrib/localnet/ && $(DOCKER) compose --profile stress -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile stress -f docker-compose.yml up -d

start-tss-migration-test: zetanode
@echo "--> Starting migration test"
export E2E_ARGS="--test-tss-migration" && \
cd contrib/localnet/ && $(DOCKER) compose up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d

start-solana-test: zetanode solana
@echo "--> Starting solana test"
export E2E_ARGS="--skip-regular --test-solana" && \
cd contrib/localnet/ && $(DOCKER) compose --profile solana -f docker-compose.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile solana -f docker-compose.yml up -d

###############################################################################
### Upgrade Tests ###
Expand All @@ -290,42 +293,29 @@ start-upgrade-test: zetanode-upgrade
@echo "--> Starting upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && $(DOCKER) compose --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d

start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
cd contrib/localnet/ && $(DOCKER) compose --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d


start-upgrade-test-admin: zetanode-upgrade
@echo "--> Starting admin upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
export E2E_ARGS="--skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER) compose --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d
cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d

start-upgrade-import-mainnet-test: zetanode-upgrade
@echo "--> Starting import-data upgrade test"
export LOCALNET_MODE=upgrade && \
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=15m && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d

###############################################################################
### Monitoring ###
###############################################################################

start-monitoring:
@echo "Starting monitoring services"
cd contrib/localnet/grafana/ && ./get-tss-address.sh
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-monitoring.yml up -d

stop-monitoring:
@echo "Stopping monitoring services"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-monitoring.yml down
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose.yml -f docker-compose-upgrade.yml up -d

###############################################################################
### GoReleaser ###
Expand Down
43 changes: 0 additions & 43 deletions contrib/localnet/docker-compose-monitoring.yml

This file was deleted.

91 changes: 91 additions & 0 deletions contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,97 @@ services:
- UPGRADE_HEIGHT=${UPGRADE_HEIGHT-}
volumes:
- ssh:/root/.ssh

grafana:
image: grafana/grafana:9.1.7
container_name: grafana
hostname: grafana
profiles:
- monitoring
- all
volumes:
- ./grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
- ./grafana/dashboards/:/etc/grafana/provisioning/dashboards
- grafana_storage:/var/lib/grafana
ports:
- "3000:3000"
networks:
mynetwork:
ipv4_address: 172.20.0.30
depends_on:
- prometheus

prometheus:
image: prom/prometheus:v2.53.1
container_name: prometheus
hostname: prometheus
profiles:
- monitoring
- all
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
networks:
mynetwork:
ipv4_address: 172.20.0.31
depends_on:
zetacore0:
condition: service_healthy

zetachain-exporter:
image: zetachain/zetachain-exporter:v2.0.6
container_name: zetachain-exporter
hostname: zetachain-exporter
profiles:
- monitoring
- all
ports:
- "9015:9015"
networks:
mynetwork:
ipv4_address: 172.20.0.32
environment:
- ETH_EVM_URL=http://eth:8545
- ZETA_EVM_URL=http://zetacore0:8545
- ZETA_LCD_URL=http://zetacore0:1317
- ZETA_TENDERMINT_URL=http://zetacore0:26657
- ETH_CHAIN_ID=1337
- ZETA_CHAIN_ID=7001
- REFRESH_INTERVAL=15
- FAST_REFRESH_INTERVAL=1
depends_on:
zetacore0:
condition: service_healthy
eth:
condition: service_started

loki:
container_name: loki
image: grafana/loki:3.1.0
hostname: loki
profiles:
- monitoring
- all
networks:
mynetwork:
ipv4_address: 172.20.0.33
command: -config.file=/etc/loki/local-config.yaml

promtail:
container_name: promtail
image: grafana/promtail:2.9.9
hostname: promtail
profiles:
- monitoring
- all
networks:
mynetwork:
ipv4_address: 172.20.0.34
volumes:
- ./promtail/config.yaml:/etc/promtail/config.yaml:ro
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/config.yaml

volumes:
ssh:
preparams:
grafana_storage:
Loading
Loading