Edit this page

Example for Supplier with Linux 64

Updated on 08-02-2018

Here is an example for Supplier, that uses Linux 64. Use Copy-Paste commands.

SONM MVP.RC1 workes in test mode on Rinkeby blockchain!

Preconditions: To start using SONM MVP.RC1 you need to have an account on Rinkeby blockchain. The keystore file to access your Rinkeby accout must be in UTC/JSON format. You SHOULD generate a NEW Ethereum key with SONM Wallet or CLI. Then you have to get test Ether on Rinkeby blockchain.

  1. To download SONM application (this example is for installation from binaries) open new terminal and use commands:
    cd ~/
    mkdir sonm && cd sonm
    wget https://github.com/sonm-io/core/releases/download/v0.3.2/sonm_v0.3.2_linux64.zip
    unzip sonm_v0.3.2_linux64.zip
  2. Put your keystore file to /home/< user >/keys/ directory.
  3. Set up Hub node. Use commands:
    cd sonm_v0.3.2_linux64/hub
    nano hub.yaml

Set ONLY the parameters "key_store:" and "pass_phrase:" in the hub.yaml file:

# An endpoint for miner connections.
# allowed format is "ip:port" to bind Hub to given IP address
# or ":port" to bind Hub to all available IPs
endpoint: ":15011"

# Hub as a gateway settings. Can be omitted indicating that the Hub should not
# be a gateway.
gateway:
  # Port range allocated for virtual services if any.
  ports: [32768, 33768]

# Cluster settings.
cluster:
  # An endpoint for client connections using cli
  # allowed format is "ip:port" to bind Hub to given IP address
  # or ":port" to bind Hub to all available IPs
  endpoint: ":15010"

  # An endpoint for hub announcements
  # This one useful if hub is behind router with DMZ or port forwarding
  # This endpoint will be used to communicate with hub,
  # however hub will still bind on "endpoint", not "announce_endpoint"
  # announce_endpoint: "1.2.3.4:1234"

  # Use automated failover in case of hub death
  # Requires consul, etcd or zookeeper as a store
  failover: false

  # Configuration of persistent store
  store:
    # Type of the storage to use.
    # Possible types are: "consul", "zookeeper", "etcd" and "boltdb"
    # boltDB is a local storage, so it can not be used with failover switched on
    type: "boltdb"

    # storage specific endpoint. Directory for boltdb, tcp endpoint for other types
    endpoint: "/tmp/sonm/boltdb"

    # Storage bucket to store all data in
    bucket: "sonm"

    # TLS key file for stores, supporting it
    # key_file: "/path/to/key.key

    # Cert file for stores, supporting it
    # cert_file: "/path/to/cert.crt"

  # Fine tuning
  leader_key: "sonm/hub/leader"
  member_list_key: "sonm/hub/list"
  sync_prefix: "sync_prefix"
  leader_ttl: "20s"
  announce_period: "20s"
  member_gc_period: "20s"

# Logging settings.
logging:
  # The desired logging level.
  # Allowed values in range of -1 (high verbosity) to 3 (most quiet)
  level: -1

# blockchain-specific settings.
ethereum:
  # path to keystore
  key_store: "/home/< user >/keys"
  # passphrase for keystore
  pass_phrase: "< your passphrase >"

# Locator service allows nodes to discover each other.
locator:
  # Locator gRPC endpoint, required.
  endpoint: "[email protected]:15020"
  # Background announcements period.
  update_period: "10s"

# Marketplace service settings
market:
  # marketplace gRPC endpoint, required
  endpoint: "[email protected]:15021"

whitelist:
  url: "https://raw.githubusercontent.com/sonm-io/allowed-list/master/general_whitelist.json"
  enabled: true

metrics_listen_addr: "127.0.0.1:14000"
  1. Start Hub node:
    ./sonmhub_linux64 
  2. Install Docker CE.
  3. Set up Worker. Open new terminal and use commands:
    cd ~/sonm/sonm_v0.3.0_linux64/worker
    nano worker.yaml

Set ONLY the parameters in the worker.yaml file:

  • "Hub: eth_addr:";
  • "key_store:" and "pass_phrase:";
  • if you want to provide GPU, delete "#" from "gpus:", and from the GPU's types below (nvidia or/and radeon). You cannot provide diffenent types of GPU within one deal yet.
# Hub settings.
hub:
  eth_addr: "< your hub ethereum address>"
  # Either `resolve_endpoints: true` or `endpoints` should be provided. If `resolve_endpoints`
  # is set to `true`, hub's addresses will be resolved via locator.
  resolve_endpoints: false
  endpoints: ["127.0.0.1:15011", "127.0.0.2:15011"]

#  Resources section is available only on Linux
#  If configured, all tasks will share this pool of resources.
#  This pool is a parent control group.
#  Format is Open Container Initiative Runtime Specification:
#  resources:
#    cgroup: insonmnia
#    resources:
#      # https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#memory
#      memory:
#        limit: 1000
#      # https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cpu
#      cpu:
#        quota: 1024
#        cpus: "2-3"
#      # https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#network
#      network:
#        classID: 1048577

