-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[node] add tpl to init containers (#333)
* add tpl to init containers * add option to use own chainspec * update README.md * add examples/local-rococo
- Loading branch information
Showing
9 changed files
with
288 additions
and
11 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
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,56 @@ | ||
# Relaychain | ||
## Install relaychain | ||
```shell | ||
helm upgrade --install bootnode . -f examples/local-rococo/bootnode.yaml | ||
kubectl wait --for=condition=Ready pod bootnode-0 --timeout=90s | ||
helm upgrade --install validators . -f examples/local-rococo/validators-alice-bob.yaml | ||
|
||
``` | ||
|
||
## Access to relaychain RPC | ||
```shell | ||
kubectl port-forward bootnode-0 9944:9944 | ||
``` | ||
open: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer | ||
|
||
# Parachain | ||
## Install parachain | ||
```shell | ||
helm upgrade --install parachain . -f examples/local-rococo/asset-hub.yaml | ||
``` | ||
|
||
## Onboard parachain | ||
1. Find the para_id and Genesis state | ||
```shell | ||
kubectl logs --tail 10 -f parachain-node-0 dump-state-and-wasm | ||
# Parachain Id: | ||
# "para_id": 1000, | ||
# Genesis head: | ||
# 0x00000000000000000000000000000000000000000000000000000000000000000061dc4546910e4a874f59af705dd079344ecb7759f526cf86cf21db67473d0b4f03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400 | ||
``` | ||
2. Download genesis-wasm | ||
```shell | ||
kubectl cp parachain-node-0:/chain-data/genesis-wasm genesis-wasm | ||
``` | ||
3. On relaychain RPC submit following call: | ||
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/sudo | ||
```shell | ||
parasSudoWrapper.sudoScheduleParaInitialize(id, genesis) | ||
id = 1000 | ||
genesisHead = 0x00000000000000000000000000000000000000000000000000000000000000000061dc4546910e4a874f59af705dd079344ecb7759f526cf86cf21db67473d0b4f03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400 | ||
validationCode = file upload(genesis-wasm) | ||
paraKind = Yes | ||
``` | ||
4. Check onboarding progress here: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads | ||
|
||
## Access to parachain RPC | ||
```shell | ||
kubectl port-forward parachain-node-0 9945:9944 | ||
``` | ||
open: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9945#/explorer | ||
|
||
## Cleanup | ||
```shell | ||
helm delete bootnode validators parachain | ||
# clean pvc kubectl delete pvc --all | ||
``` |
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 @@ | ||
image: | ||
repository: parity/polkadot-parachain | ||
tag: latest | ||
pullPolicy: Always | ||
|
||
node: | ||
chain: asset-hub-rococo-local | ||
command: polkadot-parachain | ||
role: collator | ||
replicas: 2 | ||
chainData: | ||
pruning: 1000 | ||
storageClass: "" | ||
chainKeystore: | ||
storageClass: "" | ||
keys: | ||
# This is Alice seed | ||
- seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" | ||
type: aura | ||
scheme: sr25519 | ||
# ${HOSTNAME##*-} will be evaluated as the pod index, pod-0: //Alice, pod-1: //Bob | ||
extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' | ||
isParachain: true | ||
collatorRelayChain: | ||
chain: rococo-local | ||
customChainspecUrl: http://bootnode:8080/chainspec.json | ||
forceDownloadChainspec: true | ||
chainData: | ||
storageClass: "" | ||
flags: | ||
- "--allow-private-ipv4" | ||
- "--discover-local" | ||
ingress: | ||
enabled: false | ||
annotations: | ||
kubernetes.io/ingress.class: TODO | ||
external-dns.alpha.kubernetes.io/target: TODO | ||
cert-manager.io/cluster-issuer: TODO | ||
rules: | ||
- host: parachain.example.com | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: parachain-node | ||
port: | ||
number: 9944 | ||
tls: | ||
- secretName: parachain.example.com | ||
hosts: | ||
- parachain.example.com | ||
|
||
extraInitContainers: | ||
- name: dump-state-and-wasm | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: "{{ .Values.image.pullPolicy }}" | ||
command: [ "/bin/bash" ] | ||
args: | ||
- -c | ||
- | | ||
if [ "${HOSTNAME##*-}" = "0" ]; then | ||
echo "Parachain Id:" | ||
{{ .Values.node.command }} build-spec --chain {{ .Values.node.chain }} | grep -E 'para_id|parachainId' | ||
echo "Genesis head:" | ||
{{ .Values.node.command }} export-genesis-state --chain {{ .Values.node.chain }} | ||
echo "" | ||
echo "Genesis wasm (validationCode) stored in /chain-data/genesis-wasm" | ||
{{ .Values.node.command }} export-genesis-wasm --chain {{ .Values.node.chain }} > /chain-data/genesis-wasm | ||
else | ||
echo "Genesis head and wasm are in pod ${HOSTNAME%-*}-0" | ||
fi | ||
volumeMounts: | ||
- mountPath: /chain-data | ||
name: chain-data |
Oops, something went wrong.