sibblegp / Storj-Dashboard-Client

Storj Dashboard Client
MIT License
20 stars 2 forks source link

register_storjdash unable to find storjshare binary when storjshare daemon is run inside Docker container #1

Closed arrrgi closed 6 years ago

arrrgi commented 6 years ago

Operating System version:

lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

Python Version

python3 -V
Python 3.5.2

Firstly, thanks @sibblegp for building this fabulous dashboard and reporting client.

I have an issue where currently one or more instances of storjshare-daemon run as Docker containers. This results in encapsulation of the binaries inside the container and data, configuration and log files residing on bind mounted volumes on the host. Would you please consider adding some additional logic to the registration process to allow client users to specify the path to their storjshare-daemon configuration file and the container name to run the "storjshare status" command against?

For example, my test host currently runs a single storjshare-daemon container which returns the results required by running docker exec -t node01 storjshare status.

Hopefully I'm not the only person who would benefit from this feature :) Perhaps later it would be great to consider building additional functionality for storjshare-daemon users who run multi instance environments on a single host.

sibblegp commented 6 years ago

Hello! Thank you for the kind comment @madcatsu! That's a very interesting use case. It might be difficult to create since we would need the names of each docker instance and then you'd have to be able to register/unregister the docker instances with the daemon as you went forward. Do you have a suggestion about how I could implement this functionality without getting too complex?

arrrgi commented 6 years ago

I'd recommend starting with a simple user input and save of the container name into the dashboard client JSON file then building a check into your examine_storjstatus() function for whether the user is using a container deployment and then exec the status of storjshare daemon with Docker that way.

As for multi-instance, I have a couple of ideas. Perhaps start with a single instance solution though :)

If you like, I'll raise multi-instance support as a feature request issue and discuss that further there.

arrrgi commented 6 years ago

FYI, just as a quick and dirty fix I have done the following:

The shell script looks like this:

#!/bin/bash
docker exec -t <container name> storjshare $1

where <container name> was replaced with the name of the Docker container.

The register_storjdash Python now complete the registration correctly and creates the crontab entry and configuration JSON.

However, I now get an error message :( in the log file as follows:

Unable to decode JSON file: storj-farmer.json

JSON config as follows (some config info redacted):


{
  // Set the SJCX/BTC address for receiving contract payments
  "paymentAddress": "REDACTED",
  // Subscribes to the given contract topics
  // See https://storj.github.io/core/tutorial-contract-topics.html
  "opcodeSubscriptions": [
    "0f01020202",
    "0f02020202",
    "0f03020202"
  ],
  // Limits the number of pending OFFER message at one time
  "maxOfferConcurrency": 3,
  // If the seedList is empty, use this bridge to discover seeds
  // Following a transfer, also send an exchange report to this bridge
  "bridgeUri": "https://api.storj.io",
  // Known preferred seeds in form of a storj URI
  // Example: "storj://[ip.or.hostname]:[port]/[nodeid]"
  "seedList": [],
  // Interface to bind RPC server, use 0.0.0.0 for all interfaces or if you
  // have a public address, use that, else leave 127.0.0.1 and Storj Share
  // will try to determine your address
  "rpcAddress": "REDACTED",
  // Port to bind for RPC server, make sure this is forwarded if behind a
  // NAT or firewall - otherwise Storj Share will try to punch out
  "rpcPort": 4000,
  // Enables NAT traversal strategies, first UPnP, then reverse HTTP tunnel
  // if that fails. Disable if you are public or using dynamic DNS
  "doNotTraverseNat": true,
  // Maximum number of tunnels to provide to the network
  // Tunnels help nodes with restrictive network configurations participate
  "maxTunnels": 0,
  // Maximum number of concurrent connections to allow
  "maxConnections": 150,
  // If providing tunnels, the starting and ending port range to open for
  // them
  "tunnelGatewayRange": {
    "min": 0,
    "max": 0
  },
  // Number of times to retry joining the network and the wait time between
  "joinRetry": {
    "times": 3,
    "interval": 5000
  },
  // Temporarily stop sending OFFER messages if more than this number of shard
  // transfers are active
  "offerBackoffLimit": 4,
  // ECDSA private key for your network identity, your Node ID is derived from
  // this and it is used to sign and verify messages
  "networkPrivateKey": "REDACTED",
  // Determines how much detail is shown in the log:
  // 4 - DEBUG | 3 - INFO | 2 - WARN | 1 - ERROR | 0 - SILENT
  "loggerVerbosity": 3,
  // Path to write the log file to disk, leave empty to default to:
  // $HOME/.config/storjshare/logs/[nodeid]_date.log
  "loggerOutputFile": "/logs",
  // Directory path to store contracts and shards
  "storagePath": "/data",
  // Amount of space to lease to the network, as human readable string
  // Valid units are B, KB, MB, GB, TB
  "storageAllocation": "1TB",
  // Periodically report your used and free capacity to Storj Labs to improve
  // the network - no personally identifiable information is sent
  "enableTelemetryReporting": true
}
Jurisg commented 6 years ago

PS "enableTelemetryReporting": true you can remove it from config not used anymore or set at least false and update "bridgeUri": "https://api.storj.io", to:

"bridges":[
    {
      "url": "https://api.storj.io",
      "extendedKey": "xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42"
    }
arrrgi commented 6 years ago

@Jurisg thanks, JSON looks to be valid now after I recreated it, I had an older version of the config file.

arrrgi commented 6 years ago

Quick update - I've built a self-contained version of Storjshare in Docker and built the Storj Dashboard Client in as an optional feature. Just requires an extra couple of flags in the docker run command. Available here on Docker Store / Hub:

https://store.docker.com/community/images/madcatsu/storjshare-multi-daemon

Feel free to mark this issue as closed now.