Package: nearup
nearupLaunch NEARbetanetandtestnetnodes.PrepareInstallUpgradeGetting StartedUsing the official binaryUsing a locally compiled binarySpawn a local networkOperatingStop a running node or all running nodes in local networkAdditional optionsDockerBuilding the docker imagePull the docker imageRunningnearupwith DockerRunning in detached modeCheck if the container is runningExecutenearupcommands in containernearuplogsStop the docker containerDevelopmentCommon commandsPrepareBefore you proceed, make sure you havePython 3andpip3installed.On ubuntu, you can install with,sudo apt update
sudo apt install python3 python3-pip python3-dev:warning: Upgrade pip if needed you are getting a Permission Denied error or version of pip (pip3 --version) is below 20.pip3 install --upgrade pipInstall:warning: Make sure that you are installing with the--userflag.pip3 install --user nearupVerify that you local installation is inpython3 -m site --user-baseunder bin directory by running:which nearup:warning: If the above returns nothing, addnearupto your$PATHin~/.profile,~/.bashrc, or appropriate shell config.USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"Upgrade:warning: If you have already installednearup, you can upgrade to the latest version by using the command belowpip3 install --user --upgrade nearupGetting StartedUsing the official binaryThis is recommended for running on serversYou can start your node with (remove the--interactiveflag if you don't want to be prompted):nearup run betanet --interactiveReplacebetanetif you want to use a different network.Using a locally compiled binaryRecommended for security critical validators or during development.Clone and compile nearcore withmake releaseormake debugfirst.nearup run betanet --binary-path path/to/nearcore/target/{debug, release}Replacebetanetwithtestnetif you want to use a different network.Spawn a local networkClone and compile nearcore withmake releaseormake debugfirst.nearup run localnet --binary-path path/to/nearcore/target/{debug, release}By default it will spawn 4 nodes validating in 1 shard.
RPC ports of each nodes will be consecutive starting from 3030.
Access one node status usinghttp://localhost:3030/statusOperatingStop a running node or all running nodes in local networknearup stopAdditional optionsnearup run betanet --helpDockerBuilding the docker imagedocker build . -t nearprotocol/nearupPull the docker imageIf you don't want to build a docker image locally, you can pull thelatestfrom Docker Hub,docker pull nearprotocol/nearupRunningnearupwith Docker:warning:nearupandneardare running inside the container, to ensure you don't lose your data which should live on the host you have to mount the ~/.near folder.
To run thenearupdocker image run:docker run -v $HOME/.near:/root/.near -p 3030:3030 --name nearup nearprotocol/nearup run betanetRunning in detached modeTo runnearupin docker's detached (non-blocking) mode, you can add-dto thedocker runcommand,docker run -v $HOME/.near:/root/.near -p 3030:3030 -d --name nearup nearprotocol/nearup run betanetCheck if the container is runningdocker psCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS           PORTS               NAMES
fc17f7f7fae0        nearup              "/root/start.sh run …"   3 minutes ago       Up 3 minutes     324324         mystifying_mooreExecutenearupcommands in containerTo execute othernearupcommands likelogs,stop,run, you can usedocker exec,docker exec nearup nearup logs
docker exec nearup nearup stop
docker exec nearup nearup run {betanet/testnet}(The container is running in a busy wait loop, so the container won't die.)nearuplogsTo get theneardlogs run:docker exec nearup nearup logsor,docker exec nearup nearup logs --followTo get thenearuplogs run:docker logs -f nearupStop the docker containerdocker kill nearupDevelopmentTo build a development image:docker build . -t nearprotocol/nearup:devThe following will mount your repo directory into the running container and drop you into a shell to run test commands.docker run -it --entrypoint "" -v $PWD:/root/nearup -v $HOME/.near:/root/.near -w /root/nearup nearprotocol/nearup:dev bashCommon commandsFor testing and other checks,nearupusestox.To install,pip3 install --user toxUnit teststoxUnit tests w/ coveragetox -e coverageLinter checkstox -e lintPython style checkstox -e style