Skip to content

Commit

Permalink
fix: add data fetcher to GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Jan 3, 2024
1 parent a63ac2e commit b61e7f6
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 16 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ jobs:
file: packages/worker/Dockerfile
no-cache: true

- name: Build and push Docker image for Data Fetcher
uses: docker/build-push-action@v4
with:
push: true
tags: |
"matterlabs/block-explorer-data-fetcher:latest"
"matterlabs/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"matterlabs/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:latest"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}"
file: packages/data-fetcher/Dockerfile
no-cache: true

- name: Build and push Docker image for App
uses: docker/build-push-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
packages/app/junit.xml
packages/api/junit.xml
packages/worker/junit.xml
packages/data-fetcher/junit.xml
check_run_annotations: all tests, skipped tests
report_individual_runs: "true"
check_name: Unit Test Results
Expand Down
35 changes: 23 additions & 12 deletions docker-compose-cli.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
version: '3.2'
version: "3.2"
name: "zkcli-block-explorer"

services:
app:
build:
context: .
dockerfile: ./packages/app/Dockerfile
platform: linux/amd64
image: "matterlabs/block-explorer-app:${VERSION}"
ports:
- '3010:3010'
depends_on:
- api
restart: unless-stopped

worker:
build:
context: .
dockerfile: ./packages/worker/Dockerfile
platform: linux/amd64
image: "matterlabs/block-explorer-worker:${VERSION}"
environment:
- PORT=3001
- LOG_LEVEL=verbose
Expand All @@ -23,14 +22,26 @@ services:
- DATABASE_USER=postgres
- DATABASE_PASSWORD=postgres
- DATABASE_NAME=block-explorer
- BLOCKCHAIN_RPC_URL=http://host.docker.internal:3050
- BLOCKCHAIN_RPC_URL=http://host.docker.internal:${RPC_PORT}
- DATA_FETCHER_URL=http://data-fetcher:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped

data-fetcher:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:${VERSION}"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://host.docker.internal:${RPC_PORT}
ports:
- '3040:3040'
restart: unless-stopped

api:
build:
context: .
dockerfile: ./packages/api/Dockerfile
platform: linux/amd64
image: "matterlabs/block-explorer-api:${VERSION}"
environment:
- PORT=3020
- METRICS_PORT=3005
Expand Down Expand Up @@ -60,4 +71,4 @@ services:
- POSTGRES_DB=block-explorer

volumes:
postgres:
postgres:
28 changes: 26 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- 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'
Expand All @@ -43,6 +44,29 @@ services:
condition: service_healthy
restart: unless-stopped

data-fetcher:
build:
context: .
dockerfile: ./packages/data-fetcher/Dockerfile
target: development-stage
command: npm run --prefix packages/data-fetcher dev:debug
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync:3050
ports:
- '3040:3040'
- '9231:9229'
- '9232:9230'
volumes:
- ./packages/data-fetcher:/usr/src/app/packages/data-fetcher
- /usr/src/app/packages/data-fetcher/node_modules
depends_on:
zksync:
condition: service_healthy
restart: unless-stopped

api:
build:
context: .
Expand All @@ -58,8 +82,8 @@ services:
ports:
- '3020:3020'
- '3005:3005'
- '9231:9229'
- '9232:9230'
- '9233:9229'
- '9234:9230'
volumes:
- ./packages/api:/usr/src/app/packages/api
- /usr/src/app/packages/api/node_modules
Expand Down
2 changes: 1 addition & 1 deletion packages/data-fetcher/src/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("config", () => {

it("sets default values", () => {
expect(config()).toEqual({
port: 3001,
port: 3040,
blockchain: {
rpcUrl: "http://localhost:3050",
rpcCallDefaultRetryTimeout: 30000,
Expand Down
2 changes: 1 addition & 1 deletion packages/data-fetcher/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default () => {
} = process.env;

return {
port: parseInt(PORT, 10) || 3001,
port: parseInt(PORT, 10) || 3040,
blockchain: {
rpcUrl: BLOCKCHAIN_RPC_URL || "http://localhost:3050",

Expand Down

0 comments on commit b61e7f6

Please sign in to comment.