Massa node over docker with automations

Massa docker rykcod header

alt text

[DESCRIPTION]

Testnet 13 READY!!!

This post explain how to build a massa-node container with an image include a script named “/massa-guard/massa-guard.sh” which automate few maintenance actions.

[FEATURES]

Build a massa-node container wich include some automation features

This image include a script named “/massa-guard/massa-guard.sh” to:

  • [AUTOBUY/AUTOSELL]
    • Autobuy 1 roll when your node failed and lost his “Active rolls”.
    • Autobuy X rolls when your MAS amount greater than 200 MAS and if “Active rolls” dont exceed “TARGET_ROLL_AMOUNT” set in /massa_mount/config/config.ini (If set).
    • Autosell X rolls when “Active rolls” exceed “TARGET_ROLL_AMOUNT” set in /massa_mount/config/config.ini (If set).
  • [BOOTSTRAPFINDER]
    • Auto refresh massa online bootstrap list with connected node.
    • Filter to only add node which have TCP port 31244 & 31245 reachable.
  • [WATCHDOG]
    • Restart node when hang or when ram consumption exceed 90% (Value can be adjust)
    • You host your node under a dynamical IP? massa-guard will watch IP change and update your config.toml and push IP updates to massabot.
    • Push public IP or public IP change to massabot (Need to set discord token in /massa_mount/config/config.ini)
    • Logs his actions over /massa_mount/logs/ and backup node logs before restart if necessary.
    • Autoget MAS faucet on Discord 1 time by day (Need to set discord token in /massa_mount/config/config.ini)
  • [STARTING]
    • Massa-guard will auto register your node with massabot.
    • Massa-guard will auto create wallet + nodekey + stacke privkey.
    • Massa-guard auto create your config.toml with your public IP.
    • Massa-guard auto get faucet to buy your first roll.

[HOWTO]

[SETUP]

[PREPARE]

STEP 1: /!\ Register your discord account to the testnet program

See also  Presenting Masstronauts Series: Interview with Fares

STEP 2: Create an empty folder to mount in our container /massa_mount path or store your wallet /nodekey/stacking_key/config.toml into this folder if you have it:

  • wallet.dat
  • config.toml
  • node_privkey.key
  • staking_keys.json

/!\ If don’t have this file, leave your folder empty, massa-guard will create a wallet and node key and automaticaly stake wallet for you. This files will be backup on your mount point by massa-guard.

/!\ User of one of previous release? Please update your /massa_mount/config/config.ini to check if all entries exist. Check template last here https://github.com/rykcod/massa/blob/main/config/default_config_template.ini

/!\ v12.0.0 is the first stable release for Testnet 12. Please note Testnet 12 implement wallet and node password, with this release please start from scratch without historical testnet wallet/nodekey etc… massa-guard will generate new files with default password “MassaToTheMoon2022” (Security is not our priority during testnet)

[RUN] Usecase Example

/!\ You can define 2 ENV values when you create your container:

  • ”DISCORD” – Set with your discord token id (Refer to HELP section) – To enable discord feature (GetFaucet + NodeRegistration + DynamicalIP)
  • ”DYNIP” – Set with “0” if you host under static public IP or “1” if you host under dynimic public IP to enable update IP feature /!\ Please note, this ENV variables have a low priority if a previous config.ini exist in your mount point.
  • Container creation example with ENV variables to define Dicord token and a static IP usage :
docker run -d -v /%MY_PATH%/massa_mount:/massa_mount -p 31244-31245:31244-31245 -p 33035:33035 -e "DISCORD=OTc2MDkyTgP0OTU4NCXsNTIy.G5jqAc.b+rV4MgEnMvo48ICeGg6E_QPg4dHjlSBJA06CA" -e "DYNIP=0" --name massa-node rykcod/massa
  • To connect into your container:
docker exec -it massa-node /bin/bash
  • Connect to massa-client after container connection:
screen -x massa-client
  • Exit screen or container:
ctrl+a+d

[MAINTENANCE] After container creation

[OPTION] To enable or update features after container creation just edit /massa_mount/config/config.ini and set

  • Set your ”DISCORD_TOKEN” value to enable “Autoget MAS faucet” feature and autoregistration node and IP to massabot (Refer to HELP section)
  • Set your ”DYN_PUB_IP” value to enable dynamical IP management (0=Disable 1=Enable)
  • Set your ”TARGET_ROLL_AMOUNT” value to enable roll amount target to stake for your node (Integer value)
  • Set your ”NODE_TESTNET_REGISTRATION” value to enable node registration with massabot (KO=Enable OK=AlreadyDone)
See also  ORACLES, what are they and how do they work?

[HELP]

[LOGS PATH]

  • Massa-guard actions and events are logs into %MountPoint%/logs/massa-guard/%DATE%-massa_guard.txt
  • Massa-node events are archived after every restart into %MountPoint%/logs/massa-guard/%DATE%-logs.txt
  • You can also show massa-guard logs with a “docker logs YourContainerLogs”

[HELP – Easy beginner way for IPV6 usage]

  • Create or edit your /etc/docker/daemon.json to add:
{
  "ipv6": true,
  "fixed-cidr-v6": "fd00::/80"
}
  • Restart docker service to reload config setting
  • Allow MASQUERADE for ipv6
ip6tables -t nat -A POSTROUTING -s fd00::/80 ! -o docker0 -j MASQUERADE
  • Create a container which dynamicaly edit your iptables rules for port redirection
docker run -d --restart=always -v /var/run/docker.sock:/var/run/docker.sock:ro --cap-drop=ALL --cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=SYS_MODULE --net=host --name ipv6nat robbertkl/ipv6nat

For more informations and sources – https://github.com/rykcod/massa/

[TUTORIAL VIDEO][FR]

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

First CoinAcademy conference on 25 June 2022

Next Post

What is Massa? by Cointelegraph’s Editorial Team France


Disclaimer : This website does not invite anyone to invest in the projects we are talking about. This is simple information about crypto projects that we find interesting.
Related Posts
PhilippinesFrenchSpainUkraineRomania