From b14f3477d92619e451270d95644e70aca4e39b91 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Mon, 8 Jul 2024 15:19:41 +0000 Subject: [PATCH 01/13] build(runtime): add dockerfile for the parachain --- PARACHAIN.md | 16 ++++++ docker/dockerfiles/parachain/Dockerfile | 71 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 PARACHAIN.md create mode 100644 docker/dockerfiles/parachain/Dockerfile diff --git a/PARACHAIN.md b/PARACHAIN.md new file mode 100644 index 000000000..b6af9c7ae --- /dev/null +++ b/PARACHAIN.md @@ -0,0 +1,16 @@ +# Polka Storage Node - Parachain + +## Build the Docker Image + +```bash +docker build \ + --build-arg VCS_REF=$(git rev-parse HEAD) \ + --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + -t eiger/polka-storage-node \ + --file ./docker/dockerfiles/parachain/Dockerfile \ + . +``` + +The command builds a Docker image `eiger/polka-storage-node` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. + +## Running the Parachain \ No newline at end of file diff --git a/docker/dockerfiles/parachain/Dockerfile b/docker/dockerfiles/parachain/Dockerfile new file mode 100644 index 000000000..447202f32 --- /dev/null +++ b/docker/dockerfiles/parachain/Dockerfile @@ -0,0 +1,71 @@ +################ +##### Chef +FROM rust:1.77 AS chef +RUN cargo install cargo-chef +WORKDIR /app + +################ +##### Planer +FROM chef AS planner +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +################ +##### Builder +FROM chef AS builder + +RUN apt update && apt upgrade -y +RUN apt install -y protobuf-compiler +RUN apt install -y clang + +# Copy required files +COPY --from=planner /app/recipe.json recipe.json +COPY --from=planner /app/rust-toolchain.toml rust-toolchain.toml +# Build dependencies - this is the caching Docker layer! +RUN cargo chef cook --release --recipe-path recipe.json +# Build application +COPY . . +RUN cargo build --release -p polka-storage-node + +FROM debian:bookworm-slim AS runtime + +ARG VCS_REF +ARG BUILD_DATE + +LABEL co.eiger.image.authors="releases@eiger.co" \ + co.eiger.image.vendor="Eiger" \ + co.eiger.image.title="Polka Storage Parachain" \ + co.eiger.image.description="Parachain Node binary for Polka Storage, without specs. For local ZombieNet usage only." \ + co.eiger.image.source="https://github.com/eigerco/polka-storage/blob/${VCS_REF}/docker/dockerfiles/parachain/Dockerfile" \ + co.eiger.image.revision="${VCS_REF}" \ + co.eiger.image.created="${BUILD_DATE}" \ + co.eiger.image.documentation="https://github.com/eigerco/polka-storage" + +# show backtraces +ENV RUST_BACKTRACE=1 + +USER root + +COPY --from=builder /app/target/release/polka-storage-node /usr/local/bin +RUN chmod -R a+rx "/usr/local/bin" + +RUN useradd -m -u 1000 -U -s /bin/sh -d /eiger eiger +USER eiger +# check if executable works in this container +RUN /usr/local/bin/polka-storage-node --version + +# 30333 for parachain p2p +# 30334 for relaychain p2p +# 9933 for RPC port +# 9944 for Websocket +# 9615 for Prometheus (metrics) + +EXPOSE 30333 30334 9933 9944 9615 +# mount-point for saving state of the parachain +VOLUME ["/eiger"] +ENTRYPOINT ["/usr/local/bin/polka-storage-node"] + +# TODO: +# - try to run this stand-alone +# - add script to build this image/just build +# - configure ombienet \ No newline at end of file From df34fe87ca364407e6c8722d045195bb6cbf87b4 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Wed, 10 Jul 2024 14:38:54 +0000 Subject: [PATCH 02/13] build: add minikube testnet --- Justfile | 16 ++++++++++++++++ PARACHAIN.md | 4 +++- zombienet/local-kube-testnet.toml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 zombienet/local-kube-testnet.toml diff --git a/Justfile b/Justfile index 92746e099..f8f8ae8b4 100644 --- a/Justfile +++ b/Justfile @@ -15,6 +15,22 @@ release: lint testnet: release zombienet -p native spawn zombienet/local-testnet.toml +build-parachain-docker: + docker build \ + --build-arg VCS_REF=$(git rev-parse HEAD) \ + --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + -t ghcr.io/eigerco/polka-storage-node:0.1.0 \ + --file ./docker/dockerfiles/parachain/Dockerfile \ + . + +load-to-minikube: + # https://github.com/paritytech/zombienet/pull/1830 + # untill this is merged and we pull it in, launching it in local zombienet (without publishing the docker image is impossible) + minikube image load ghcr.io/eigerco/polka-storage-node:0.1.0 + +kube-testnet: + ~/workspace/zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml + # Must be in sync with .vscode/settings.json and have extension Coverage Gutters to display it in VS Code. market-coverage: mkdir -p coverage diff --git a/PARACHAIN.md b/PARACHAIN.md index b6af9c7ae..b49ca2706 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -13,4 +13,6 @@ docker build \ The command builds a Docker image `eiger/polka-storage-node` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. -## Running the Parachain \ No newline at end of file +## Running the Parachain + +`just podman-testnet` \ No newline at end of file diff --git a/zombienet/local-kube-testnet.toml b/zombienet/local-kube-testnet.toml new file mode 100644 index 000000000..34817fa25 --- /dev/null +++ b/zombienet/local-kube-testnet.toml @@ -0,0 +1,31 @@ +[settings] +image_pull_policy = "IfNotPresent" + +[relaychain] +chain = "rococo-local" +default_args = ["--detailed-log-output", "-lparachain=debug,xcm=trace,runtime=trace"] +default_image = "docker.io/parity/polkadot:latest" + +[[relaychain.nodes]] +name = "alice" +validator = true + +[[relaychain.nodes]] +name = "bob" +validator = true + +[[parachains]] +cumulus_based = true + +# We need to use a Parachain of an existing System Chain (https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/rococo/src/xcm_config.rs). +# The reason: being able to get native DOTs from Relay Chain to Parachain via XCM Teleport. +# We'll have a proper Parachain ID in the *future*, but for now, let's stick to 1000 (which is AssetHub and trusted). +id = 1000 + +# run charlie as parachain collator +[[parachains.collators]] +args = ["--detailed-log-output", "-lparachain=debug,xcm=trace,runtime=trace"] +image = "ghcr.io/eigerco/polka-storage-node:0.1.0" +command = "polka-storage-node" +name = "charlie" +validator = true From 7152be091e1ffa247ddfc56f070b46add4b06e51 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Thu, 11 Jul 2024 14:42:21 +0000 Subject: [PATCH 03/13] docs(Dockerfile): add docs for parachain --- Justfile | 2 +- PARACHAIN.md | 42 ++++++++++++++++++++----- docker/dockerfiles/parachain/Dockerfile | 7 +---- zombienet/local-kube-testnet.toml | 2 +- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Justfile b/Justfile index f8f8ae8b4..feb0e514b 100644 --- a/Justfile +++ b/Justfile @@ -29,7 +29,7 @@ load-to-minikube: minikube image load ghcr.io/eigerco/polka-storage-node:0.1.0 kube-testnet: - ~/workspace/zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml + zombienet -p kubernetes spawn zombienet/local-kube-testnet.toml # Must be in sync with .vscode/settings.json and have extension Coverage Gutters to display it in VS Code. market-coverage: diff --git a/PARACHAIN.md b/PARACHAIN.md index b49ca2706..65945987d 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -3,16 +3,42 @@ ## Build the Docker Image ```bash -docker build \ - --build-arg VCS_REF=$(git rev-parse HEAD) \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - -t eiger/polka-storage-node \ - --file ./docker/dockerfiles/parachain/Dockerfile \ - . +just build-parachain-docker ``` -The command builds a Docker image `eiger/polka-storage-node` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. +The command builds a Docker image `ghcr.io/eiger/polka-storage-node:0.1.0` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. ## Running the Parachain -`just podman-testnet` \ No newline at end of file +Prerequisites: +- Kubernetes Cluster access - configured kubectl, e.g. [minikube](https://minikube.sigs.k8s.io/docs/start/) + + +Ideally, when the docker image `ghcr.io/eiger/polka-storage-node:0.1.0` is released publically, it'd work: + +```bash +just kube-testnet +``` +It launches zombienet from scratch based on `./zombienet/local-kube-testnet.toml` configuration. + +### Workaround + +However, given that ZombieNet [does not support private Docker registries](https://github.com/paritytech/zombienet/issues/1829) we need to do some trickery to test it out in Kubernetes. + +It requires: +1. loading the image into the local minikube cluster +```bash +just load-to-minikube +``` +2. building patched ZombieNet + - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) + - building it locally +```bash + cd zombienet/javascript + npm i && npm run build + npm run package +``` +3. running patched ZombieNet +```bash + $ZOMBIENET_REPO/javascript/bins/zombienet -p kubernetes spawn zombienet/local-kube-testnet.toml +``` diff --git a/docker/dockerfiles/parachain/Dockerfile b/docker/dockerfiles/parachain/Dockerfile index 447202f32..414f71448 100644 --- a/docker/dockerfiles/parachain/Dockerfile +++ b/docker/dockerfiles/parachain/Dockerfile @@ -61,11 +61,6 @@ RUN /usr/local/bin/polka-storage-node --version # 9615 for Prometheus (metrics) EXPOSE 30333 30334 9933 9944 9615 -# mount-point for saving state of the parachain +# mount-point for saving state of the parachain (not required for ZombieNet) VOLUME ["/eiger"] ENTRYPOINT ["/usr/local/bin/polka-storage-node"] - -# TODO: -# - try to run this stand-alone -# - add script to build this image/just build -# - configure ombienet \ No newline at end of file diff --git a/zombienet/local-kube-testnet.toml b/zombienet/local-kube-testnet.toml index 34817fa25..8ceb585af 100644 --- a/zombienet/local-kube-testnet.toml +++ b/zombienet/local-kube-testnet.toml @@ -25,7 +25,7 @@ id = 1000 # run charlie as parachain collator [[parachains.collators]] args = ["--detailed-log-output", "-lparachain=debug,xcm=trace,runtime=trace"] -image = "ghcr.io/eigerco/polka-storage-node:0.1.0" command = "polka-storage-node" +image = "ghcr.io/eigerco/polka-storage-node:0.1.0" name = "charlie" validator = true From 1b232aa325685ce91332021d553cba4debdd1499 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Fri, 12 Jul 2024 11:20:40 +0000 Subject: [PATCH 04/13] build(Dockerfile): move labels to the end of the Dockerfile --- docker/dockerfiles/parachain/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/dockerfiles/parachain/Dockerfile b/docker/dockerfiles/parachain/Dockerfile index 414f71448..ef9cfad69 100644 --- a/docker/dockerfiles/parachain/Dockerfile +++ b/docker/dockerfiles/parachain/Dockerfile @@ -32,15 +32,6 @@ FROM debian:bookworm-slim AS runtime ARG VCS_REF ARG BUILD_DATE -LABEL co.eiger.image.authors="releases@eiger.co" \ - co.eiger.image.vendor="Eiger" \ - co.eiger.image.title="Polka Storage Parachain" \ - co.eiger.image.description="Parachain Node binary for Polka Storage, without specs. For local ZombieNet usage only." \ - co.eiger.image.source="https://github.com/eigerco/polka-storage/blob/${VCS_REF}/docker/dockerfiles/parachain/Dockerfile" \ - co.eiger.image.revision="${VCS_REF}" \ - co.eiger.image.created="${BUILD_DATE}" \ - co.eiger.image.documentation="https://github.com/eigerco/polka-storage" - # show backtraces ENV RUST_BACKTRACE=1 @@ -63,4 +54,13 @@ RUN /usr/local/bin/polka-storage-node --version EXPOSE 30333 30334 9933 9944 9615 # mount-point for saving state of the parachain (not required for ZombieNet) VOLUME ["/eiger"] +LABEL co.eiger.image.authors="releases@eiger.co" \ + co.eiger.image.vendor="Eiger" \ + co.eiger.image.title="Polka Storage Parachain" \ + co.eiger.image.description="Parachain Node binary for Polka Storage, without specs. For local ZombieNet usage only." \ + co.eiger.image.source="https://github.com/eigerco/polka-storage/blob/${VCS_REF}/docker/dockerfiles/parachain/Dockerfile" \ + co.eiger.image.revision="${VCS_REF}" \ + co.eiger.image.created="${BUILD_DATE}" \ + co.eiger.image.documentation="https://github.com/eigerco/polka-storage" + ENTRYPOINT ["/usr/local/bin/polka-storage-node"] From d0b430fc0a861624f25a33128753ae6df645f6ca Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Fri, 12 Jul 2024 11:21:27 +0000 Subject: [PATCH 05/13] docs(Justfile): remove typo from load-to-minikube --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index feb0e514b..f5ea0384b 100644 --- a/Justfile +++ b/Justfile @@ -25,7 +25,7 @@ build-parachain-docker: load-to-minikube: # https://github.com/paritytech/zombienet/pull/1830 - # untill this is merged and we pull it in, launching it in local zombienet (without publishing the docker image is impossible) + # unless this is merged and we pull it in, launching it in local zombienet (without publishing the docker image is impossible) minikube image load ghcr.io/eigerco/polka-storage-node:0.1.0 kube-testnet: From 2065c311ba208c1637b471ca564e0788a4405ce9 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Fri, 12 Jul 2024 11:53:54 +0000 Subject: [PATCH 06/13] docs(runtime): improve parachain instructions for fixed zombienet --- PARACHAIN.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/PARACHAIN.md b/PARACHAIN.md index 65945987d..73e14e536 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -31,14 +31,15 @@ It requires: just load-to-minikube ``` 2. building patched ZombieNet - - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) - - building it locally + - requires NodeJS: preferably via [nvm](https://nodejs.org/en/download/package-manager) + - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) and building it locally ```bash - cd zombienet/javascript + git clone -b th7nder/fix/generating-containers git@github.com:th7nder/zombienet.git ~/patched-zombienet + cd ~/patched-zombienet/javascript npm i && npm run build npm run package ``` -3. running patched ZombieNet +3. running patched ZombieNet (inside of `polka-storage` workspace) ```bash - $ZOMBIENET_REPO/javascript/bins/zombienet -p kubernetes spawn zombienet/local-kube-testnet.toml + ~/patched-zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml ``` From c017c6463f598d48bab435b83b698d6df4bd382f Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Fri, 12 Jul 2024 17:21:59 +0000 Subject: [PATCH 07/13] docs(Dockerfile): improve PARACHAIN.md docs by adding supported platforms and some disclaimers --- Justfile | 4 ++-- PARACHAIN.md | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Justfile b/Justfile index f5ea0384b..214f750e4 100644 --- a/Justfile +++ b/Justfile @@ -17,8 +17,8 @@ testnet: release build-parachain-docker: docker build \ - --build-arg VCS_REF=$(git rev-parse HEAD) \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + --build-arg VCS_REF="$(git rev-parse HEAD)" \ + --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ -t ghcr.io/eigerco/polka-storage-node:0.1.0 \ --file ./docker/dockerfiles/parachain/Dockerfile \ . diff --git a/PARACHAIN.md b/PARACHAIN.md index 73e14e536..4127659e7 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -1,5 +1,10 @@ # Polka Storage Node - Parachain +Supported Kubernetes Platforms: +- Linux x86_64 + +Others were not tested and `polkadot` does not have an image for Linux ARM. + ## Build the Docker Image ```bash @@ -33,13 +38,14 @@ just load-to-minikube 2. building patched ZombieNet - requires NodeJS: preferably via [nvm](https://nodejs.org/en/download/package-manager) - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) and building it locally -```bash - git clone -b th7nder/fix/generating-containers git@github.com:th7nder/zombienet.git ~/patched-zombienet - cd ~/patched-zombienet/javascript - npm i && npm run build - npm run package -``` + ```bash + git clone -b th7nder/fix/generating-containers git@github.com:th7nder/zombienet.git patched-zombienet + cd patched-zombienet/javascript + npm i && npm run build + npm run package + ``` + - NOTE: warnings like `> Warning Failed to make bytecode node18-arm64 for file` are normal and don't break the build. 3. running patched ZombieNet (inside of `polka-storage` workspace) ```bash - ~/patched-zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml +patched-zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml ``` From e036f982384db3057199e9b4f020cc3a1b79d3da Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Sat, 13 Jul 2024 08:07:34 +0000 Subject: [PATCH 08/13] docs(Dockerfile): remove workarounds for ZombieNet --- PARACHAIN.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/PARACHAIN.md b/PARACHAIN.md index 4127659e7..c3236191e 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -16,26 +16,17 @@ The command builds a Docker image `ghcr.io/eiger/polka-storage-node:0.1.0` from ## Running the Parachain Prerequisites: -- Kubernetes Cluster access - configured kubectl, e.g. [minikube](https://minikube.sigs.k8s.io/docs/start/) +- Kubernetes Cluster access - configured [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), e.g. [minikube](https://minikube.sigs.k8s.io/docs/start/) - -Ideally, when the docker image `ghcr.io/eiger/polka-storage-node:0.1.0` is released publically, it'd work: - -```bash -just kube-testnet -``` -It launches zombienet from scratch based on `./zombienet/local-kube-testnet.toml` configuration. - -### Workaround - -However, given that ZombieNet [does not support private Docker registries](https://github.com/paritytech/zombienet/issues/1829) we need to do some trickery to test it out in Kubernetes. +The configuration is stored in `./zombienet/local-kube-testnet.toml`. +ZombieNet [does not support private Docker registries](https://github.com/paritytech/zombienet/issues/1829) we need to do some trickery to test it out in Kubernetes. It requires: -1. loading the image into the local minikube cluster +1. Loading the image into the local minikube cluster ```bash just load-to-minikube ``` -2. building patched ZombieNet +2. Building patched ZombieNet - requires NodeJS: preferably via [nvm](https://nodejs.org/en/download/package-manager) - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) and building it locally ```bash @@ -45,7 +36,7 @@ just load-to-minikube npm run package ``` - NOTE: warnings like `> Warning Failed to make bytecode node18-arm64 for file` are normal and don't break the build. -3. running patched ZombieNet (inside of `polka-storage` workspace) +3. Finally running patched ZombieNet (inside of `polka-storage` workspace) ```bash patched-zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml ``` From 26b2c2d222d30218cc03d265424e5f6de9ee311b Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Mon, 15 Jul 2024 08:51:44 +0000 Subject: [PATCH 09/13] build(Dockerfile): change image tag to azure container registry --- Justfile | 4 ++-- PARACHAIN.md | 2 +- zombienet/local-kube-testnet.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Justfile b/Justfile index 214f750e4..8df09e535 100644 --- a/Justfile +++ b/Justfile @@ -19,14 +19,14 @@ build-parachain-docker: docker build \ --build-arg VCS_REF="$(git rev-parse HEAD)" \ --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - -t ghcr.io/eigerco/polka-storage-node:0.1.0 \ + -t polkadotstorage.azurecr.io/parachain-node:0.1.0 \ --file ./docker/dockerfiles/parachain/Dockerfile \ . load-to-minikube: # https://github.com/paritytech/zombienet/pull/1830 # unless this is merged and we pull it in, launching it in local zombienet (without publishing the docker image is impossible) - minikube image load ghcr.io/eigerco/polka-storage-node:0.1.0 + minikube image load polkadotstorage.azurecr.io/parachain-node:0.1.0 kube-testnet: zombienet -p kubernetes spawn zombienet/local-kube-testnet.toml diff --git a/PARACHAIN.md b/PARACHAIN.md index c3236191e..af77fc0cd 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -11,7 +11,7 @@ Others were not tested and `polkadot` does not have an image for Linux ARM. just build-parachain-docker ``` -The command builds a Docker image `ghcr.io/eiger/polka-storage-node:0.1.0` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. +The command builds a Docker image `polkadotstorage.azurecr.io/parachain-node:0.1.0` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. ## Running the Parachain diff --git a/zombienet/local-kube-testnet.toml b/zombienet/local-kube-testnet.toml index 8ceb585af..3c02e8576 100644 --- a/zombienet/local-kube-testnet.toml +++ b/zombienet/local-kube-testnet.toml @@ -26,6 +26,6 @@ id = 1000 [[parachains.collators]] args = ["--detailed-log-output", "-lparachain=debug,xcm=trace,runtime=trace"] command = "polka-storage-node" -image = "ghcr.io/eigerco/polka-storage-node:0.1.0" +image = "polkadotstorage.azurecr.io/parachain-node:0.1.0" name = "charlie" validator = true From 875d9fdd16106c5412736fcc13edfeb2ef146680 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Mon, 15 Jul 2024 10:58:00 +0000 Subject: [PATCH 10/13] docs(Dockerfile): add Azure authentication --- Justfile | 2 +- PARACHAIN.md | 23 +++++++++++++++++++++-- flake.nix | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Justfile b/Justfile index 8df09e535..5a0adc3a9 100644 --- a/Justfile +++ b/Justfile @@ -25,7 +25,7 @@ build-parachain-docker: load-to-minikube: # https://github.com/paritytech/zombienet/pull/1830 - # unless this is merged and we pull it in, launching it in local zombienet (without publishing the docker image is impossible) + # unless this is merged and we pull it in, launching it in local zombienet (without publicly publishing the docker image is impossible) minikube image load polkadotstorage.azurecr.io/parachain-node:0.1.0 kube-testnet: diff --git a/PARACHAIN.md b/PARACHAIN.md index af77fc0cd..8fe30954a 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -13,10 +13,29 @@ just build-parachain-docker The command builds a Docker image `polkadotstorage.azurecr.io/parachain-node:0.1.0` from a Dockerfile located at `./docker/dockerfiles/parachain/Dockerfile`. +## Authenticating and Authorizing to Azure Container Registry + +```bash +az login --use-device-code --tenant dareneiger.onmicrosoft.com +az acr login --name polkadotstorage.azurecr.io +``` + +> [!NOTE] +> Azure Container Registry token expires after 3 hours. + +## Pulling the image from registry + +Use this option if you don't want to build locally. + +```bash +docker pull polkadotstorage.azurecr.io/parachain-node:0.1.0 +``` + ## Running the Parachain Prerequisites: -- Kubernetes Cluster access - configured [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), e.g. [minikube](https://minikube.sigs.k8s.io/docs/start/) +- Kubernetes Cluster access - configured [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), e.g. [minikube](https://minikube.sigs.k8s.io/docs/start/), +- If using `minikube`, a started minikube cluster (`minikube start`). The configuration is stored in `./zombienet/local-kube-testnet.toml`. ZombieNet [does not support private Docker registries](https://github.com/paritytech/zombienet/issues/1829) we need to do some trickery to test it out in Kubernetes. @@ -27,7 +46,7 @@ It requires: just load-to-minikube ``` 2. Building patched ZombieNet - - requires NodeJS: preferably via [nvm](https://nodejs.org/en/download/package-manager) + - requires NodeJS (LTS v20): preferably via [nvm](https://nodejs.org/en/download/package-manager) - pulling a branch of [ZombieNet](https://github.com/paritytech/zombienet/pull/1830) and building it locally ```bash git clone -b th7nder/fix/generating-containers git@github.com:th7nder/zombienet.git patched-zombienet diff --git a/flake.nix b/flake.nix index 1a46ef785..7985c2460 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,8 @@ }; rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; buildInputs = with pkgs; [ + # Building Docker images and publishing to Azure Container Registry + azure-cli cargo-llvm-cov clang pkg-config From 8777b84913b0e5d278c3d745de8baaa7e0ac42e6 Mon Sep 17 00:00:00 2001 From: Konrad Stepniak Date: Tue, 16 Jul 2024 08:25:52 +0000 Subject: [PATCH 11/13] docs(Dockerfile): simplify parachain azure login --- PARACHAIN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PARACHAIN.md b/PARACHAIN.md index 8fe30954a..7a79c059e 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -17,7 +17,7 @@ The command builds a Docker image `polkadotstorage.azurecr.io/parachain-node:0.1 ```bash az login --use-device-code --tenant dareneiger.onmicrosoft.com -az acr login --name polkadotstorage.azurecr.io +az acr login --name polkadotstorage ``` > [!NOTE] From 4b547a72632832074e322655f15ca7c7545be940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Mon, 15 Jul 2024 10:42:46 +0000 Subject: [PATCH 12/13] fix(polka-storage-provider): re-org around mod.rs --- cli/polka-storage-provider/src/{commands.rs => commands/mod.rs} | 0 cli/polka-storage-provider/src/rpc/{methods.rs => methods/mod.rs} | 0 cli/polka-storage-provider/src/{rpc.rs => rpc/mod.rs} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename cli/polka-storage-provider/src/{commands.rs => commands/mod.rs} (100%) rename cli/polka-storage-provider/src/rpc/{methods.rs => methods/mod.rs} (100%) rename cli/polka-storage-provider/src/{rpc.rs => rpc/mod.rs} (100%) diff --git a/cli/polka-storage-provider/src/commands.rs b/cli/polka-storage-provider/src/commands/mod.rs similarity index 100% rename from cli/polka-storage-provider/src/commands.rs rename to cli/polka-storage-provider/src/commands/mod.rs diff --git a/cli/polka-storage-provider/src/rpc/methods.rs b/cli/polka-storage-provider/src/rpc/methods/mod.rs similarity index 100% rename from cli/polka-storage-provider/src/rpc/methods.rs rename to cli/polka-storage-provider/src/rpc/methods/mod.rs diff --git a/cli/polka-storage-provider/src/rpc.rs b/cli/polka-storage-provider/src/rpc/mod.rs similarity index 100% rename from cli/polka-storage-provider/src/rpc.rs rename to cli/polka-storage-provider/src/rpc/mod.rs From acf8cf41fb66ddc0b1479ce601da2cbba69200b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Tue, 16 Jul 2024 17:14:47 +0000 Subject: [PATCH 13/13] docs: add nodes on Zombienet structure --- PARACHAIN.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PARACHAIN.md b/PARACHAIN.md index 7a79c059e..1b1c38e09 100644 --- a/PARACHAIN.md +++ b/PARACHAIN.md @@ -59,3 +59,18 @@ just load-to-minikube ```bash patched-zombienet/javascript/bins/zombienet-linux-x64 -p kubernetes spawn zombienet/local-kube-testnet.toml ``` + +## Zombienet Structure + +The previous setup leaves us with 3 nodes: +* Alice +* Bob +* Charlie + +The first two (Alice and Bob) will be running Polkadot relay chain nodes, as such, +you won't have access to the parachain extrinsics when calling them. + +Charlie however, is running a parachain node, and as such, he will be your contact point to the parachain. + +> Check you Kubernetes cluster status by using `kubectl get pods --all-namespaces`. +> It should show all pods from all namespaces along with their status.