Skip to content

Instantly share code, notes, and snippets.

@Folaht
Last active Jan 16, 2022
Embed
What would you like to do?
Safe podman container rootnode-ipv4 run files
#!/bin/bash
cat ~/.local/share/safe/cli/networks/sjefolaht_node_connection_info.config
echo
sudo podman exec -w /root/.safe/cli/networks/ root_node cat sjefolaht_node_connection_info.config
echo
sudo podman exec -it root_node /bin/bash
#!/bin/sh
usage()
{
echo "Usage: [-a host_address] [-p host_port] [-n network_dir] [-s storage_dir]"
}
NUM_NODES=10
NETWORK_NAME=root_node
CLI_DIR=~/.local/share/safe/cli/
CON_IP='10.88.1.3'
CON_PORT_BASE=12000
CON_PORT_MAX=$(( $CON_PORT_BASE + $NUM_NODES ))
HOST_IP='192.168.178.26'
HOST_PORT_BASE=12000
HOST_PORT_MAX=$(( $HOST_PORT_BASE + $NUM_NODES ))
PUB_IP='83.163.103.119'
PUB_PORT_BASE=12000
while getopts 'apns::?h' c
do
case $c in
a) HOST_IP=$OPTARG ;;
p) HOST_PORT=$OPTARG ;;
n) NETWORK_NAME=$OPTARG ;;
d) CLI_DIR=$OPTARG ;;
s) STORAGE_DIR=$OPTARG ;;
h|?) usage ;;
esac
done
if [ ! -d $CLI_DIR ]
then
mkdir -p $CLI_DIR
podman unshare chown root:root -R ~/.local/share/safe/cli
fi
sudo podman run \
--name $NETWORK_NAME \
--restart unless-stopped \
--publish $HOST_IP:${HOST_PORT_BASE}-${HOST_PORT_MAX}:${CON_PORT_BASE}-${CON_PORT_MAX}/udp \
--env CON_IP=$CON_IP \
--env CON_PORT=${CON_PORT_BASE} \
--env PUB_IP=$PUB_IP \
--env PUB_PORT=$PUB_PORT_BASE \
--mount type=bind,source=/home/$USER/.local/share/safe/cli/,destination=/root/.safe/cli/ \
--ip $CON_IP \
-d ghcr.io/safenetwork-community/rf-rootnode-ipv4:main-dev
sudo podman exec root_node safe networks add sjefolaht
sudo podman exec root_node safe networks switch sjefolaht
for node_count in {1..10..1}
do
CON_PORT=$(( $CON_PORT_BASE + $node_count))
PUB_PORT=$(( $PUB_PORT_BASE + $node_count))
sudo podman exec -d $NETWORK_NAME sn_node -vv \
--idle-timeout-msec 5500 \
--keep-alive-interval-msec 4000 \
--skip-auto-port-forwarding \
--local-addr $CON_IP:$CON_PORT \
--public-addr $PUB_IP:$PUB_PORT \
--log-dir /root/.safe/node/node_dir_${node_count} \
--root-dir /root/.safe/node/node_dir_${node_count}
done
#!/bin/sh
usage()
{
echo "Usage: [-a host_address] [-p host_port] [-n network_dir] [-s storage_dir]"
}
NUM_NODES=10
NETWORK_NAME=root_node
CLI_DIR=~/.local/share/safe/cli/
CON_IP='10.88.1.3'
CON_PORT_BASE=12000
CON_PORT_MAX=$(( $CON_PORT_BASE + $NUM_NODES ))
HOST_IP='192.168.178.26'
HOST_PORT_BASE=12000
HOST_PORT_MAX=$(( $HOST_PORT_BASE + $NUM_NODES ))
PUB_IP='83.163.103.119'
PUB_PORT_BASE=12000
while getopts 'apns::?h' c
do
case $c in
a) HOST_IP=$OPTARG ;;
p) HOST_PORT=$OPTARG ;;
n) NETWORK_NAME=$OPTARG ;;
d) CLI_DIR=$OPTARG ;;
s) STORAGE_DIR=$OPTARG ;;
h|?) usage ;;
esac
done
if [ ! -d $CLI_DIR ]
then
mkdir -p $CLI_DIR
podman unshare chown root:root -R ~/.local/share/safe/cli
fi
sudo podman run \
--name $NETWORK_NAME \
--restart unless-stopped \
--publish $HOST_IP:${HOST_PORT_BASE}-${HOST_PORT_MAX}:${CON_PORT_BASE}-${CON_PORT_MAX}/udp \
--env CON_IP=$CON_IP \
--env CON_PORT=${CON_PORT_BASE} \
--env PUB_IP=$PUB_IP \
--env PUB_PORT=$PUB_PORT_BASE \
--mount type=bind,source=/home/$USER/.local/share/safe/cli/,destination=/root/.safe/cli/ \
--ip $CON_IP \
-d ghcr.io/safenetwork-community/rf-rootnode-ipv4:main
sudo podman exec root_node safe networks add sjefolaht
sudo podman exec root_node safe networks switch sjefolaht
for node_count in {1..10..1}
do
CON_PORT=$(( $CON_PORT_BASE + $node_count))
PUB_PORT=$(( $PUB_PORT_BASE + $node_count))
sudo podman exec -d $NETWORK_NAME sn_node \
--idle-timeout-msec 5500 \
--keep-alive-interval-msec 4000 \
--skip-auto-port-forwarding \
--local-addr $CON_IP:$CON_PORT \
--public-addr $PUB_IP:$PUB_PORT \
--log-dir /root/.safe/node/node_dir_${node_count} \
--root-dir /root/.safe/node/node_dir_${node_count}
done
#!/bin/sh
usage()
{
echo "Usage: [-a host_address] [-p host_port] [-n network_dir] [-s storage_dir]"
}
CON_IP='10.88.1.3'
CON_PORT=12000
PUB_IP='83.163.103.119'
PUB_PORT=12000
HOST_IP='192.168.178.26'
HOST_PORT=12000
CLI_DIR=~/.local/share/safe/cli/
while getopts 'apns::?h' c
do
case $c in
a) HOST_IP=$OPTARG ;;
p) HOST_PORT=$OPTARG ;;
n) NETWORK_NAME=$OPTARG ;;
d) CLI_DIR=$OPTARG ;;
s) STORAGE_DIR=$OPTARG ;;
h|?) usage ;;
esac
done
if [ ! -d $CLI_DIR ]
then
mkdir -p $CLI_DIR
podman unshare chown root:root -R ~/.local/share/safe/cli
fi
sudo podman run \
--name root_node \
--restart unless-stopped \
--publish $HOST_IP:$HOST_PORT:$CON_PORT/udp \
--env CON_IP=$CON_IP \
--env CON_PORT=$CON_PORT \
--env PUB_IP=$PUB_IP \
--env PUB_PORT=$PUB_PORT \
--mount type=bind,source=/home/$USER/.local/share/safe/cli/,destination=/root/.safe/cli/ \
--ip $CON_IP \
-d ghcr.io/safenetwork-community/rf-rootnode-ipv4:main
sudo podman exec root_node safe networks add sjefolaht
#!/bin/bash
sudo podman stop root_node
sudo podman rm -f root_node
@willief
Copy link

willief commented Jan 15, 2022

Are the references to tcp not redundant?
I think they could all be deleted.

also replace each instance of "folaht" with $USER

@Folaht
Copy link
Author

Folaht commented Jan 15, 2022

Probably. I just didn't want to take any chances.
I added them because I thought I saw somewhere that tcp was being used by the safe network.
Can't recall where though. Maybe in the logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment