-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/135/publishstoragedeals-expired-start…
…_block-accepted
- Loading branch information
Showing
8 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# 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 | ||
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 | ||
``` | ||
|
||
> [!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/), | ||
- 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. | ||
|
||
It requires: | ||
1. Loading the image into the local minikube cluster | ||
```bash | ||
just load-to-minikube | ||
``` | ||
2. Building patched ZombieNet | ||
- 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 [email protected]: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. 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 | ||
``` | ||
## 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. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
################ | ||
##### 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 | ||
|
||
# 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 (not required for ZombieNet) | ||
VOLUME ["/eiger"] | ||
LABEL co.eiger.image.authors="[email protected]" \ | ||
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
command = "polka-storage-node" | ||
image = "polkadotstorage.azurecr.io/parachain-node:0.1.0" | ||
name = "charlie" | ||
validator = true |