mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
add kube validator
This commit is contained in:
commit
86006296a3
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
To initialise a network:
|
||||||
|
|
||||||
|
- delete everything (including persistant volume claim)
|
||||||
|
- deploy everything except the deployment
|
||||||
|
- wait until the job has finished, then deploy the deployment
|
||||||
|
- check job pod logs for the validator account backup phrase :\
|
||||||
|
|
||||||
|
Examples of using light client with the node:
|
||||||
|
|
||||||
|
- Get the status `gaiacli status --node <node's-ip-address>:46657 --chain-id kava`
|
||||||
|
- Send coins `gaiacli send --name <your-key-name> --to <receiver's-address> --amount 10kavaToken --node <node's-ip-address>:46657 --chain-id kava`
|
||||||
|
- Run the rest server `gaiacli rest-server --node <node's-ip-address>:46657 --chain-id kava`
|
||||||
|
|
||||||
|
Notes
|
||||||
|
|
||||||
|
- There's two persistant volumes, for `.gaiad` and for `.gaiacli`, because their default locations are awkward.
|
178
config-map.yml
Normal file
178
config-map.yml
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
name: kava-config-map
|
||||||
|
data:
|
||||||
|
config.toml: |
|
||||||
|
# This is a TOML config file.
|
||||||
|
# For more information, see https://github.com/toml-lang/toml
|
||||||
|
|
||||||
|
##### main base config options #####
|
||||||
|
|
||||||
|
# TCP or UNIX socket address of the ABCI application,
|
||||||
|
# or the name of an ABCI application compiled in with the Tendermint binary
|
||||||
|
proxy_app = "tcp://127.0.0.1:46658"
|
||||||
|
|
||||||
|
# A custom human readable name for this node
|
||||||
|
moniker = "node1"
|
||||||
|
|
||||||
|
# If this node is many blocks behind the tip of the chain, FastSync
|
||||||
|
# allows them to catchup quickly by downloading blocks in parallel
|
||||||
|
# and verifying their commits
|
||||||
|
fast_sync = true
|
||||||
|
|
||||||
|
# Database backend: leveldb | memdb
|
||||||
|
db_backend = "leveldb"
|
||||||
|
|
||||||
|
# Database directory
|
||||||
|
db_path = "data"
|
||||||
|
|
||||||
|
# Output level for logging, including package level options
|
||||||
|
log_level = "main:info,state:info,*:error"
|
||||||
|
|
||||||
|
##### additional base config options #####
|
||||||
|
|
||||||
|
# Path to the JSON file containing the initial validator set and other meta data
|
||||||
|
genesis_file = "config/genesis.json"
|
||||||
|
|
||||||
|
# Path to the JSON file containing the private key to use as a validator in the consensus protocol
|
||||||
|
priv_validator_file = "config/priv_validator.json"
|
||||||
|
|
||||||
|
# Path to the JSON file containing the private key to use for node authentication in the p2p protocol
|
||||||
|
node_key_file = "config/node_key.json"
|
||||||
|
|
||||||
|
# Mechanism to connect to the ABCI application: socket | grpc
|
||||||
|
abci = "socket"
|
||||||
|
|
||||||
|
# TCP or UNIX socket address for the profiling server to listen on
|
||||||
|
prof_laddr = ""
|
||||||
|
|
||||||
|
# If true, query the ABCI app on connecting to a new peer
|
||||||
|
# so the app can decide if we should keep the connection or not
|
||||||
|
filter_peers = false
|
||||||
|
|
||||||
|
##### advanced configuration options #####
|
||||||
|
|
||||||
|
##### rpc server configuration options #####
|
||||||
|
[rpc]
|
||||||
|
|
||||||
|
# TCP or UNIX socket address for the RPC server to listen on
|
||||||
|
laddr = "tcp://0.0.0.0:46657"
|
||||||
|
|
||||||
|
# TCP or UNIX socket address for the gRPC server to listen on
|
||||||
|
# NOTE: This server only supports /broadcast_tx_commit
|
||||||
|
grpc_laddr = ""
|
||||||
|
|
||||||
|
# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
|
||||||
|
unsafe = false
|
||||||
|
|
||||||
|
##### peer to peer configuration options #####
|
||||||
|
[p2p]
|
||||||
|
|
||||||
|
# Address to listen for incoming connections
|
||||||
|
laddr = "tcp://0.0.0.0:46656"
|
||||||
|
|
||||||
|
# Comma separated list of seed nodes to connect to
|
||||||
|
seeds = ""
|
||||||
|
|
||||||
|
# Comma separated list of nodes to keep persistent connections to
|
||||||
|
# Do not add private peers to this list if you don't want them advertised
|
||||||
|
persistent_peers = ""
|
||||||
|
|
||||||
|
# Path to address book
|
||||||
|
addr_book_file = "config/addrbook.json"
|
||||||
|
|
||||||
|
# Set true for strict address routability rules
|
||||||
|
addr_book_strict = true
|
||||||
|
|
||||||
|
# Time to wait before flushing messages out on the connection, in ms
|
||||||
|
flush_throttle_timeout = 100
|
||||||
|
|
||||||
|
# Maximum number of peers to connect to
|
||||||
|
max_num_peers = 50
|
||||||
|
|
||||||
|
# Maximum size of a message packet payload, in bytes
|
||||||
|
max_packet_msg_payload_size = 1024
|
||||||
|
|
||||||
|
# Rate at which packets can be sent, in bytes/second
|
||||||
|
send_rate = 512000
|
||||||
|
|
||||||
|
# Rate at which packets can be received, in bytes/second
|
||||||
|
recv_rate = 512000
|
||||||
|
|
||||||
|
# Set true to enable the peer-exchange reactor
|
||||||
|
pex = true
|
||||||
|
|
||||||
|
# Seed mode, in which node constantly crawls the network and looks for
|
||||||
|
# peers. If another node asks it for addresses, it responds and disconnects.
|
||||||
|
#
|
||||||
|
# Does not work if the peer-exchange reactor is disabled.
|
||||||
|
seed_mode = false
|
||||||
|
|
||||||
|
# Authenticated encryption
|
||||||
|
auth_enc = true
|
||||||
|
|
||||||
|
# Comma separated list of peer IDs to keep private (will not be gossiped to other peers)
|
||||||
|
private_peer_ids = ""
|
||||||
|
|
||||||
|
##### mempool configuration options #####
|
||||||
|
[mempool]
|
||||||
|
|
||||||
|
recheck = true
|
||||||
|
recheck_empty = true
|
||||||
|
broadcast = true
|
||||||
|
wal_dir = "data/mempool.wal"
|
||||||
|
|
||||||
|
##### consensus configuration options #####
|
||||||
|
[consensus]
|
||||||
|
|
||||||
|
wal_file = "data/cs.wal/wal"
|
||||||
|
|
||||||
|
# All timeouts are in milliseconds
|
||||||
|
timeout_propose = 3000
|
||||||
|
timeout_propose_delta = 500
|
||||||
|
timeout_prevote = 1000
|
||||||
|
timeout_prevote_delta = 500
|
||||||
|
timeout_precommit = 1000
|
||||||
|
timeout_precommit_delta = 500
|
||||||
|
timeout_commit = 1000
|
||||||
|
|
||||||
|
# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
|
||||||
|
skip_timeout_commit = false
|
||||||
|
|
||||||
|
# BlockSize
|
||||||
|
max_block_size_txs = 10000
|
||||||
|
max_block_size_bytes = 1
|
||||||
|
|
||||||
|
# EmptyBlocks mode and possible interval between empty blocks in seconds
|
||||||
|
create_empty_blocks = false
|
||||||
|
create_empty_blocks_interval = 0
|
||||||
|
|
||||||
|
# Reactor sleep duration parameters are in milliseconds
|
||||||
|
peer_gossip_sleep_duration = 100
|
||||||
|
peer_query_maj23_sleep_duration = 2000
|
||||||
|
|
||||||
|
##### transactions indexer configuration options #####
|
||||||
|
[tx_index]
|
||||||
|
|
||||||
|
# What indexer to use for transactions
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
# 1) "null" (default)
|
||||||
|
# 2) "kv" - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
|
||||||
|
indexer = "kv"
|
||||||
|
|
||||||
|
# Comma-separated list of tags to index (by default the only tag is tx hash)
|
||||||
|
#
|
||||||
|
# It's recommended to index only a subset of tags due to possible memory
|
||||||
|
# bloat. This is, of course, depends on the indexer's DB and the volume of
|
||||||
|
# transactions.
|
||||||
|
index_tags = ""
|
||||||
|
|
||||||
|
# When set to true, tells indexer to index all tags. Note this may be not
|
||||||
|
# desirable (see the comment above). IndexTags has a precedence over
|
||||||
|
# IndexAllTags (i.e. when given both, IndexTags will be indexed).
|
||||||
|
index_all_tags = false
|
||||||
|
|
||||||
|
|
41
deployment.yml
Normal file
41
deployment.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
apiVersion: apps/v1beta2
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: kava-deployment
|
||||||
|
labels:
|
||||||
|
app: kava
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: kava
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: kava
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: gaiad
|
||||||
|
image: kava/cosmos-sdk
|
||||||
|
command: ["gaiad", "start"]
|
||||||
|
ports:
|
||||||
|
- containerPort: 46656
|
||||||
|
- containerPort: 46657
|
||||||
|
volumeMounts:
|
||||||
|
- name: kava-persistent-storage-gaiad
|
||||||
|
mountPath: /root/.gaiad
|
||||||
|
- name: kava-persistent-storage-gaiacli
|
||||||
|
mountPath: /root/.gaiacli
|
||||||
|
- name: kava-config-map-volume
|
||||||
|
mountPath: /root/gaia/.gaiad/config
|
||||||
|
volumes:
|
||||||
|
- name: kava-persistent-storage-gaiad
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: kava-pvc-gaiad
|
||||||
|
- name: kava-persistent-storage-gaiacli
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: kava-pvc-gaiacli
|
||||||
|
- name: kava-config-map-volume
|
||||||
|
configMap:
|
||||||
|
name: kava-config-map
|
||||||
|
|
43
docker-images/Dockerfile
Normal file
43
docker-images/Dockerfile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Simple usage with a mounted data directory:
|
||||||
|
# > docker build -t gaia .
|
||||||
|
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia init
|
||||||
|
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia start
|
||||||
|
|
||||||
|
FROM alpine:edge
|
||||||
|
|
||||||
|
# Set up dependencies
|
||||||
|
ENV PACKAGES go glide make git libc-dev bash
|
||||||
|
|
||||||
|
# Set up GOPATH & PATH
|
||||||
|
ENV GOPATH /root/go
|
||||||
|
ENV BASE_PATH $GOPATH/src/github.com/cosmos
|
||||||
|
ENV REPO_PATH $BASE_PATH/cosmos-sdk
|
||||||
|
ENV WORKDIR /cosmos/
|
||||||
|
ENV PATH $GOPATH/bin:$PATH
|
||||||
|
|
||||||
|
# Link expected Go repo path
|
||||||
|
RUN mkdir -p $WORKDIR $GOPATH/pkg $ $GOPATH/bin $BASE_PATH
|
||||||
|
|
||||||
|
#Install apk dependencies
|
||||||
|
RUN apk add --no-cache $PACKAGES
|
||||||
|
|
||||||
|
# Add build files
|
||||||
|
COPY Gopkg.* Makefile $REPO_PATH/
|
||||||
|
COPY .git $REPO_PATH/.git
|
||||||
|
COPY tools $REPO_PATH/tools
|
||||||
|
|
||||||
|
# Intsall go packages
|
||||||
|
RUN cd $REPO_PATH && make get_tools && make get_vendor_deps
|
||||||
|
|
||||||
|
# Add source files
|
||||||
|
COPY . $REPO_PATH
|
||||||
|
|
||||||
|
# Build app
|
||||||
|
RUN cd $REPO_PATH && make all && make install
|
||||||
|
|
||||||
|
# remove packages
|
||||||
|
RUN apk del $PACKAGES
|
||||||
|
|
||||||
|
# Set entrypoint
|
||||||
|
#ENTRYPOINT ["gaiad"]
|
||||||
|
CMD ["gaiad"]
|
6
docker-images/README.md
Normal file
6
docker-images/README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This Dockerfile is to build cosmos-sdk. It needs to be in the cosmos-sdk repo to build.
|
||||||
|
|
||||||
|
It modifies the existing Dockerfile in the cosmos-sdk:
|
||||||
|
|
||||||
|
- split up commands to make use of layers to make rebuilds and uploads faster
|
||||||
|
- switch `ENTRYPOINT gaiad` to `CMD gaiad` to save typing `--entrypoint` all the time
|
29
job.yml
Normal file
29
job.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: start-new-chain-job
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: run-init
|
||||||
|
image: kava/cosmos-sdk
|
||||||
|
command: ["gaiad", "init", "--chain-id", "kava", "--name", "kava"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: kava-persistent-storage-gaiad
|
||||||
|
mountPath: /root/.gaiad
|
||||||
|
- name: kava-persistent-storage-gaiacli
|
||||||
|
mountPath: /root/.gaiacli
|
||||||
|
- name: kava-config-map-volume
|
||||||
|
mountPath: /root/gaia/.gaiad/config
|
||||||
|
restartPolicy: Never
|
||||||
|
volumes:
|
||||||
|
- name: kava-persistent-storage-gaiad
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: kava-pvc-gaiad
|
||||||
|
- name: kava-persistent-storage-gaiacli
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: kava-pvc-gaiacli
|
||||||
|
- name: kava-config-map-volume
|
||||||
|
configMap:
|
||||||
|
name: kava-config-map
|
19
service.yml
Normal file
19
service.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: kava-service
|
||||||
|
labels:
|
||||||
|
app: kava
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
ports:
|
||||||
|
- name: rpc
|
||||||
|
port: 46657
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 46657
|
||||||
|
- name: p2p
|
||||||
|
port: 46656
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 46656
|
||||||
|
selector:
|
||||||
|
app: kava
|
22
volume.yml
Normal file
22
volume.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: kava-pvc-gaiad
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 8Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: kava-pvc-gaiacli
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 8Gi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user