From 5784cab1715650efc0f6ef12a21d81096275422e Mon Sep 17 00:00:00 2001 From: Simon-Tl Date: Mon, 25 Dec 2023 10:06:12 +0800 Subject: [PATCH 1/4] chore: add axon deployment for kubernetes --- devtools/chain/k8s/README.md | 90 +++++++++++++ devtools/chain/k8s/multiple/axon-chain.yml | 16 +++ devtools/chain/k8s/multiple/axon-ws.yml | 16 +++ .../chain/k8s/multiple/axon1-statefulset.yml | 123 ++++++++++++++++++ .../chain/k8s/multiple/axon2-statefulset.yml | 123 ++++++++++++++++++ .../chain/k8s/multiple/axon3-statefulset.yml | 123 ++++++++++++++++++ .../chain/k8s/multiple/axon4-statefulset.yml | 123 ++++++++++++++++++ devtools/chain/k8s/multiple/chain-spec.toml | 101 ++++++++++++++ .../chain/k8s/multiple/default.db-options | 23 ++++ .../k8s/{ => multiple/key}/node_1_bls.key | Bin .../k8s/{ => multiple/key}/node_1_net.key | 0 .../k8s/{ => multiple/key}/node_2_bls.key | 0 .../k8s/{ => multiple/key}/node_2_net.key | 0 .../k8s/{ => multiple/key}/node_3_bls.key | 0 .../k8s/{ => multiple/key}/node_3_net.key | 0 .../k8s/{ => multiple/key}/node_4_bls.key | 0 .../k8s/{ => multiple/key}/node_4_net.key | 0 devtools/chain/k8s/multiple/kustomization.yml | 77 +++++++++++ devtools/chain/k8s/{ => multiple}/node_1.toml | 0 devtools/chain/k8s/{ => multiple}/node_2.toml | 0 devtools/chain/k8s/{ => multiple}/node_3.toml | 0 devtools/chain/k8s/{ => multiple}/node_4.toml | 0 22 files changed, 815 insertions(+) create mode 100644 devtools/chain/k8s/README.md create mode 100644 devtools/chain/k8s/multiple/axon-chain.yml create mode 100644 devtools/chain/k8s/multiple/axon-ws.yml create mode 100644 devtools/chain/k8s/multiple/axon1-statefulset.yml create mode 100644 devtools/chain/k8s/multiple/axon2-statefulset.yml create mode 100644 devtools/chain/k8s/multiple/axon3-statefulset.yml create mode 100644 devtools/chain/k8s/multiple/axon4-statefulset.yml create mode 100644 devtools/chain/k8s/multiple/chain-spec.toml create mode 100644 devtools/chain/k8s/multiple/default.db-options rename devtools/chain/k8s/{ => multiple/key}/node_1_bls.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_1_net.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_2_bls.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_2_net.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_3_bls.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_3_net.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_4_bls.key (100%) rename devtools/chain/k8s/{ => multiple/key}/node_4_net.key (100%) create mode 100644 devtools/chain/k8s/multiple/kustomization.yml rename devtools/chain/k8s/{ => multiple}/node_1.toml (100%) rename devtools/chain/k8s/{ => multiple}/node_2.toml (100%) rename devtools/chain/k8s/{ => multiple}/node_3.toml (100%) rename devtools/chain/k8s/{ => multiple}/node_4.toml (100%) diff --git a/devtools/chain/k8s/README.md b/devtools/chain/k8s/README.md new file mode 100644 index 000000000..1a075d867 --- /dev/null +++ b/devtools/chain/k8s/README.md @@ -0,0 +1,90 @@ +# Axon Kubernetes Deployment + +## Introduction +This repository contains Axon Kubernetes deployment files. The following sections provide detailed instructions for deploying Axon Chain quickly, while optimizing resource usage. + +## Environmental preparation +Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. + +- First, you need a kubernetes system, either new or existing +- Secondly, it is necessary to plan the storageClass inside kubernetes +- The third is a machine that can have kubectl installed and can operate kubernetes + + +## Instructions + +1. **Download the Project** + + ```bash + git clone https://github.com/axonweb3/axon.git + ``` + +2. **Navigate to the Corresponding Directory** + ```bash + cd devtools/chain/k8s/multple + ``` + +3. **Create the Corresponding Namespace** + ```bash + kubectl create namespace axon-alphanet + ``` + +4. **Check Axon Version** +- Modify ```newTag: forcerelay-dev-c203acb``` to the version you want to deploy + + ```bash + images: + - name: ghcr.io/axonweb3/axon:0.2.0-dev + newName: ghcr.io/axonweb3/axon + newTag: forcerelay-dev-c203acb + + ``` + +5. **Check Axon's Required StorageClass and Modify** +- modifying StorageClass ```storageClassName: chain``` for your own cluster + ```bash + volumeClaimTemplates: + - metadata: + name: data1 + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: chain + resources: + requests: + storage: 100Gi + ``` + +6. **Perform initialization and modify the axon1 to axon4 statefulset file to the following format** + + ```bash + containers: + - name: axon1 + args: + - ./axon + - init + - --config=/app/devtools/chain/k8s/node_1.toml + - --chain-spec=/app/devtools/chain/chain-spec.toml + ``` + +7. **Start Axon After the axon initialization is successful, modify the axon1 to axon4 statefulset file to the following format** + + ```bash + containers: + - name: axon1 + args: + - ./axon + - init + - --config=/app/devtools/chain/k8s/node_1.toml + - --chain-spec=/app/devtools/chain/chain-spec.toml + ``` + ``` + cd devtools/chain/k8s/ + kubectl apply -k multiple -n axon-alphanet + ``` + +8. **After the startup command is executed, check that the pod status is ```runing``` and the axon log is blocked normally** + ```bash + kubectl get pods -n axon-alphanet + kubectl logs axon1 -n axon-alphanet -f + ``` + diff --git a/devtools/chain/k8s/multiple/axon-chain.yml b/devtools/chain/k8s/multiple/axon-chain.yml new file mode 100644 index 000000000..07735e0d9 --- /dev/null +++ b/devtools/chain/k8s/multiple/axon-chain.yml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: axon-chain + name: axon-chain + namespace: axon-alphanet +spec: + ports: + - name: axon-chain + port: 8000 + targetPort: 8000 + protocol: TCP + selector: + svc: axon-test + type: ClusterIP diff --git a/devtools/chain/k8s/multiple/axon-ws.yml b/devtools/chain/k8s/multiple/axon-ws.yml new file mode 100644 index 000000000..f5e6b95ba --- /dev/null +++ b/devtools/chain/k8s/multiple/axon-ws.yml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: axon-ws + name: axon-ws + namespace: axon-alphanet +spec: + ports: + - name: axon-chain + port: 8010 + targetPort: 8010 + protocol: TCP + selector: + svc: axon-test + type: ClusterIP diff --git a/devtools/chain/k8s/multiple/axon1-statefulset.yml b/devtools/chain/k8s/multiple/axon1-statefulset.yml new file mode 100644 index 000000000..a5a2b178a --- /dev/null +++ b/devtools/chain/k8s/multiple/axon1-statefulset.yml @@ -0,0 +1,123 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: axon1 + name: axon1 + namespace: axon-alphanet +spec: + ports: + - name: p2p + port: 8001 + targetPort: 8001 + protocol: TCP + - name: rpc + port: 8000 + targetPort: 8000 + protocol: TCP + - name: websocket + port: 8010 + targetPort: 8010 + protocol: TCP + - name: prometheus + port: 8100 + targetPort: 8100 + protocol: TCP + selector: + app: axon1 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: axon1 + namespace: axon-alphanet +spec: + replicas: 1 + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + svc: axon-test + app: axon1 + logging: "true" + serviceName: "axon1" + template: + metadata: + labels: + svc: axon-test + app: axon1 + logging: "true" + spec: + containers: + - name: axon1 + #command: ["./axon"] + args: + #args: ["hardfork","--config=/app/devtools/chain/k8s/node_1.toml", "--hardfork-start-number", "42640", "--feature", "andromeda"] + - ./axon + - run + #- init + - --config=/app/devtools/chain/k8s/node_1.toml + #- --chain-spec=/app/devtools/chain/chain-spec.toml + image: ghcr.io/axonweb3/axon:0.2.0-dev + volumeMounts: + - name: config-node1 + mountPath: /app/devtools/chain/k8s/node_1.toml + subPath: node_1.toml + - name: node1-net-key + mountPath: /app/devtools/chain/k8s/node_1_net.key + subPath: node_1_net.key + - name: node1-bls-key + mountPath: /app/devtools/chain/k8s/node_1_bls.key + subPath: node_1_bls.key + - name: config-chain-spec + mountPath: /app/devtools/chain/chain-spec.toml + subPath: chain-spec.toml + - name: config-db-options + mountPath: /app/devtools/chain/k8s/default.db-options + subPath: default.db-options + - name: data1 + mountPath: /app/devtools/chain/data/node_1 + subPath: node_1 + ports: + - name: p2p + containerPort: 8001 + - name: rpc + containerPort: 8000 + - name: websocket + containerPort: 8010 + - name: prometheus + containerPort: 8100 + resources: + requests: + cpu: 1 + memory: 1024Mi + limits: + cpu: 2 + memory: 2048Mi + volumes: + - name: config-node1 + configMap: + name: node1-toml + - name: config-chain-spec + configMap: + name: chain-spec + - name: config-db-options + configMap: + name: db-options + - name: node1-net-key + configMap: + name: node-1-net.key + - name: node1-bls-key + configMap: + name: node-1-bls.key + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: data1 + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: chain + resources: + requests: + storage: 100Gi diff --git a/devtools/chain/k8s/multiple/axon2-statefulset.yml b/devtools/chain/k8s/multiple/axon2-statefulset.yml new file mode 100644 index 000000000..e2dc7d7e7 --- /dev/null +++ b/devtools/chain/k8s/multiple/axon2-statefulset.yml @@ -0,0 +1,123 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: axon2 + name: axon2 + namespace: axon-alphanet +spec: + ports: + - name: p2p + port: 8001 + targetPort: 8001 + protocol: TCP + - name: rpc + port: 8000 + targetPort: 8000 + protocol: TCP + - name: websocket + port: 8010 + targetPort: 8010 + protocol: TCP + - name: prometheus + port: 8100 + targetPort: 8100 + protocol: TCP + selector: + app: axon2 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: axon2 + namespace: axon-alphanet +spec: + replicas: 1 + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + svc: axon-test + app: axon2 + logging: "true" + serviceName: "axon2" + template: + metadata: + labels: + svc: axon-test + app: axon2 + logging: "true" + spec: + containers: + - name: axon2 + #command: ["./axon"] + args: + #args: ["hardfork","--config=/app/devtools/chain/k8s/node_2.toml", "--hardfork-start-number", "42640", "--feature", "andromeda"] + - ./axon + - run + #- init + - --config=/app/devtools/chain/k8s/node_2.toml + #- --chain-spec=/app/devtools/chain/chain-spec.toml + image: ghcr.io/axonweb3/axon:0.2.0-dev + volumeMounts: + - name: config-node2 + mountPath: /app/devtools/chain/k8s/node_2.toml + subPath: node_2.toml + - name: node2-net-key + mountPath: /app/devtools/chain/k8s/node_2_net.key + subPath: node_2_net.key + - name: node2-bls-key + mountPath: /app/devtools/chain/k8s/node_2_bls.key + subPath: node_2_bls.key + - name: config-chain-spec + mountPath: /app/devtools/chain/chain-spec.toml + subPath: chain-spec.toml + - name: config-db-options + mountPath: /app/devtools/chain/k8s/default.db-options + subPath: default.db-options + - name: data2 + mountPath: /app/devtools/chain/data/node_2 + subPath: node_2 + ports: + - name: p2p + containerPort: 8001 + - name: rpc + containerPort: 8000 + - name: websocket + containerPort: 8010 + - name: prometheus + containerPort: 8100 + resources: + requests: + cpu: 1 + memory: 1024Mi + limits: + cpu: 2 + memory: 2048Mi + volumes: + - name: config-node2 + configMap: + name: node2-toml + - name: config-chain-spec + configMap: + name: chain-spec + - name: config-db-options + configMap: + name: db-options + - name: node2-net-key + configMap: + name: node-2-net.key + - name: node2-bls-key + configMap: + name: node-2-bls.key + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: data2 + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: chain + resources: + requests: + storage: 100Gi diff --git a/devtools/chain/k8s/multiple/axon3-statefulset.yml b/devtools/chain/k8s/multiple/axon3-statefulset.yml new file mode 100644 index 000000000..dd38cf7d8 --- /dev/null +++ b/devtools/chain/k8s/multiple/axon3-statefulset.yml @@ -0,0 +1,123 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: data3 + name: data3 + namespace: axon-alphanet +spec: + ports: + - name: p2p + port: 8001 + targetPort: 8001 + protocol: TCP + - name: rpc + port: 8000 + targetPort: 8000 + protocol: TCP + - name: websocket + port: 8010 + targetPort: 8010 + protocol: TCP + - name: prometheus + port: 8100 + targetPort: 8100 + protocol: TCP + selector: + app: data3 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: data3 + namespace: axon-alphanet +spec: + replicas: 1 + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + svc: axon-test + app: data3 + logging: "true" + serviceName: "data3" + template: + metadata: + labels: + svc: axon-test + app: data3 + logging: "true" + spec: + containers: + - name: data3 + #command: ["./axon"] + args: + #args: ["hardfork","--config=/app/devtools/chain/k8s/node_3.toml", "--hardfork-start-number", "42640", "--feature", "andromeda"] + - ./axon + - run + #- init + - --config=/app/devtools/chain/k8s/node_3.toml + #- --chain-spec=/app/devtools/chain/chain-spec.toml + image: ghcr.io/axonweb3/axon:0.2.0-dev + volumeMounts: + - name: config-node3 + mountPath: /app/devtools/chain/k8s/node_3.toml + subPath: node_3.toml + - name: node3-net-key + mountPath: /app/devtools/chain/k8s/node_3_net.key + subPath: node_3_net.key + - name: node3-bls-key + mountPath: /app/devtools/chain/k8s/node_3_bls.key + subPath: node_3_bls.key + - name: config-chain-spec + mountPath: /app/devtools/chain/chain-spec.toml + subPath: chain-spec.toml + - name: config-db-options + mountPath: /app/devtools/chain/k8s/default.db-options + subPath: default.db-options + - name: data3 + mountPath: /app/devtools/chain/data/node_3 + subPath: node_3 + ports: + - name: p2p + containerPort: 8001 + - name: rpc + containerPort: 8000 + - name: websocket + containerPort: 8010 + - name: prometheus + containerPort: 8100 + resources: + requests: + cpu: 1 + memory: 1024Mi + limits: + cpu: 2 + memory: 2048Mi + volumes: + - name: config-node3 + configMap: + name: node3-toml + - name: config-chain-spec + configMap: + name: chain-spec + - name: config-db-options + configMap: + name: db-options + - name: node3-net-key + configMap: + name: node-3-net.key + - name: node3-bls-key + configMap: + name: node-3-bls.key + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: data3 + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: chain + resources: + requests: + storage: 100Gi diff --git a/devtools/chain/k8s/multiple/axon4-statefulset.yml b/devtools/chain/k8s/multiple/axon4-statefulset.yml new file mode 100644 index 000000000..0c2bdc14f --- /dev/null +++ b/devtools/chain/k8s/multiple/axon4-statefulset.yml @@ -0,0 +1,123 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: axon4 + name: axon4 + namespace: axon-alphanet +spec: + ports: + - name: p2p + port: 8001 + targetPort: 8001 + protocol: TCP + - name: rpc + port: 8000 + targetPort: 8000 + protocol: TCP + - name: websocket + port: 8010 + targetPort: 8010 + protocol: TCP + - name: prometheus + port: 8100 + targetPort: 8100 + protocol: TCP + selector: + app: axon4 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: axon4 + namespace: axon-alphanet +spec: + replicas: 1 + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + svc: axon-test + app: axon4 + logging: "true" + serviceName: "axon4" + template: + metadata: + labels: + svc: axon-test + app: axon4 + logging: "true" + spec: + containers: + - name: axon4 + #command: ["./axon"] + args: + #args: ["hardfork","--config=/app/devtools/chain/k8s/node_4.toml", "--hardfork-start-number", "42640", "--feature", "andromeda"] + - ./axon + - run + #- init + - --config=/app/devtools/chain/k8s/node_4.toml + #- --chain-spec=/app/devtools/chain/chain-spec.toml + image: ghcr.io/axonweb3/axon:0.2.0-dev + volumeMounts: + - name: config-node4 + mountPath: /app/devtools/chain/k8s/node_4.toml + subPath: node_4.toml + - name: node4-net-key + mountPath: /app/devtools/chain/k8s/node_4_net.key + subPath: node_4_net.key + - name: node4-bls-key + mountPath: /app/devtools/chain/k8s/node_4_bls.key + subPath: node_4_bls.key + - name: config-chain-spec + mountPath: /app/devtools/chain/chain-spec.toml + subPath: chain-spec.toml + - name: config-db-options + mountPath: /app/devtools/chain/k8s/default.db-options + subPath: default.db-options + - name: data4 + mountPath: /app/devtools/chain/data/node_4 + subPath: node_4 + ports: + - name: p2p + containerPort: 8001 + - name: rpc + containerPort: 8000 + - name: websocket + containerPort: 8010 + - name: prometheus + containerPort: 8100 + resources: + requests: + cpu: 1 + memory: 1024Mi + limits: + cpu: 2 + memory: 2048Mi + volumes: + - name: config-node4 + configMap: + name: node4-toml + - name: config-chain-spec + configMap: + name: chain-spec + - name: config-db-options + configMap: + name: db-options + - name: node4-net-key + configMap: + name: node-4-net.key + - name: node4-bls-key + configMap: + name: node-4-bls.key + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: data4 + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: chain + resources: + requests: + storage: 100Gi diff --git a/devtools/chain/k8s/multiple/chain-spec.toml b/devtools/chain/k8s/multiple/chain-spec.toml new file mode 100644 index 000000000..34913943c --- /dev/null +++ b/devtools/chain/k8s/multiple/chain-spec.toml @@ -0,0 +1,101 @@ +# +# Data of the genesis block. +# + +[genesis] +timestamp = 1680249207 +base_fee_per_gas = "0x539" +# The default chain id is the hexadecimal of ASCII string "Axon". +chain_id = 0x41786f6e +hardforks = [] + +# +# Accounts since the genesis block. +# +# WARNING: The following accounts are publicly known, DO NOT USE them in any production environment. +# Generated with the mnemonic "test test test test test test test test test test test junk". + +[[accounts]] +address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x90F79bf6EB2c4f870365E785982E1f101E93b906" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x976EA74026E726554dB657fA54763abd0C3a0aa9" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" +balance = "04ee2d6d415b85acef8100000000" + +[[accounts]] +address = "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" +balance = "04ee2d6d415b85acef8100000000" + +# +# Parameters which make the chain to be unique. +# + +[params] +epoch = 0 + +[params.version] +start = 1 +end = 100000000 + +[params.consensus_config] +propose_ratio = 15 +prevote_ratio = 10 +precommit_ratio = 10 +brake_ratio = 10 +tx_num_limit = 20000 +max_tx_size = 409600000 +gas_limit = 4294967295000 +interval = 3000 + +[[params.verifier_list]] +bls_pub_key = "0xa26e3fe1cf51bd4822072c61bdc315ac32e3d3c2e2484bb92942666399e863b4bf56cf2926383cc706ffc15dfebc85c6" +pub_key = "0x031ddc35212b7fc7ff6685b17d91f77c972535aee5c7ae5684d3e72b986f08834b" +propose_weight = 1 +vote_weight = 1 + +[[params.verifier_list]] +bls_pub_key = "0x80310fa9df724b5603d283b472ed3bf85254a8a4ceda8a274b421f6cf2be1d9184267cdfe9a199d36ff14e57668a55d0" +pub_key = "0x02b77c74eb68af3d4d6cc7884ed6709f1a2a1af0f713382a4438ec2ea3a70d4d7f" +propose_weight = 1 +vote_weight = 1 + +[[params.verifier_list]] +bls_pub_key = "0x897721e9016864141a8b982a48217f66ef318ce598aa31842cddaaebe3cd7feab17050022afa6c2123aba39938fe4142" +pub_key = "0x027ffd6a6a231561f2afe5878b1c743323b34263d16787130b1815fe35649b0bf5" +propose_weight = 1 +vote_weight = 1 + +[[params.verifier_list]] +bls_pub_key = "0x98eef09a3927acb225191101a1d9aa85775fdcdc87b9ba36898f6c132b485d66aef91c0f51cda331be4f985c3be6761c" +pub_key = "0x0232c489c23b1207107e9a24648c1e4754a8c1c0b38db96df57a526201035058cb" +propose_weight = 1 +vote_weight = 1 diff --git a/devtools/chain/k8s/multiple/default.db-options b/devtools/chain/k8s/multiple/default.db-options new file mode 100644 index 000000000..c7236b389 --- /dev/null +++ b/devtools/chain/k8s/multiple/default.db-options @@ -0,0 +1,23 @@ +# This is a RocksDB option file. +# +# For detailed file format spec, please refer to the official documents +# in https://rocksdb.org/docs/ +# + +[DBOptions] +bytes_per_sync=1048576 +max_background_compactions=4 +max_background_flushes=2 +max_total_wal_size=134217728 +keep_log_file_num=32 + +[CFOptions "default"] +level_compaction_dynamic_level_bytes=true +write_buffer_size=8388608 +min_write_buffer_number_to_merge=1 +max_write_buffer_number=2 +max_write_buffer_size_to_maintain=-1 + +[TableOptions/BlockBasedTable "default"] +cache_index_and_filter_blocks=true +pin_l0_filter_and_index_blocks_in_cache=true diff --git a/devtools/chain/k8s/node_1_bls.key b/devtools/chain/k8s/multiple/key/node_1_bls.key similarity index 100% rename from devtools/chain/k8s/node_1_bls.key rename to devtools/chain/k8s/multiple/key/node_1_bls.key diff --git a/devtools/chain/k8s/node_1_net.key b/devtools/chain/k8s/multiple/key/node_1_net.key similarity index 100% rename from devtools/chain/k8s/node_1_net.key rename to devtools/chain/k8s/multiple/key/node_1_net.key diff --git a/devtools/chain/k8s/node_2_bls.key b/devtools/chain/k8s/multiple/key/node_2_bls.key similarity index 100% rename from devtools/chain/k8s/node_2_bls.key rename to devtools/chain/k8s/multiple/key/node_2_bls.key diff --git a/devtools/chain/k8s/node_2_net.key b/devtools/chain/k8s/multiple/key/node_2_net.key similarity index 100% rename from devtools/chain/k8s/node_2_net.key rename to devtools/chain/k8s/multiple/key/node_2_net.key diff --git a/devtools/chain/k8s/node_3_bls.key b/devtools/chain/k8s/multiple/key/node_3_bls.key similarity index 100% rename from devtools/chain/k8s/node_3_bls.key rename to devtools/chain/k8s/multiple/key/node_3_bls.key diff --git a/devtools/chain/k8s/node_3_net.key b/devtools/chain/k8s/multiple/key/node_3_net.key similarity index 100% rename from devtools/chain/k8s/node_3_net.key rename to devtools/chain/k8s/multiple/key/node_3_net.key diff --git a/devtools/chain/k8s/node_4_bls.key b/devtools/chain/k8s/multiple/key/node_4_bls.key similarity index 100% rename from devtools/chain/k8s/node_4_bls.key rename to devtools/chain/k8s/multiple/key/node_4_bls.key diff --git a/devtools/chain/k8s/node_4_net.key b/devtools/chain/k8s/multiple/key/node_4_net.key similarity index 100% rename from devtools/chain/k8s/node_4_net.key rename to devtools/chain/k8s/multiple/key/node_4_net.key diff --git a/devtools/chain/k8s/multiple/kustomization.yml b/devtools/chain/k8s/multiple/kustomization.yml new file mode 100644 index 000000000..5c63b7c98 --- /dev/null +++ b/devtools/chain/k8s/multiple/kustomization.yml @@ -0,0 +1,77 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +configMapGenerator: +- name: node1-toml + files: + - "node_1.toml" + +- name: node-1-net.key + files: + - key/node_1_net.key + +- name: node-1-bls.key + files: + - key/node_1_bls.key + +- name: node2-toml + files: + - "node_2.toml" + +- name: node-2-net.key + files: + - key/node_2_net.key + +- name: node-2-bls.key + files: + - key/node_2_bls.key + +- name: node3-toml + files: + - "node_3.toml" + +- name: node-3-net.key + files: + - key/node_3_net.key + +- name: node-3-bls.key + files: + - key/node_3_bls.key + +- name: node4-toml + files: + - "node_4.toml" + +- name: node-4-net.key + files: + - key/node_4_net.key + +- name: node-4-bls.key + files: + - key/node_4_bls.key + +- name: db-options + files: + - "default.db-options" + +- name: chain-spec + files: + - "chain-spec.toml" + + + +generatorOptions: + disableNameSuffixHash: true + +resources: +- axon1-statefulset.yml +- axon2-statefulset.yml +- axon3-statefulset.yml +- axon4-statefulset.yml +- axon-chain.yml +- axon-ws.yml + +images: +- name: ghcr.io/axonweb3/axon:0.2.0-dev + newName: ghcr.io/axonweb3/axon + newTag: forcerelay-dev-c203acb diff --git a/devtools/chain/k8s/node_1.toml b/devtools/chain/k8s/multiple/node_1.toml similarity index 100% rename from devtools/chain/k8s/node_1.toml rename to devtools/chain/k8s/multiple/node_1.toml diff --git a/devtools/chain/k8s/node_2.toml b/devtools/chain/k8s/multiple/node_2.toml similarity index 100% rename from devtools/chain/k8s/node_2.toml rename to devtools/chain/k8s/multiple/node_2.toml diff --git a/devtools/chain/k8s/node_3.toml b/devtools/chain/k8s/multiple/node_3.toml similarity index 100% rename from devtools/chain/k8s/node_3.toml rename to devtools/chain/k8s/multiple/node_3.toml diff --git a/devtools/chain/k8s/node_4.toml b/devtools/chain/k8s/multiple/node_4.toml similarity index 100% rename from devtools/chain/k8s/node_4.toml rename to devtools/chain/k8s/multiple/node_4.toml From 972772825cf9672bd5cdb909c878f71ee7695b57 Mon Sep 17 00:00:00 2001 From: Simon-Tl Date: Tue, 2 Jan 2024 15:24:18 +0800 Subject: [PATCH 2/4] chore: add README.md to chain directory --- devtools/chain/README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 devtools/chain/README.md diff --git a/devtools/chain/README.md b/devtools/chain/README.md new file mode 100644 index 000000000..6296540bf --- /dev/null +++ b/devtools/chain/README.md @@ -0,0 +1,33 @@ +# Axon Deployment Repository + +## Introduction + +This repository serves as the storage directory for Axon deployment files. It encompasses Axon Kubernetes deployment, node deployment, and private key generation methods. The following sections provide detailed instructions for various deployment methods. It is strongly recommended to generate your own key regardless of the deployment method chosen. + +## Deployment Methods + +### 1. Private Key Generation + +- Steps to generate a private key for securing your Axon deployment. + +1. First,it is necessary to [compile](https://github.com/axonweb3/axon?tab=readme-ov-file#compile-from-source) Axon in a local or standardized Rust environment. + +2. Next, generate the corresponding key using [generate-keypair](https://github.com/axonweb3/axon/tree/main/core/cli#generate-keypair) + + + +### 2. Axon Kubernetes Deployment + +- Detailed instructions and files for deploying Axon on Kubernetes. +- Navigate to the [kubernetes-deployment](https://github.com/axonweb3/axon/tree/axon-deploy-kubernetes/devtools/chain/k8s) directory for Kubernetes-specific deployment. + +### 3. Node Deployment + +- Instructions for deploying Axon on individual nodes. +- Explore the [node-deployment](https://github.com/axonweb3/axon/tree/axon-deploy-kubernetes/devtools/chain/nodes) directory for node-specific deployment details. + +## Important Note + +Regardless of the chosen deployment method, it is strongly advised to generate a unique private key for added security. Follow the instructions in the respective directories to create your own key. + +Feel free to explore each deployment method based on your specific requirements and preferences. From 5d4e6ce9d7cdb6dcc9a6142d94ced485a8acf003 Mon Sep 17 00:00:00 2001 From: Simon-Tl Date: Tue, 2 Jan 2024 15:25:25 +0800 Subject: [PATCH 3/4] chore: update kubernetes deploy for axon --- devtools/chain/k8s/README.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/devtools/chain/k8s/README.md b/devtools/chain/k8s/README.md index 1a075d867..b227d8525 100644 --- a/devtools/chain/k8s/README.md +++ b/devtools/chain/k8s/README.md @@ -10,7 +10,6 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. - Secondly, it is necessary to plan the storageClass inside kubernetes - The third is a machine that can have kubectl installed and can operate kubernetes - ## Instructions 1. **Download the Project** @@ -20,17 +19,20 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. ``` 2. **Navigate to the Corresponding Directory** + ```bash cd devtools/chain/k8s/multple ``` 3. **Create the Corresponding Namespace** + ```bash kubectl create namespace axon-alphanet ``` 4. **Check Axon Version** -- Modify ```newTag: forcerelay-dev-c203acb``` to the version you want to deploy + +- Modify ```newTag: forcerelay-dev-c203acb``` to the version you want to deploy ```bash images: @@ -41,7 +43,9 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. ``` 5. **Check Axon's Required StorageClass and Modify** + - modifying StorageClass ```storageClassName: chain``` for your own cluster + ```bash volumeClaimTemplates: - metadata: @@ -66,6 +70,18 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. - --chain-spec=/app/devtools/chain/chain-spec.toml ``` +7. [Generate key](https://github.com/axonweb3/axon/tree/main/core/cli#generate-keypair:~:text=Generate%20Keypair,in%20config%20file.), and update the fields of the chain-spec.yaml and toml files + + - [chain-spec.yaml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/chain-spec.toml#:~:text=interval%20%3D%203000-,%5B%5Bparams.verifier_list%5D%5D,vote_weight%20%3D%201,-axon/devtools/chain) + + - [node_1.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_1.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + + - [node_2.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_2.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + + - [node_3.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_3.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + + - [node_4.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_4.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + 7. **Start Axon After the axon initialization is successful, modify the axon1 to axon4 statefulset file to the following format** ```bash @@ -73,9 +89,8 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. - name: axon1 args: - ./axon - - init + - run - --config=/app/devtools/chain/k8s/node_1.toml - - --chain-spec=/app/devtools/chain/chain-spec.toml ``` ``` cd devtools/chain/k8s/ From b77bc58a94984f9f850ee31b0a4e4254b05a679f Mon Sep 17 00:00:00 2001 From: Simon-Tl Date: Thu, 11 Jan 2024 19:05:14 +0800 Subject: [PATCH 4/4] chore: change the link to the main branch --- devtools/chain/README.md | 4 ++-- devtools/chain/k8s/README.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devtools/chain/README.md b/devtools/chain/README.md index 6296540bf..3c616390e 100644 --- a/devtools/chain/README.md +++ b/devtools/chain/README.md @@ -19,12 +19,12 @@ This repository serves as the storage directory for Axon deployment files. It en ### 2. Axon Kubernetes Deployment - Detailed instructions and files for deploying Axon on Kubernetes. -- Navigate to the [kubernetes-deployment](https://github.com/axonweb3/axon/tree/axon-deploy-kubernetes/devtools/chain/k8s) directory for Kubernetes-specific deployment. +- Navigate to the [kubernetes-deployment](https://github.com/axonweb3/axon/tree/main/devtools/chain/k8s) directory for Kubernetes-specific deployment. ### 3. Node Deployment - Instructions for deploying Axon on individual nodes. -- Explore the [node-deployment](https://github.com/axonweb3/axon/tree/axon-deploy-kubernetes/devtools/chain/nodes) directory for node-specific deployment details. +- Explore the [node-deployment](https://github.com/axonweb3/axon/tree/main/devtools/chain/nodes) directory for node-specific deployment details. ## Important Note diff --git a/devtools/chain/k8s/README.md b/devtools/chain/k8s/README.md index b227d8525..ee3111659 100644 --- a/devtools/chain/k8s/README.md +++ b/devtools/chain/k8s/README.md @@ -72,15 +72,15 @@ Kubernetes enables you to deploy Axon Chain rapidly while conserving resources. 7. [Generate key](https://github.com/axonweb3/axon/tree/main/core/cli#generate-keypair:~:text=Generate%20Keypair,in%20config%20file.), and update the fields of the chain-spec.yaml and toml files - - [chain-spec.yaml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/chain-spec.toml#:~:text=interval%20%3D%203000-,%5B%5Bparams.verifier_list%5D%5D,vote_weight%20%3D%201,-axon/devtools/chain) + - [chain-spec.yaml](https://github.com/axonweb3/axon/blob/main/devtools/chain/k8s/multiple/chain-spec.toml#:~:text=interval%20%3D%203000-,%5B%5Bparams.verifier_list%5D%5D,vote_weight%20%3D%201,-axon/devtools/chain) - - [node_1.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_1.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + - [node_1.toml](https://github.com/axonweb3/axon/blob/main/devtools/chain/k8s/multiple/node_1.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) - - [node_2.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_2.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + - [node_2.toml](https://github.com/axonweb3/axon/blob/main/devtools/chain/k8s/multiple/node_2.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) - - [node_3.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_3.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + - [node_3.toml](https://github.com/axonweb3/axon/blob/main/devtools/chain/k8s/multiple/node_3.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) - - [node_4.toml](https://github.com/axonweb3/axon/blob/axon-deploy-kubernetes/devtools/chain/k8s/multiple/node_4.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) + - [node_4.toml](https://github.com/axonweb3/axon/blob/main/devtools/chain/k8s/multiple/node_4.toml#:~:text=%5B%5Bnetwork.,p2p/QmXoSkz4zkHHiFZqmDZQ4gFYtJ72uqtp4m6FX373X4VkRq%22) 7. **Start Axon After the axon initialization is successful, modify the axon1 to axon4 statefulset file to the following format**