-
Notifications
You must be signed in to change notification settings - Fork 15
Frankenstein Testnet Fullnode Set Up Instructions v0.18.11
This document explains how to download and setup a OneLedger Fullnode for the Frankenstein Testnet.
There are 3 ways to setup OneLedger Frankenstein Fullnode:
This document is drafted based on Ubuntu 18.04,
- Download the binaries
wget https://github.com/Oneledger/protocol/releases/download/v0.18.11/olclient
wget https://github.com/Oneledger/protocol/releases/download/v0.18.11/olfullnode
chmod +x olclient
chmod +x olfullnode
- Check the executable path
echo $PATH
-
if you want to add any preferred path into the executable path:
Add this line at the beginning of
/home/YourUserName/.bashrc
:export PATH=$PATH:YourPreferredPath
And source it:
source /home/YourUserName/.bashrc
put these binaries under any place of your executable $PATH
- Verify the binary md5
md5sum olfullnode
should get
41a3a8210a2938c95bf91cf9489be1f7 olfullnode
md5sum olclient
should get
e2acde2b1e776a2e09bbc13dd68c0cc9 olclient
- Initialize the node
export OLDATA="any place that you want to run the node"
cd $OLDATA
wget https://raw.githubusercontent.com/Oneledger/frankenstein-genesis/master/v0.18/genesis.json
wget https://raw.githubusercontent.com/Oneledger/frankenstein-genesis/master/v0.18/config.toml
olfullnode init --genesis genesis.json --node_name "your preferred name" --root ./
- P2P configuration
Configure your config.toml
file
This will let your node to be connectable by others through p2p
# Main address for P2P connections
p2p_address = "tcp://<your-internal-ip>:26601"
# Address to advertise for incoming peers to connect to
external_p2p_address = "tcp://<your-external-ip>:26601"
- Run the node
There are two ways to do this, either of them works
-
Directly run the node
olfullnode node --root ./
-
Or you can run the node in background by creating systemd service file
- Replace
/PATH/TO/olfullnode
with the actual absolute path of olfullnode binary, this path should be a literate one, without any environment variables. - Replace
/PATH/TO/OLDATA
with the actual absolute path of OLDATA(where you want to run the fullnode, should already have been set up when initializing the node), this path should be a literate one, without any environment variables.
cd /etc/systemd/system sudo vim olfullnode.service (Add below content) [Unit] Description=olfullnode Wants=network-online.target After=network-online.target [Service] Type=simple #User=alertmanager #Group=alertmanager ExecStart=/PATH/TO/olfullnode node --root /PATH/TO/OLDATA > /PATH/TO/OLDATA/fullnode.log & #Restart=on-failure [Install] WantedBy=multi-user.target
Enable the service file
sudo systemctl enable olfullnode.service
start the service file and check the status
sudo service olfullnode start sudo service olfullnode status
- Replace
Sentry Node is a type of fullnode, it can do whatever a fullnode does.
Sentry Node is used to isolate your nodes from the public. Your nodes only establishes private connections to the sentry node and it connects to the rest of the network.
By doing this, Sentry Node protects our nodes from being attacked. One of the most common attack vectors is DDOS. Sentry Nodes can mitigate those attacks.
If you want to hide one node with a sentry node(You will need at least two nodes running on different machines to preform following procedures, one acts as sentry node, the other one is the node you want to protect)
Follow steps from 1 to 4 above, then follow the steps below:
get node id with
olfullnode show_node_id --ip
you will get id like
[email protected]:26601
configure the sentry and protected node like following
In the config.toml
of sentry node:
# List of peers to maintain a persistent connection to
persistent_peers = ["<protected-node-id>@<protected-node-ip>:26601"]
# List of peer IDs to keep private (will not be gossiped to other peers)
private_peer_ids = ["<protected-node-id>"]
In the config.toml
of protected node:
# List of peers to maintain a persistent connection to
persistent_peers = ["<sentry-node-id>@<sentry-node-ip>:26601"]
After configuration is done, run the nodes as introduced in step 6 above.
-
Run a node on Google Cloud Marketplace now by clicking here
-
Deploy OneLedger Frankenstein Testnet Fullnode
* Choose the name from your OneLedger instance
* Choose a machine type with suggested configurations
* You can keep all other fields set to the default values
* Click Deploy
-
Now you are up and running. Click on SSH to run your node.
-
Check the Fullnode service and check the status
cd $OLDATA
sudo olfullnode status
the result should be similar to below:
2020/12/14 20:05:31 Profiling listen to: [::]:41721
RPC Port: 26604 on 10.168.0.5 ✓
P2P Port: 26605 on 10.168.0.5 ✓
SDK Port: 26606 on 10.168.0.5 ✓
✓ Looks all good ✓
- Validate node status
- Go to Frankenstein explorer, check out the current block height
- Use
sudo olclient validatorset
command to see the block height showing on this node
The node will take some time to catch up to Testnet current height, wait until two heights are same or with only 1~2 block difference
- Install docker in your machine.
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- Now pull Frankenstein Fullnode docker image from dockerhub.
docker pull oneledgertech/frankenstein:v0.18.11
- List out docker images
docker images
The result will be similar to the below
REPOSITORY TAG IMAGE ID CREATED SIZE
oneledgertech/frankenstein v0.18.11 e20d8d1abd0a 20 hours ago 971MB
- Now run the docker image to start Frankenstein Fullnode inside a docker container, "image-id" can be found in the above result
docker run -d -p 8000:80 "image-id" (Use available port)
- List out docker container where our frankenstein image is running
docker ps
The result will be similar to the below
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
524a3351778f frankenstein:v0.18.11 "/bin/bash" 1 min ago Up 1 min 0.0.0.0:80->8080/tcp frankenstein
- Now connect to docker container, "Container-id" can be found in the above result
docker exec -it "Container-id" bash
cd /home/node/go/data
- Validate node status
- Go to frankenstein explorer, check out the current block height
- Use
olclient validatorset
command to see the block height showing on this node
The node will take some time to catch up to frankenstein current height, wait until two heights are same or with only 1~2 block difference
- Set timezone to UTC.
sudo timedatectl set-timezone UTC
- Install Kubernetes cluster with one master node. First, login as ‘sudo’ user because the following set of commands need to be executed with ‘sudo’ permissions. Then, update your ‘apt-get’ repository.
$ sudo su
# apt-get update
- Turn off swap space, otherwise kubernetes will start throwing random errors.
swapoff -a; sed -i '/swap/d' /etc/fstab
- Now update sysctl settings for Kubernetes networking.
cat >>/etc/sysctl.d/kubernetes.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
- To set your Virtual Machine with static IP modify the network interfaces file. Run following command to open the file:
# nano /etc/network/interfaces
Now enter the following lines in the file:
auto enp0s8
iface enp0s8 inet static
address <IP-Address-Of-VM>
Then press ‘Ctrl+X’, then press ‘Y’ and then press ‘Enter’ to Save the file.
After this, restart your machine.
- Install openssh-server
# apt-get install openssh-server
- Now we have to install docker because docker images will be used for managing containers in the cluster. Run the following commands:
# apt-get update
# apt-get install -y docker.io
- Next we have to install three essential components(kubeadm, Kubelet and Kubectl) for setting up Kubernetes environment. 'Kubelet' is responsible for what's running on the machine. 'Kubeadm' is used for administrating the kubernetes cluster. 'Kubectl' is used for controlling configurations on nodes inside the cluster. Run the following commands to setup Kubernetes environment.
# apt-get update && apt-get install -y apt-transport-https curl
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
# apt-get update
# apt-get install -y kubelet kubeadm kubectl
- Update kubernetes configuration file, Run the below command:
# nano /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
This will open a text editor, enter the following line after the last “Environment Variable”:
Environment=”cgroup-driver=systemd/cgroup-driver=cgroupfs”
Now press Ctrl+X, then press Y, and then press Enter to Save.
- Now Initialize Kubernetes Cluster, Update the below command with the ip address of your machine.
kubeadm init --apiserver-advertise-address=<IP-Address-Of-VM> --pod-network-cidr=192.168.0.0/16 --ignore-preflight-errors=all
- After you initialize kubernetes cluster you will get the below output:
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join <IP-Address-Of-VM>:6443 --token 4v1bct.fcgl0wao43bg0vcu \
--discovery-token-ca-cert-hash sha256:a28cdb5bd3e2727b05c3286c96ca2d341eca055fc0b29a6246fdb322218d1ce5
- Now Deploy Calico network.
kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
- If you want to be able to run kubectl commands as non-root user, then as a non-root user perform these:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
- Our Kubernetes control-plane has initialized successfully, Now run the following command to make our master node ready:
kubectl taint nodes --all node-role.kubernetes.io/master-
- 'kubectl get nodes' result will be similar to below:
NAME STATUS ROLES AGE VERSION
<Your-machine-name> Ready control-plane,master 22h v1.21.1
- Now to setup Oneledger chronos fullnode, First we create a 'PersistentVolume' which is a storage resource in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes and 'PersistentVolumeClaim' is a request for storage by a user to consume PV resources. This PVC volume store your node data.
cd $HOME (You can use your preferred path)
Run the below command:
nano fullnode-pv.yaml
This will open a text editor, enter the following lines:
apiVersion: v1
kind: PersistentVolume
metadata:
name: fullnode-pv
spec:
capacity:
storage: 60Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: fullnode-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 60Gi
- Now run 'kubectl apply -f fullnode-pv.yaml' it will create volumes.
'kubectl get pv' result will be similar to below:
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
fullnode-pv 60Gi RWX Retain Bound default/fullnode-pvc 22h
'kubectl get pvc' result will be similar to below:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
fullnode-pvc Bound fullnode-pv 60Gi RWX 22h
- Now we create pod yaml to start our fullnode. Run the following commmand:
nano frankenstein-fullnode.yaml
This will open a text editor, enter the following lines:
apiVersion: v1
kind: Pod
metadata:
name: frankenstein-fullnode
labels:
app: frankenstein-fullnode
spec:
containers:
- name: frankenstein-fullnode
image: oneledgertech/frankenstein:v0.18.11
imagePullPolicy: "Always"
volumeMounts:
- mountPath: /home
name: fullnode-pv
#readOnly: true
volumes:
- name: fullnode-pv
persistentVolumeClaim:
claimName: fullnode-pvc
#readOnly: true
- Now run 'kubectl apply -f frankenstein-fullnode.yaml' it will start fullnode.
'kubectl get pods' result will be similar to below:
NAME READY STATUS RESTARTS AGE
frankenstein-fullnode 1/1 Running 0 3s
- Now connect to the container, container_name can be found in the above result
kubectl exec -it frankenstein-fullnode /bin/bash
cd /home/node/go/data
- Validate node status
- Go to frankenstein explorer, check out the current block height
- Use
olclient validatorset
command to see the block height showing on this node
The node will take some time to catch up to chronos current height, wait until two heights are same or with only 1~2 block difference
© OneLedger 2018-2020 Contact Information