From 5c0100bd9b894bd7508832c33f152d2579749164 Mon Sep 17 00:00:00 2001 From: Salka1988 Date: Thu, 14 Mar 2024 14:49:55 +0100 Subject: [PATCH 1/4] try ci --- .github/actions/docker-publish/action.yaml | 83 ++++++++++++++++++++++ .github/workflows/docker-publish.yml | 33 +++++++++ 2 files changed, 116 insertions(+) create mode 100644 .github/actions/docker-publish/action.yaml create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/actions/docker-publish/action.yaml b/.github/actions/docker-publish/action.yaml new file mode 100644 index 0000000..49977c1 --- /dev/null +++ b/.github/actions/docker-publish/action.yaml @@ -0,0 +1,83 @@ +name: 'Build & Plush Docker' + +inputs: + compose-version: + description: 'Docker Compose version' + default: 2.6.0 + registry: + description: 'Docker registry service' + default: ghcr.io + username: + description: 'Username for https://ghcr.io' + required: true + password: + description: 'Password for https://ghcr.io' + required: true + image: + description: 'Image name with provider url' + required: true + dockerfile: + description: 'Path to the Dockerfile' + required: true + context: + description: 'Path to the Context' + default: . + required: true + build-args: + description: 'List of build-time variables' + required: false + +outputs: + image: + description: 'Image url' + value: ${{ steps.imageOuput.outputs.imageUrl }} + imageid: + description: 'Image ID' + value: ${{ steps.publish.outputs.imageId }} + digest: + description: 'Image digest' + value: ${{ steps.publish.outputs.digest }} + metadata: + description: 'Build result metadata' + value: ${{ steps.publish.outputs.metadata }} + +runs: + using: 'composite' + steps: + - name: Log in to the ghcr.io registry + uses: docker/login-action@v2 + with: + registry: ${{ inputs.registry }} + username: ${{ inputs.username }} + password: ${{ inputs.password }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ${{ inputs.image }} + tags: | + type=ref,event=branch + type=sha,prefix= + type=semver,pattern={{raw}} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push the image to ghcr.io + uses: docker/build-push-action@v4 + id: publish + with: + context: ${{ inputs.context }} + file: ${{ inputs.dockerfile }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: ${{ inputs.build-args }} + cache-from: type=gha + cache-to: type=gha,mode=max + - id: imageOuput + shell: bash + run: | + echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..6b3fb23 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,33 @@ +name: Build ad publish Docker image + +on: + push: + branches: + - main + - salka1988/add_ci + pull_request: + types: [opened, synchronize] + release: + types: [published] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-and-publish-image: + runs-on: buildjet-4vcpu-ubuntu-2204 + if: | + (github.event_name == 'release' && github.event.action == 'published') || + github.ref == 'refs/heads/main' || github.ref == 'refs/heads/salka1988/add_ci' || github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v3 + + - name: Build and push Fuel Graph Node Image + uses: ./.github/actions/docker-publish + id: publish + with: + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + image: ghcr.io/fuellabs/fuel-graph-node + dockerfile: fuel-graph-node/docker/Dockerfile \ No newline at end of file From 5063e76c2656ebd0e124b8af6d2b08b680b1dc02 Mon Sep 17 00:00:00 2001 From: Salka1988 Date: Thu, 14 Mar 2024 14:52:38 +0100 Subject: [PATCH 2/4] try ci --- fuel-graph-node/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel-graph-node/docker/Dockerfile b/fuel-graph-node/docker/Dockerfile index 0044c6b..4deac77 100644 --- a/fuel-graph-node/docker/Dockerfile +++ b/fuel-graph-node/docker/Dockerfile @@ -103,5 +103,5 @@ ADD docker/wait_for docker/start /usr/local/bin/ COPY --from=graph-node-build /usr/local/bin/graph-node /usr/local/bin/graphman /usr/local/bin/ COPY --from=graph-node-build /etc/image-info /etc/image-info COPY --from=envsubst /go/bin/envsubst /usr/local/bin/ -COPY docker/Dockerfile /Dockerfile +#COPY docker/Dockerfile /Dockerfile CMD ["start"] From de88a6adc73d8cc4aa1b990dc1e3cbf80759a23f Mon Sep 17 00:00:00 2001 From: Salka1988 Date: Thu, 14 Mar 2024 15:11:02 +0100 Subject: [PATCH 3/4] try ci --- .github/actions/docker-publish/action.yaml | 3 + .github/workflows/docker-publish.yml | 6 +- fuel-graph-node/Cargo.lock | 73 ---------------------- fuel-graph-node/Cargo.toml | 6 +- fuel-graph-node/Dockerfile | 58 +++++++++++++++++ fuel-graph-node/docker/Dockerfile | 2 +- 6 files changed, 68 insertions(+), 80 deletions(-) create mode 100644 fuel-graph-node/Dockerfile diff --git a/.github/actions/docker-publish/action.yaml b/.github/actions/docker-publish/action.yaml index 49977c1..a51a536 100644 --- a/.github/actions/docker-publish/action.yaml +++ b/.github/actions/docker-publish/action.yaml @@ -61,6 +61,8 @@ runs: type=ref,event=branch type=sha,prefix= type=semver,pattern={{raw}} + flavor: | + latest=${{ github.ref == 'refs/heads/master' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -70,6 +72,7 @@ runs: id: publish with: context: ${{ inputs.context }} + platforms: linux/amd64 file: ${{ inputs.dockerfile }} push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6b3fb23..acced7e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - salka1988/add_ci +# - salka1988/add_ci pull_request: types: [opened, synchronize] release: @@ -19,7 +19,7 @@ jobs: runs-on: buildjet-4vcpu-ubuntu-2204 if: | (github.event_name == 'release' && github.event.action == 'published') || - github.ref == 'refs/heads/main' || github.ref == 'refs/heads/salka1988/add_ci' || github.event_name == 'pull_request' + github.ref == 'refs/heads/main' || github.ref == 'refs/heads/salka1988/add_ci' || github.event_name == 'pull_request' steps: - uses: actions/checkout@v3 @@ -30,4 +30,4 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} image: ghcr.io/fuellabs/fuel-graph-node - dockerfile: fuel-graph-node/docker/Dockerfile \ No newline at end of file + dockerfile: fuel-graph-node/Dockerfile \ No newline at end of file diff --git a/fuel-graph-node/Cargo.lock b/fuel-graph-node/Cargo.lock index a717583..a35fafb 100644 --- a/fuel-graph-node/Cargo.lock +++ b/fuel-graph-node/Cargo.lock @@ -160,16 +160,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" -[[package]] -name = "assert-json-diff" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "async-recursion" version = "1.0.5" @@ -1840,21 +1830,6 @@ dependencies = [ "syn 1.0.107", ] -[[package]] -name = "graph-runtime-test" -version = "0.33.0" -dependencies = [ - "graph", - "graph-chain-ethereum", - "graph-core", - "graph-runtime-derive", - "graph-runtime-wasm", - "rand", - "semver", - "test-store", - "wasmtime", -] - [[package]] name = "graph-runtime-wasm" version = "0.33.0" @@ -1987,34 +1962,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "graph-tests" -version = "0.33.0" -dependencies = [ - "anyhow", - "assert-json-diff", - "async-stream", - "futures 0.3.16", - "graph", - "graph-chain-ethereum", - "graph-chain-substreams", - "graph-core", - "graph-graphql", - "graph-node", - "graph-runtime-wasm", - "graph-server-index-node", - "graph-store-postgres", - "graphql-parser", - "hyper", - "secp256k1", - "serde", - "serde_yaml", - "slog", - "termcolor", - "tokio", - "tokio-stream", -] - [[package]] name = "graphql-parser" version = "0.4.0" @@ -4484,26 +4431,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "test-store" -version = "0.33.0" -dependencies = [ - "diesel", - "graph", - "graph-chain-ethereum", - "graph-core", - "graph-graphql", - "graph-node", - "graph-store-postgres", - "graphql-parser", - "hex", - "hex-literal 0.4.1", - "lazy_static", - "pretty_assertions", - "prost-types", - "serde", -] - [[package]] name = "textwrap" version = "0.16.0" diff --git a/fuel-graph-node/Cargo.toml b/fuel-graph-node/Cargo.toml index 1b49e8b..409dd1c 100644 --- a/fuel-graph-node/Cargo.toml +++ b/fuel-graph-node/Cargo.toml @@ -4,12 +4,12 @@ members = [ "chain/*", "graphql", "node", - "runtime/*", + "runtime/derive", + "runtime/wasm", "server/*", - "store/*", + "store/postgres", "substreams/*", "graph", - "tests", ] [workspace.package] diff --git a/fuel-graph-node/Dockerfile b/fuel-graph-node/Dockerfile new file mode 100644 index 0000000..3bcdaa2 --- /dev/null +++ b/fuel-graph-node/Dockerfile @@ -0,0 +1,58 @@ + +FROM rust:bullseye as graph-node-build + +WORKDIR /app + +RUN apt update && apt install -y protobuf-compiler +COPY ./fuel-graph-node /app/fuel-graph-node +RUN cd /app/fuel-graph-node && cargo build --release + +# The graph-node runtime image with only the executable +FROM debian:bullseye-slim as graph-node +ENV RUST_LOG "" +ENV GRAPH_LOG "" +ENV EARLY_LOG_CHUNK_SIZE "" + +ENV postgres_host "" +ENV postgres_user "" +ENV postgres_pass "" +ENV postgres_db "" +ENV postgres_args "sslmode=prefer" +# The full URL to the IPFS node +ENV ipfs "" +# The etherum network(s) to connect to. Set this to a space-separated +# list of the networks where each entry has the form NAME:URL +ENV ethereum "" +# The role the node should have, one of index-node, query-node, or +# combined-node +ENV node_role "combined-node" +# The name of this node +ENV node_id "default" +# The ethereum network polling interval (in milliseconds) +ENV ethereum_polling_interval "" + +# The location of an optional configuration file for graph-node, as +# described in ../docs/config.md +# Using a configuration file is experimental, and the file format may +# change in backwards-incompatible ways +ENV GRAPH_NODE_CONFIG "" + +# Disable core dumps; this is useful for query nodes with large caches. Set +# this to anything to disable coredumps (via 'ulimit -c 0') +ENV disable_core_dumps "" + +# HTTP port +EXPOSE 8000 +# WebSocket port +EXPOSE 8001 +# JSON-RPC port +EXPOSE 8020 +# Indexing status port +EXPOSE 8030 + +RUN apt-get update \ + && apt-get install -y libpq-dev ca-certificates netcat + +COPY --from=graph-node-build /app/fuel-graph-node/target/release/graph-node /app/graph-node + +CMD ["/app/graph-node"] diff --git a/fuel-graph-node/docker/Dockerfile b/fuel-graph-node/docker/Dockerfile index 4deac77..0044c6b 100644 --- a/fuel-graph-node/docker/Dockerfile +++ b/fuel-graph-node/docker/Dockerfile @@ -103,5 +103,5 @@ ADD docker/wait_for docker/start /usr/local/bin/ COPY --from=graph-node-build /usr/local/bin/graph-node /usr/local/bin/graphman /usr/local/bin/ COPY --from=graph-node-build /etc/image-info /etc/image-info COPY --from=envsubst /go/bin/envsubst /usr/local/bin/ -#COPY docker/Dockerfile /Dockerfile +COPY docker/Dockerfile /Dockerfile CMD ["start"] From f50f807649e6b205ebd0c51988e62bb2fe024548 Mon Sep 17 00:00:00 2001 From: Salka1988 Date: Mon, 18 Mar 2024 14:21:47 +0100 Subject: [PATCH 4/4] add fix --- .github/workflows/docker-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index acced7e..cab53a5 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -4,7 +4,6 @@ on: push: branches: - main -# - salka1988/add_ci pull_request: types: [opened, synchronize] release: @@ -19,7 +18,7 @@ jobs: runs-on: buildjet-4vcpu-ubuntu-2204 if: | (github.event_name == 'release' && github.event.action == 'published') || - github.ref == 'refs/heads/main' || github.ref == 'refs/heads/salka1988/add_ci' || github.event_name == 'pull_request' + github.ref == 'refs/heads/main' || github.event_name == 'pull_request' steps: - uses: actions/checkout@v3