Skip to content

Commit

Permalink
make evm-subql part of monorepo (#713)
Browse files Browse the repository at this point in the history
* make evm-subql part of monorepo

* fix deps

* update docker compose

* update subql

* update docker compose

* fix version

* increase retries

* fix test

* multi-platform

* update action

* setup docker buildx
  • Loading branch information
ermalkaleci authored Apr 28, 2023
1 parent 3ac02a1 commit 68cf5c7
Show file tree
Hide file tree
Showing 42 changed files with 5,439 additions and 11,052 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ bin/
lib/
dist/
examples/
evm-subql/
scripts/
20 changes: 13 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -25,14 +27,15 @@ jobs:
with:
images: acala/eth-rpc-adapter
tags: |
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=raw,value={{sha}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
file: packages/eth-rpc-adapter/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -44,6 +47,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -55,14 +60,15 @@ jobs:
with:
images: acala/evm-subql
tags: |
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=raw,value={{sha}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
file: evm-subql/Dockerfile
file: packages/evm-subql/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 0 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,6 @@ jobs:
if: failure()
uses: jwalton/gh-docker-logs@v2

# waffle-tutorials:
# runs-on: ubuntu-latest
# needs: cancel-prev-runs
# steps:
# - name: checkout
# uses: actions/checkout@v3
# with:
# submodules: 'recursive'
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# - name: check docker info before cleaning
# run: docker ps && docker volume ls
# - name: build bodhi base # if use self-hosted machine can utilize cache
# run: docker build . -t bodhi-base -f docker/bodhi-base.Dockerfile#
# - name: test
# run: docker compose up --abort-on-container-exit --exit-code-from=waffle-tutorials-test --build -- waffle-tutorials-test
# - name: dump docker logs on failure
# if: failure()
# uses: jwalton/gh-docker-logs@v2

hardhat-tutorials:
runs-on: self-hosted
needs: cancel-prev-runs
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "truffle"]
path = examples/truffle-tutorials
url = https://github.com/AcalaNetwork/truffle-tutorials.git
[submodule "waffle"]
path = examples/waffle-tutorials
url = https://github.com/AcalaNetwork/waffle-tutorials.git
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Packages:
- [bodhi.js](./packages/bodhi)
- [eth-providers](./packages/eth-providers)
- [eth-rpc-adapter](./packages/eth-rpc-adapter)
- [evm-subql](./evm-subql)
- [evm-subql](./packages/evm-subql)
- [examples](./examples)

## Getting Started
Expand Down Expand Up @@ -60,7 +60,6 @@ where xxx ∈ {
eth-providers-test,
eth-rpc-adapter-test,
waffle-examples-test,
waffle-tutorials-test,
hardhat-tutorials-test,
truffle-tutorials-test,
}
Expand All @@ -80,7 +79,7 @@ docker logs -f <container_id> # logs for specific container
- build locally: `docker build . -t eth-rpc-local -f packages/eth-rpc-adapter/Dockerfile`
- [public docker images](https://hub.docker.com/r/acala/eth-rpc-adapter/tags)
- evm subquery
- build locally: `docker build . -t evm-subql-local -f evm-subql/Dockerfile`
- build locally: `docker build . -t evm-subql-local -f packages/evm-subql/Dockerfile`
- [public docker images](https://hub.docker.com/r/acala/evm-subql/tags)

## More References
Expand Down
46 changes: 36 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ services:
dockerfile: docker/subql-node.Dockerfile
target: subql-node
depends_on:
yarn-install:
condition: service_completed_successfully
postgres:
condition: service_started
mandala-node:
condition: service_healthy
volumes:
- ./:/app
- monorepo_yarn_cache:/app/.yarn/cache
- monorepo_node_modules:/app/node_modules
ports:
- 3000:3000
restart: always
Expand All @@ -41,8 +47,10 @@ services:
ports:
- 3001:3001
depends_on:
- postgres
- subquery-node
postgres:
condition: service_started
subquery-node:
condition: service_started
restart: always
environment:
DB_USER: postgres
Expand All @@ -68,6 +76,8 @@ services:
- monorepo_yarn_cache:/app/.yarn/cache
- monorepo_node_modules:/app/node_modules
depends_on:
yarn-install:
condition: service_completed_successfully
postgres:
condition: service_started
subquery-node:
Expand Down Expand Up @@ -95,6 +105,8 @@ services:
depends_on:
eth-rpc-adapter-with-subql-ready:
condition: service_completed_successfully
yarn-install:
condition: service_completed_successfully

# ------------------------------------ #
# ---------- No Subql Realm ---------- #
Expand Down Expand Up @@ -123,6 +135,16 @@ services:
- --instant-sealing
- --tmp

yarn-install:
build:
context: .
dockerfile: docker/yarn.Dockerfile
target: yarn-install
volumes:
- ./:/app
- monorepo_yarn_cache:/app/.yarn/cache
- monorepo_node_modules:/app/node_modules

eth-providers-test:
build:
context: .
Expand All @@ -135,6 +157,8 @@ services:
depends_on:
mandala-node:
condition: service_healthy
yarn-install:
condition: service_completed_successfully

eth-rpc-adapter-server:
build:
Expand All @@ -150,6 +174,8 @@ services:
depends_on:
mandala-node:
condition: service_healthy
yarn-install:
condition: service_completed_successfully
command:
- --endpoint=ws://mandala-node:9944
- --port=8545
Expand All @@ -169,6 +195,8 @@ services:
depends_on:
mandala-node:
condition: service_healthy
yarn-install:
condition: service_completed_successfully
command:
- --endpoint=ws://mandala-node:9944
- --port=8545
Expand All @@ -188,6 +216,9 @@ services:
- ./:/app
- monorepo_yarn_cache:/app/.yarn/cache
- monorepo_node_modules:/app/node_modules
depends_on:
yarn-install:
condition: service_completed_successfully
restart: always
command:
- --endpoint=wss://acala-karura-eu-1.bdnodes.net:8443/parachain?auth=4VFR_UEvc8mUAd58z11nSRqp-EBZcqPl14j_MgEm-4E
Expand All @@ -206,6 +237,8 @@ services:
depends_on:
mandala-node:
condition: service_healthy
yarn-install:
condition: service_completed_successfully

chain-ready:
image: alpine:latest
Expand Down Expand Up @@ -242,14 +275,6 @@ services:
condition: service_healthy
command: echo "💈 + 🗂️ ETH RPC ADAPTER & SUBQL IS READY 🚀"

waffle-tutorials-test:
build:
context: .
dockerfile: docker/waffle-tutorials-test.Dockerfile
target: waffle-tutorials
depends_on:
mandala-node:
condition: service_healthy
hardhat-tutorials-test:
build:
context: .
Expand All @@ -262,6 +287,7 @@ services:
depends_on:
eth-rpc-adapter-server-rich:
condition: service_healthy

truffle-tutorials-test:
build:
context: .
Expand Down
2 changes: 1 addition & 1 deletion docker/eth-providers-test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ VOLUME ["/app"]
WORKDIR /app

ENV ENDPOINT_URL=ws://mandala-node:9944
CMD yarn install --immutable; yarn e2e:feed-tx; yarn workspace @acala-network/eth-providers run test:CI
CMD yarn e2e:feed-tx; yarn workspace @acala-network/eth-providers run test:CI
4 changes: 2 additions & 2 deletions docker/eth-rpc-adapter-server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR /app
ARG healthcheck_port=8545
ENV HEALTHCHECK_PORT=$healthcheck_port

HEALTHCHECK --interval=10s --timeout=3s --retries=60 --start-period=10s \
HEALTHCHECK --interval=10s --timeout=3s --retries=100 --start-period=10s \
CMD curl --fail http://localhost:${HEALTHCHECK_PORT} || exit 1

ENTRYPOINT yarn install --immutable; yarn workspace @acala-network/eth-rpc-adapter run start $0 $@
ENTRYPOINT yarn workspace @acala-network/eth-rpc-adapter run start $0 $@
17 changes: 3 additions & 14 deletions docker/subql-node.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
FROM bodhi-runner as builder
FROM onfinality/subql-node:v1.21.2 as subql-node
LABEL maintainer="[email protected]"

WORKDIR /app

COPY evm-subql /app/evm-subql
WORKDIR /app/evm-subql
RUN yarn && yarn build

# =============

FROM onfinality/subql-node:v1.17.0 as subql-node
LABEL maintainer="[email protected]"

WORKDIR /app
COPY --from=builder /app/evm-subql /app
VOLUME ["/app"]
WORKDIR /app/packages/evm-subql
2 changes: 1 addition & 1 deletion docker/waffle-examples-test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FROM bodhi-runner as waffle-examples
VOLUME ["/app"]
WORKDIR /app
ENV ENDPOINT_URL=ws://mandala-node:9944
CMD yarn install --immutable; yarn run test:waffle
CMD yarn run test:waffle
6 changes: 0 additions & 6 deletions docker/waffle-tutorials-test.Dockerfile

This file was deleted.

7 changes: 7 additions & 0 deletions docker/yarn.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# =============== yarn install =============== #
FROM bodhi-runner as yarn-install

VOLUME ["/app"]
WORKDIR /app

ENTRYPOINT yarn install --immutable; yarn workspace @acala-network/evm-subql build
2 changes: 0 additions & 2 deletions evm-subql/.eslintignore

This file was deleted.

46 changes: 0 additions & 46 deletions evm-subql/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 68cf5c7

Please sign in to comment.