diff --git a/.github/workflows/linea-mainnet.yml b/.github/workflows/linea-mainnet.yml new file mode 100644 index 0000000..c4607fc --- /dev/null +++ b/.github/workflows/linea-mainnet.yml @@ -0,0 +1,116 @@ +name: linea-mainnet + +on: + workflow_call: + outputs: + workflow_run_id: + description: "the run id of the workflow" + value: ${{ jobs.build.outputs.workflow_run_id }} + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + build: + runs-on: ubuntu-latest + environment: build + outputs: + workflow_run_id: ${{ steps.workflow_details.outputs.id }} + steps: + + - name: checkout + uses: actions/checkout@v4 + + - name: get workflow_details + id: workflow_details + run: echo "id=${{ github.run_id }}" >> $GITHUB_OUTPUT + + - name: get versions via dotenv + id: dotenv + uses: falti/dotenv-action@v1 + with: + path: versions/linea-mainnet.env + mode: development + keys-case: lower + log-variables: true + load-mode: strict + + - name: set docker tag + id: dockertag + run: | + if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref_type }}" == "tag" ]; then + echo "IMAGE=mainnet-${{ github.ref_name }}" >> $GITHUB_OUTPUT + else + echo "IMAGE=mainnet-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + fi + + - name: download and untar the linea-besu archive + run: | + cd /tmp/ + echo "downloading linea-besu: ${{ steps.dotenv.outputs.LINEA_BESU_TAR_GZ }}" + wget -nv "https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/${{ steps.dotenv.outputs.LINEA_BESU_TAR_GZ }}/linea-besu-${{ steps.dotenv.outputs.LINEA_BESU_TAR_GZ }}.tar.gz" + tar -xvf linea-besu-${{ steps.dotenv.outputs.LINEA_BESU_TAR_GZ }}.tar.gz + mv /tmp/linea-besu-${{ steps.dotenv.outputs.LINEA_BESU_TAR_GZ }} /tmp/besu + + - name: copy the list of versions to the container + run: | + cp ./versions/linea-mainnet.env /tmp/besu/versions.txt + mkdir -p /tmp/besu/plugins + + - name: get the plugins + run: | + cd /tmp/besu/plugins + + echo "getting linea_sequencer_plugin_version: ${{ steps.dotenv.outputs.LINEA_SEQUENCER_PLUGIN_VERSION }}" + wget -nv "https://github.com/Consensys/linea-sequencer/releases/download/v${{ steps.dotenv.outputs.LINEA_SEQUENCER_PLUGIN_VERSION }}/besu-sequencer-plugins-v${{ steps.dotenv.outputs.LINEA_SEQUENCER_PLUGIN_VERSION }}.jar" -P /tmp/besu/plugins + + echo "getting finalized_tag_updater_plugin_version: ${{ steps.dotenv.outputs.FINALIZED_TAG_UPDATER_PLUGIN_VERSION }}" + wget -nv "https://github.com/Consensys/linea-monorepo/releases/download/finalized-tag-updater-v${{ steps.dotenv.outputs.FINALIZED_TAG_UPDATER_PLUGIN_VERSION }}/finalized-tag-updater-v${{ steps.dotenv.outputs.FINALIZED_TAG_UPDATER_PLUGIN_VERSION }}.jar" -P /tmp/besu/plugins + + echo "getting linea_tracer_plugin_version: ${{ steps.dotenv.outputs.LINEA_TRACER_PLUGIN_VERSION }}" + wget -nv "https://github.com/Consensys/linea-tracer/releases/download/v${{ steps.dotenv.outputs.LINEA_TRACER_PLUGIN_VERSION }}/linea-tracer-v${{ steps.dotenv.outputs.LINEA_TRACER_PLUGIN_VERSION }}.jar" -P /tmp/besu/plugins + + echo "getting shomei_plugin_version: ${{ steps.dotenv.outputs.SHOMEI_PLUGIN_VERSION }}" + wget -nv "https://github.com/Consensys/besu-shomei-plugin/releases/download/v${{ steps.dotenv.outputs.SHOMEI_PLUGIN_VERSION }}/besu-shomei-plugin-v${{ steps.dotenv.outputs.SHOMEI_PLUGIN_VERSION }}.jar" -P /tmp/besu/plugins + + - name: piece the package together to build the docker images + run: | + cd linea-besu + mv /tmp/besu ./ + mv config/ genesis/ profiles/ besu/ + tree . + + # - name: set up docker buildx + # uses: docker/setup-buildx-action@v3 + + # - name: login to docker + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKER_USER_RW }} + # password: ${{ secrets.DOCKER_PASSWORD_RW }} + + # - name: set docker build args + # run: | + # echo "BUILD_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} + # echo "Building image tag: ${{ steps.dockertag.outputs.IMAGE }}" + + # - name: build and push the combined manifest + # uses: docker/build-push-action@v6 + # env: + # DOCKER_BUILD_SUMMARY: false + # with: + # context: besu-fleet/. + # platforms: linux/arm64,linux/amd64 + # provenance: false + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + # build-args: | + # VERSION=${{ steps.dockertag.outputs.IMAGE }} + # VCS_REF=${{ github.sha }} + # BUILD_DATE=${{ env.BUILD_DATE }} + # push: true + # tags: | + # consensys/linea-besu-package:${{ steps.dockertag.outputs.IMAGE }} + diff --git a/linea-besu/Dockerfile b/linea-besu/Dockerfile new file mode 100644 index 0000000..a4e950a --- /dev/null +++ b/linea-besu/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:24.04 +ARG VERSION="dev" +ENV NO_PROXY_CACHE="-o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0" + +# Update and install dependencies without using any cache +RUN apt-get update $NO_PROXY_CACHE && \ + # $NO_PROXY_CACHE must not be used here or otherwise will trigger a hadolint error + apt-get -o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0 \ + --no-install-recommends -q --assume-yes install openjdk-21-jre-headless=21* libjemalloc-dev=5.* adduser=3* && \ + # Clean apt cache + apt-get clean && \ + rm -rf /var/cache/apt/archives/* /var/cache/apt/archives/partial/* && \ + rm -rf /var/lib/apt/lists/* && \ + # Starting from version 23.10, Ubuntu comes with an "ubuntu" user with uid 1000. We need 1000 for besu. + userdel ubuntu 2>/dev/null || true && rm -rf /home/ubuntu && \ + # Ensure we use a stable UID for besu, as file permissions are tied to UIDs. + adduser --uid 1000 --disabled-password --gecos "" --home /opt/besu besu && \ + chown besu:besu /opt/besu && \ + chmod 0755 /opt/besu && \ + # Create /data folder and set permissions + mkdir /data && \ + chown besu:besu /data && \ + chmod 0755 /data + +USER besu +WORKDIR /opt/besu + +COPY --chown=besu:besu besu /opt/besu/ + +# Expose services ports +# 8545 HTTP JSON-RPC +# 8546 WS JSON-RPC +# 8547 HTTP GraphQL +# 8550 HTTP ENGINE JSON-RPC +# 8551 WS ENGINE JSON-RPC +# 30303 P2P +EXPOSE 8545 8546 8547 8550 8551 30303 + +# defaults for host interfaces +ENV BESU_RPC_HTTP_HOST 0.0.0.0 +ENV BESU_RPC_WS_HOST 0.0.0.0 +ENV BESU_GRAPHQL_HTTP_HOST 0.0.0.0 +ENV BESU_PID_PATH "/tmp/pid" + +ENV OTEL_RESOURCE_ATTRIBUTES="service.name=besu,service.version=$VERSION" + +ENV OLDPATH="${PATH}" +ENV PATH="/opt/besu/bin:${OLDPATH}" + +ENTRYPOINT ["besu"] +HEALTHCHECK --start-period=5s --interval=5s --timeout=1s --retries=10 CMD bash -c "[ -f /tmp/pid ]" + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG VCS_REF +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="Besu" \ + org.label-schema.description="Enterprise Ethereum client" \ + org.label-schema.url="https://besu.hyperledger.org/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/hyperledger/besu.git" \ + org.label-schema.vendor="Hyperledger" \ + org.label-schema.version=$VERSION \ + org.label-schema.schema-version="1.0" diff --git a/versions/linea-devnet.env b/versions/linea-devnet.env new file mode 100644 index 0000000..ed80c9d --- /dev/null +++ b/versions/linea-devnet.env @@ -0,0 +1,5 @@ +LINEA_BESU_TAR_GZ=24.10-delivery34 +LINEA_SEQUENCER_PLUGIN_VERSION=0.8.0-rc4.1 +LINEA_TRACER_PLUGIN_VERSION=0.6.0-rc8 +FINALIZED_TAG_UPDATER_PLUGIN_VERSION=0.0.2 +SHOMEI_PLUGIN_VERSION=0.3.1 diff --git a/versions/linea-mainnet.env b/versions/linea-mainnet.env new file mode 100644 index 0000000..4aebfb2 --- /dev/null +++ b/versions/linea-mainnet.env @@ -0,0 +1,5 @@ +LINEA_BESU_TAR_GZ=24.10-delivery34 +LINEA_SEQUENCER_PLUGIN_VERSION=0.1.4-test35 +LINEA_TRACER_PLUGIN_VERSION=0.6.0-rc8 +FINALIZED_TAG_UPDATER_PLUGIN_VERSION=0.0.2 +SHOMEI_PLUGIN_VERSION=0.3.1 diff --git a/versions/linea-sepolia.env b/versions/linea-sepolia.env new file mode 100644 index 0000000..3578363 --- /dev/null +++ b/versions/linea-sepolia.env @@ -0,0 +1,5 @@ +LINEA_BESU_TAR_GZ=24.10-delivery34 +LINEA_SEQUENCER_PLUGIN_VERSION=0.8.0-rc4.1 +LINEA_TRACER_PLUGIN_VERSION=0.6.0-rc8 +FINALIZED_TAG_UPDATER_PLUGIN_VERSION=0.0.1 +SHOMEI_PLUGIN_VERSION=0.3.1