forked from matter-labs/block-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: porting changes from release/testnet-beta (matter-labs#1)
* feat: adopt style for zulu * feat: add scripts * feat: add docker file for other network --------- Co-authored-by: zh-kai <[email protected]> Co-authored-by: Iron Lu <[email protected]>
- Loading branch information
1 parent
18925c4
commit b7ed739
Showing
45 changed files
with
1,566 additions
and
1,460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit | ||
#npx --no-install commitlint --edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
#npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
help: ## Display this help screen | ||
@grep -h \ | ||
-E '^[a-zA-Z_0-9-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
login_db: ## if need use pswd: notsecurepassword | ||
@psql -h localhost -U postgres -p 5433 | ||
|
||
|
||
login_alpha_db: ## if need use pswd: notsecurepassword | ||
@psql -h localhost -U postgres -p 5434 -d block-explorer-alpha | ||
|
||
start_local: ## run explorer with local db | ||
@docker compose -f docker-compose-local.yaml up -d | ||
|
||
start: ## run explorer with external db | ||
@docker compose -f docker-compose.yaml up -d | ||
|
||
|
||
start_alpha_api_local: ## run explorer with local db | ||
@docker compose -f docker-compose-local-alpha.yaml up -d | ||
|
||
start_alpha_api: ## run explorer with local db | ||
@docker compose -f docker-compose-local-alpha.yaml up -d alpha-api | ||
|
||
|
||
clear: ## clear docker | ||
docker compose down --volumes | ||
docker compose pull | ||
|
||
|
||
.PHONY: clippy fmt test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# run with sequencer and db | ||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: ./packages/app/Dockerfile | ||
ports: | ||
- '3010:3010' | ||
depends_on: | ||
- api | ||
restart: unless-stopped | ||
|
||
worker: | ||
build: | ||
context: . | ||
dockerfile: ./packages/worker/Dockerfile | ||
environment: | ||
- PORT=3001 | ||
- LOG_LEVEL=verbose | ||
- DATABASE_HOST=postgres | ||
- DATABASE_USER=postgres | ||
- DATABASE_PASSWORD=postgres | ||
- DATABASE_NAME=block-explorer | ||
- BLOCKCHAIN_RPC_URL=http://zksync:3050 | ||
- DATA_FETCHER_URL=http://data-fetcher:3040 | ||
- BATCHES_PROCESSING_POLLING_INTERVAL=1000 | ||
ports: | ||
- '3001:3001' | ||
depends_on: | ||
zksync: | ||
condition: service_healthy | ||
restart: unless-stopped | ||
|
||
data-fetcher: | ||
build: | ||
context: . | ||
dockerfile: ./packages/data-fetcher/Dockerfile | ||
environment: | ||
- PORT=3040 | ||
- LOG_LEVEL=verbose | ||
- BLOCKCHAIN_RPC_URL=http://zksync:3050 | ||
ports: | ||
- '3040:3040' | ||
depends_on: | ||
zksync: | ||
condition: service_healthy | ||
restart: unless-stopped | ||
|
||
api: | ||
build: | ||
context: . | ||
dockerfile: ./packages/api/Dockerfile | ||
environment: | ||
- PORT=3020 | ||
- METRICS_PORT=3005 | ||
- LOG_LEVEL=verbose | ||
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/block-explorer | ||
ports: | ||
- '3020:3020' | ||
- '3005:3005' | ||
depends_on: | ||
- worker | ||
restart: unless-stopped | ||
|
||
postgres: | ||
image: "postgres:14" | ||
logging: | ||
driver: none | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=block-explorer | ||
|
||
geth: | ||
image: "matterlabs/geth:latest" | ||
logging: | ||
driver: none | ||
ports: | ||
- "8545:8545" | ||
- "8546:8546" | ||
volumes: | ||
- geth:/var/lib/geth/data | ||
|
||
zksync: | ||
stdin_open: true | ||
tty: true | ||
image: matterlabs/local-node:latest2.0 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
geth: | ||
condition: service_started | ||
ports: | ||
- "3050:3050" # JSON RPC HTTP port | ||
- "3051:3051" # JSON RPC WS port | ||
volumes: | ||
# Configs folder bind | ||
- zksync-config:/etc/env/ | ||
# Storage folder bind | ||
- zksync-data:/var/lib/zksync/data | ||
environment: | ||
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/zksync_local | ||
- ETH_CLIENT_WEB3_URL=http://geth:8545 | ||
healthcheck: | ||
test: "curl -H \"Content-Type: application/json\" -X POST --data '{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":67}' 127.0.0.1:3050 || exit 1" | ||
interval: 5s | ||
timeout: 5s | ||
retries: 300 | ||
restart: unless-stopped | ||
|
||
volumes: | ||
geth: | ||
postgres: | ||
zksync-config: | ||
zksync-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Run the explorer with db | ||
services: | ||
alpha-api: | ||
container_name: "block-explorer-alpha-api" | ||
image: zulunetwork/zulu-prime-block-explorer-api:latest | ||
environment: | ||
- PORT=3022 | ||
- METRICS_PORT=3007 | ||
- LOG_LEVEL=verbose | ||
- DATABASE_URL=postgres://postgres:postgres@localhost:5434/block-explorer-alpha | ||
ports: | ||
- '3022:3022' | ||
- '3007:3007' | ||
restart: unless-stopped | ||
alpha-postgres: | ||
container_name: "block-explorer-alpha-api-postgres" | ||
image: "postgres:16" | ||
logging: | ||
driver: none | ||
volumes: | ||
- ~/volumes/postgres-16/data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=block-explorer-alpha | ||
expose: | ||
- "5434" # Publishes 5434 to other containers but NOT to host machine | ||
ports: | ||
- "5434:5434" | ||
command: -p 5434 | ||
|
||
|
Oops, something went wrong.