Here is a little script I’m trying to optimize for easy testnet installation on Linux. Thoughts?
EDIT: I’m updating the OP as we go along.
#!/bin/bash
# Testing on Librem laptop 29.1.
# Edit the variables to fit your Linux system.
LOCAL_IP=$(echo `ifdata -pa wlp1s0`)
PUBLIC_IP=$(echo `curl -s ifconfig.me`)
SAFE_PORT=12001
COMNET=comnet
MAX_NODE_CAPACITY=$(numfmt --from auto 5Gi)
# Install Safe software and configuration
rm -rf $HOME/.safe
curl -so- https://raw.githubusercontent.com/maidsafe/safe_network/master/resources/scripts/install.sh | bash
safe networks add $COMNET https://sn-comnet.s3.eu-west-2.amazonaws.com/node_connection_info.config
export SN_CLI_QUERY_TIMEOUT=3600
# Join a node from home
safe node install
echo "Node install completed"
RUST_LOG=safe_network=trace ~/.safe/node/sn_node --max-capacity $MAX_NODE_CAPACITY --local-addr $LOCAL_IP:$SAFE_PORT --public-addr $PUBLIC_IP:$SAFE_PORT --skip-auto-port-forwarding --log-dir ~/.safe/node/local_node
# Update vdash
cargo install vdash
# Use vdash to watch your node working. Can this be done in the same terminal window?
#vdash ~/.safe/node/local_node/sn_node.log
This will vary depending on your kit and linux distro, you should know your own local IP anyway and be able to type it in.
It may not be strictly necessary but it does no harm - leave it
Again, may not be strictly necessary for 99% of us. May be useful for folk with very old kit, again it does no harm - leave it unless saving 2 secs is important.
Not sure why you chose port 12001, AFAICT 12000 works well for everyone - tell me if Im wrong. please.
I ended up forwarding port 12000 on one machine, and 12001 on the other. I’m not sure this makes any sense.
The script is obviously not for everyone, so I want to make it as simple as possible. I’m also trying to understand each command. I’m removing “sleep” and “switch” for now.
@tfa’s suggestion looks a bit “scary”, but so does just a long string of numbers, so I’ll implement that.
I’ll keep editing the OP as we go along. There are no guarantees it will work, but maybe it’ll be useful to somebody besides me.
thats what matters, if it helps one person get one step forward then its all good
the safe networks switch command is simply Good Practice If Somewhat Verbose
as is safe networks check to start with and end with safe networks to display the table of connections - which normally will only show one entry for 99% of users. But check if there is an asterisk * next to that entry. If there is no ‘*’, then your client knows about the genesis node but has not yet been told to switch to it.
sleep 2 just adds a 2 sec pause - gives folk time to read any output - I’d leave it in TBH.
@tfa 's suggestion is a lot less scary than mistyping a long string - good idea
It does, I didnt know you had two machines running. Most n00bs will only have one so KISS and leave it at 12000.
Keep at it. Your homework is to get the script to ask the user to input their local IP
Hint: will probably start 192.168
For extra credit, ask what vault size they want, but default to 5Gb.