# login as a root user and create a new one
adduser bastion
passwd bastion
# install editors on the system
apt install mc nano -y
# give root permissions to the user, add a line to the file
# open /etc/sudoers via mcedit
mcedit /etc/sudoers
# add this line to the file and close file
bastion ALL=(ALL:ALL) NOPASSWD:ALL
# go to user
su - bastion
# create a directory and a file to store
mkdir .ssh && nano .ssh/authorized_keys
# a public ssh key should be here
# change permissions to the directory and file
chown -R bastion:bastion /home/bastion/.ssh/ && chmod 700 /home/bastion/.ssh/ && chmod 600 /home/bastion/.ssh/authorized_keys
# disable root user remotely
sudo mcedit /etc/ssh/sshd_config
# add line to the file /etc/ssh/sshd_config
PermitRooLogin no
# restart ssh service
sudo systemctl restart sshd
$ sudo systemctl enable systemd-timesyncd
$ sudo systemctl start systemd-timesyncd
$ timedatectl status
Local time: Tue 2022-01-01 17:00:00 -03
Universal time: Tue 2022-01-01 20:00:00 UTC
RTC time: Tue 2022-01-01 20:00:00
Time zone: America/Argentina/Buenos_Aires (-03, -0300)
System clock synchronized: yes
NTP service: active <------------------- (it worked)
RTC in local TZ: no
{
"default-address-pools": [
{
"base":"172.17.0.0/12",
"size":16
},
{
"base":"192.168.0.0/16",
"size":20
},
{
"base":"10.99.0.0/16",
"size":24
}
]
}
systemctl restart docker
$ sudo curl https://dist.forta.network/pgp.public -o /usr/share/keyrings/forta-keyring.asc -s
$ echo 'deb [signed-by=/usr/share/keyrings/forta-keyring.asc] https://dist.forta.network/repositories/apt stable main' | sudo tee -a /etc/apt/sources.list.d/forta.list
$ sudo apt-get update
$ sudo apt-get install forta
$ forta init --passphrase <your_passphrase>
Scanner address: 0xAAA8C491232cB65a65FBf7F36b71220B3E695AAA
Successfully initialized at /yourname/.forta
[Service]
Environment="FORTA_DIR=<your_forta_config_dir>"
Environment="FORTA_PASSPHRASE=<your_forta_passphrase>"
mcedit .forta/config.yml
chainId: 1
scan:
jsonRpc:
# you can read more about setting up your own erigon node below
url: http://your-node-erigon:8545
trace:
jsonRpc:
url: http://your-node-erigon:8545
# Defaulting to scan node url because it is not set - the best option when running a node
# jsonRpcProxy:
# jsonRpc:
# url: http://your-node-erigon:8545
sudo systemctl daemon-reload
sudo systemctl enable forta
sudo systemctl start forta
forta status
docker ps
root@forta-prod:~# forta status
forta.container.forta-inspector.summary
⬤ ok
forta.container.forta-json-rpc.summary
⬤ ok
forta.container.forta-scanner.summary
⬤ ok: at block 15933557.
forta.container.forta-supervisor.summary
⬤ ok: all 6 service containers are running.
forta.container.forta-updater.summary
⬤ ok
forta account address
forta register --owner-address <address>
https://api.forta.network/stats/sla/scanner/YOUR_NODE_ADDRESS
apt install git make supervisor build-essential software-properties-common
# installing prysm
mkdir ethereum
cd ethereum/
mkdir consensus
cd consensus/
mkdir prysm
cd prysm/
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh
mcedit /root/.bashrc.
# add a line, mandtory indication of the prysm version and close the file
export USE_PRYSM_VERSION=v3.1.1
# generate a JWT token
cd ethereum/consensus/prysm/
./prysm.sh beacon-chain generate-auth-secret
# create a manifest to launch the prysm
cd /etc/supervisor/conf.d/
mcedit prysm.conf
# add to prysm.conf file
---
[program:beacon_eth]
command=/root/ethereum/consensus/prysm/prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --jwt-secret=/root/ethereum/consensus/prysm/jwt.hex --verbosity=debug
user=root
numprocs=1
autostart=true
autorestart=true
stderr_logfile=/var/log/prysm.log
---
# close file and call next command
systemctl restart supervisor
# check that the service has started
supervisorctl
# example of command output
supervisorctl
beacon_eth RUNNING pid 383637, uptime 30 days, 5:52:02
supervisor>
systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd
timedatectl status
git clone --recurse-submodules https://github.com/ledgerwatch/erigon.git
cd erigon
git checkout alpha
make erigon
make rpcdaemon
# create the service
mcedit /etc/systemd/system/erigon.service
---
[Unit]
Description=Erigon Node
After=network.target network-online.target
Wants=network-online.target
[Service]
WorkingDirectory=/root/erigon/
ExecStart=/root/erigon/build/bin/erigon --datadir=/erigon --private.api.addr=localhost:9090 --metrics --metrics.addr=localhost --metrics.port=6060 --http=false --authrpc.jwtsecret /root/ethereum/consensus/prysm/jwt.hex
User=root
Restart=always
RestartSec=5s
# Output to syslog
StandardOutput=syslog
StandardError=syslog
#Change this to find app logs in /var/log/syslog
SyslogIdentifier=erigon
[Install]
WantedBy=multi-user.target
---
# create the second service
mcedit /etc/systemd/system/erigon-rpc.service
---
[Unit]
Description=Erigon RPC Daemon
[Service]
WorkingDirectory=/root/erigon/
ExecStart=/root/erigon/build/bin/rpcdaemon --datadir=/erigon --private.api.addr=localhost:9090 --http.vhosts '*' --http.port 8545 --http.addr 0.0.0.0 --http.corsdomain '*' --http.api=eth,erigon,web3,net,debug,trace
User=root
Restart=always
RestartSec=5s
# Output to syslog
StandardOutput=syslog
StandardError=syslog
#Change this to find app logs in /var/log/syslog
SyslogIdentifier=erigon-rpc
[Install]
WantedBy=multi-user.target
---
sudo systemctl daemon-reload
sudo systemctl enable erigon
sudo systemctl enable erigon-rpc
sudo systemctl start erigon
sudo systemctl start erigon-rpc
curl http://localhost:3500/eth/v1/node/syncing
# how to check logs
journalctl -f -u erigon
journalctl -f -u erigon-rpc
tail -f /var/log/prysm.log
mkdir -p /etc/prometheus
sudo mkdir -p /var/lib/prometheus
# download prometheus archive
wget https://github.com/prometheus/prometheus/releases/download/v2.31.0/prometheus-2.31.0.linux-amd64.tar.gz
# unpack archive
tar -xvf prometheus-2.31.0.linux-amd64.tar.gz
# moving binary files to the system directories
cd prometheus-2.31.0.linux-amd64/
sudo mv prometheus promtool /usr/local/bin/
sudo mv consoles/ console_libraries/ /etc/prometheus/
sudo mv prometheus.yml /etc/prometheus/prometheus.yml
# prometheus version check
prometheus --version
# create the prometheus service
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
sudo chown -R prometheus:prometheus /etc/prometheus/ /var/lib/prometheus/
sudo chmod -R 775 /etc/prometheus/ /var/lib/prometheus/
# create the service
mcedit /etc/systemd/system/prometheus.service
----
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Restart=always
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090
[Install]
WantedBy=multi-user.target
----
# launch the service, add to startup, check the service status
sudo systemctl start prometheus
sudo systemctl enable prometheus
sudo systemctl status prometheus
# check availability in browser
http://IP:9090
# add parameters to configuration file
mcedit /etc/prometheus/prometheus.yml
# add to targets (local node-exporter)
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: 'servers'
static_configs:
- targets: ['127.0.0.1:9100']
sudo systemctl restart prometheus
# download dependencies
sudo apt-get install -y gnupg2 curl software-properties-common
# install Grafana
curl https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
apt-get -y install grafana
# add to startup and check the service status
systemctl enable --now grafana-server
systemctl status grafana-server.service
# check availability in browser
http://IP:3000
# default authorization is admin/admin
add prometheus http://localhost:9090 to datasource
# import dashboard with id=10180
# create a user to run the service
useradd --no-create-home --shell /bin/false node_exporter
# download the archive for further work
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
# unpack the archive
tar xvf node_exporter-1.3.1.linux-amd64.tar.gz
# copy the binary file to the system, issue the necessary rights
cp node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin
chown node_exporter:node_exporter /usr/local/bin/node_exporter
mkdir -p /prometheus/metrics
chown node_exporter:node_exporter /prometheus/metrics
# create the service
mcedit /lib/systemd/system/node_exporter.service
---
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=node_exporter
Group=node_exporter
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory=/prometheus/metrics --web.listen-address=0.0.0.0:9100
Restart=always
RestartSec=10s
NotifyAccess=all
[Install]
WantedBy=multi-user.target
---
systemctl enable node_exporter
systemctl start node_exporter
systemctl status node_exporter
# check availability in browser
http://IP:9100
# add to file /etc/prometheus/prometheus.yml
mcedit /etc/prometheus/prometheus.yml
- job_name: erigon
metrics_path: /debug/metrics/prometheus
static_configs:
- targets:
- "127.0.0.1:6060"