# Logging settings.
logging:
  # The desired logging level.
  # Allowed values in range of -1 (high verbosity) to 3 (most quiet)
  level: -1

# Firewall discovery settings, optional param
# If enabled the miner tries to discover its own public IP address and the
# firewall configuration. STUN server can be configured.
# If disabled it is treated as having public IP address that is determined
# automatically.
# firewall:
#   server: "stun.ekiga.net:3478"

# A list of IPs that can be used to reach the miner, optional param. If not provided, miner's interfaces will
# be scanned for such IPs (if there's no firewall settings).
# Ignored if firewall settings are not null.
# public_ip_addrs: ["46.148.198.134"]

ethereum:
  # path to keystore
  key_store: "/home/< user >/keys"
  # passphrase for keystore
  pass_phrase: "< your passphrase >"

# locator service allows nodes to discover each other
locator:
  # locator gRPC endpoint, required
  endpoint: "[email protected]:15020"

metrics_listen_addr: "127.0.0.1:14001"

plugins:
  socket_dir: /run/docker/plugins
  volume:
    root: /var/lib/docker-volumes
    volumes:
      cifs: {}
#  gpus:
#    nvidia: {}
#    radeon: {}
  1. Start Worker node:

    ./sonmworker_linux64

    NOTE: if there is error "error while loading shared libraries: libOpenCL.so.1" then execute: "sudo apt install ocl-icd-opencl-dev", then repeat ./sonmworker_linux64

  2. Set up Client node. Open new terminal and use commands:

    cd ~/sonm/sonm_v0.3.0_linux64/node
    nano node.yaml

Set ONLY the parameters "key_store:" and "pass_phrase:" in the node.yaml file:

# Local Node settings
node:
  # address to bind Node's gRPC endpoint
  # required
  listen_addr: "127.0.0.1:15030"

# Marketplace service settings
market:
  # marketplace gRPC endpoint
  # required
  endpoint: "[email protected]:15021"

# Logging settings.
log:
  # The desired logging level.
  # Allowed values in range of -1 (high verbosity) to 3 (most quiet)
  level: -1

# locator settings
locator:
  # Locator's gRPC endpoint for Eth to IP addr resolution
  endpoint: "[email protected]:15020"

# Settings for Ethereum keys
ethereum:
  # path to keystore
  key_store: "/home/< user >/keys"
  # passphrase for keystore
  pass_phrase: "< your passphrase >"

# Hub management settings.
# Set this if you have your own Hub and want to manage it.
hub:
  # endpoint is Hub's monitoring gRPC endpoint for client connections.
  endpoint: "127.0.0.1:15010"

metrics_listen_addr: "127.0.0.1:14003"
  1. Start Client node:
    ./sonmnode_linux64 
  2. Set up SONM CLI. Open new terminal and use commands:
    cd ~/sonm/sonm_v0.3.0_linux64/cli
    nano cli.yaml

Set the parameters "key_store:" and "pass_phrase:" in the cli.yaml file:

# In what format CLI must show their output
# can be "simple" for human-readable messages
# and "json" for output in machine-readable JSON format
output_format: "simple"
ethereum:
  # path to keystore
  key_store: "/home/< user >/keys"
  # passphrase for keystore
  pass_phrase: "< your passphrase >"
  1. Move the cli.yaml file to new ~/.sonm/ directory:
    mkdir ~/.sonm
    mv cli.yaml ~/.sonm/
  2. Check CLI application by using login command. You should see your Ethereum address as an answer:
    ./sonmcli_linux64 login 

    Answer:

    Using /home/< user >/keys as KeyStore directory
    Keystore successfully opened
    Eth address: 0x02862A6...b0e3Be4ecf
  3. View your worker list:
    ./sonmcli_linux64 hub worker list
  4. Get the full information about each worker and its occupied and available resources:
    ./sonmcli_linux64 hub worker status <worker_id>
  5. Create a slot configuration file (slot.yaml) to search for orders in the Marketplace and place it to /home/< user >/sonm/sonm_v0.3.0_linux64/cli/ directory.

Example:

duration: 1h

resources:
  cpu_cores: 1
  ram_bytes: 512mb
  gpu_count: NO_GPU
  storage: 1Gb

  network:
    in: 100Mb
    out: 100Mb
    type: INCOMING

  properties:
    foo: 1101
    cycles: 42
  1. Search for BID or ASK oders matched to your slot.

    ./sonmcli_linux64 market search slot.yaml
  2. Create the ask plan for Hub using your slot configuration (price is in SNM for 1 sec working time):

    ./sonmcli_linux64 hub ask-plan create 0.0003 slot.yaml
  3. Check your deals list to see your current deals:

    ./sonmcli_linux64 deals list
  4. Check your account balance using Wallet.

The END!