farmerbot

command module
v0.0.0-...-6bcc447 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

Farmerbot

Codacy Badge gopherbadger-tag-do-not-edit

Farmerbot is a service that a farmer can run allowing him to automatically manage the nodes of his farm.

How to start farmerbot

  • Make sure to start redis server, and get redis DB address for example: localhost:6379
sudo systemctl start redis-server
  • Create a new json file config.json and add your farm, nodes and power configurations:
{
    "farm": {
        "id": "<your farm ID>"
    },
    "nodes": [{
        "id": "<your node ID>",
        "twinID": "<your node twin ID>",
        "resources": {
            "total": {
                "SRU": "<enter total sru>",
                "MRU": "<enter total mru>",
                "HRU": "<enter total hru>",
                "CRU": "<enter total cru>"
            }
        }
    }],
    "power": {
        "periodicWakeUp": "08:30AM",
        "wakeUpThreshold": 80
    }
}
  • Get the binary

Download the latest from the releases page

  • Run the bot

After downloading the binary

sudo cp farmerbot /usr/local/bin
farmerbot -c config.json -m <mnemonics> -n dev -r <redis address> -d false -l farmerbot.log

Where:

  • -c config.json is the json file of farmerbot configurations, with a default config.json.
  • -m <mnemonics> is your farm mnemonics.
  • -n dev is your network and can be main, qa and test with a default dev.
  • -r <redis address> is your redis DB address.
  • -d false is the value of debug mode with a default false.
  • -l farmerbot.log is log file to include logs generated by farmerbot with a default farmerbot.log.

Note: 30 minutes are set for a timeout node power change

Server

You can start farmerbot server with the following command

farmerbot server -m <mnemonics> -n <grid network> -r <redis address> -d <debug> -l <log file>

Supported commands

For more examples and explanations for supported commands, see the examples

Examples

To run examples:

go run examples/example.go

Version

You can get the latest version of the farmerbot by running the following command:

farmerbot version

Test

make test

Release

  • Check goreleaser check
  • Create a tag git tag -a v1.0.1 -m "release v1.0.1"
  • Push the tag git push origin v1.0.1
  • A goreleaser workflow will release the created tag.

Documentation

Overview

Package main for starting the cmd

Copyright © 2023 NAME HERE rawda.gastan@gmail.com

Directories

Path Synopsis
Package client is responsible for client communication
Package client is responsible for client communication
Package cmd for farmerbot commands
Package cmd for farmerbot commands
Package main
Package main
Package internal for farmerbot internals
Package internal for farmerbot internals
constants
Package constants for farmerbot constants
Package constants for farmerbot constants
managers
Package manager provides how to manage nodes, farms and power
Package manager provides how to manage nodes, farms and power
models
Package models for farmerbot models.
Package models for farmerbot models.
parser
Package parser for parsing cmd configs
Package parser for parsing cmd configs
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL