Skip to content

Commit

Permalink
Refs #1, Changed the node by minion paradigm in all users texts to re…
Browse files Browse the repository at this point in the history
…flect the fact that non manager nodes are just minions runnig skywire/node app
  • Loading branch information
stdevPavelmc committed Feb 20, 2019
1 parent 7f86344 commit 5ffad66
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The preferred method to configure & flash skybian images is by using this GUI to

### Installing

To install this tool, go to the [Releases](https://github.com/skycoin/skyflash/releases) link on this page and grab the file corresponding to your OS, use the following table to figure it out:
To install this tool, go to the [Releases](https://github.com/skycoin/skyflash/releases) link on this page and grab the file corresponding file to your OS, use the following table to figure it out:

| Operating System | You must download the one... |
|:----------------:|:--------------------------------:|
Expand Down Expand Up @@ -49,14 +49,14 @@ For a default configuration of skybian as a skyminer you just need to run it lik
./skyflash-cli -a Skybian-0.1.0.img
```

This will generate 8 images, one for the manager and 7 nodes. Network configuration is the skyminers default:
This will generate 8 images, one for the manager and 7 minions. Network configuration is the skyminers default:

* Network: 192.168.0.0/24
* Netmask: 255.255.255.0 (aka: /24)
* Gateway: 192.168.0.1
* DNS servers: 1.0.0.1, 1.1.1.1
* Manager IP: 192.168.0.2
* Node IPs: 192.168.0.[3-9] (7 nodes)
* Minions IPs: 192.168.0.[3-9] (7 minions)

If you need a different setup just check the `skyflash-cli -h` to know more, for example for a manager and 22 nodes with this details:

Expand Down
47 changes: 25 additions & 22 deletions skyflash/data/skyflash-cli
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ OPTIONS:
-g: Gateway IP for the network
-m: Manager IP on the network
-d: DNS to use, can be more than one like this "1.0.0.1, 1.1.1.1"
-n: [A-B] the range of the IPs to use on the network
-a: All defaults set networks by the defaults
-n: [A-B] the range of the IPs to use on the network for the minions
-a: All defaults: set networks by the defaults
-v: Version of the script
-i: Image file
Expand All @@ -55,7 +55,7 @@ Network defaults:
Gateway: 192.168.0.1
DNS servers: 1.0.0.1, 1.1.1.1
Manager IP: 192.168.0.2
Node IPs: 192.168.0.[3-9] (7 nodes)
Minion IPs: 192.168.0.[3-9] (7 minions)
Warnings:
* By now you need to provide the downloaded image to the script, no download
Expand All @@ -70,25 +70,28 @@ Warnings:
* Option '-n' refers to the last digit of the IPv4 address, base is taken
from the manager. It´s a continuous range from A to B [A-B] both inclusive
Configured images will be placed on the same directory of the base image and will be
appened the suffixes: '-manager' and 'nodeN' where N is a incremental number from 0
Configured images will be placed on the same directory of the base image and
will be appened the suffixes: '-manager' and 'minionN' where N is a
incremental number from 0
Examples:
Configure a base image with defaults: 8 images, one manager and 7 nodes, gw is
192.168.0.1, 192.168.1.2 is the manager and 192.168.1.3..192.168.1.9 are nodes
Configure a base image with defaults: 8 images, one manager and 7 minions,
gw is 192.168.0.1, 192.168.1.2 is the manager and 192.168.1.3..192.168.1.9
are minions
$0 -a skybian.img
Configure 1 manager and 10 nodes, network 192.168.100.0/24, gw is 192.168.100.254
manager is 192.168.100.50 & nodes are 192.168.100.90 - 192.168.100.99
Configure 1 manager and 10 minions, network 192.168.100.0/24, gw is
192.168.100.254 manager is 192.168.100.50 & minions are 192.168.100.90
- 192.168.100.99
$0 -g 192.168.100.254 -m 192.168.100.50 -n 90-100 -i skybian.img
The same of above but with custom DNS servers (using a local forwarder) please
note the use of the "" to glob both servers on one argument and the ', '
separating the DNS servers IPs
The same of above but with custom DNS servers (using a local forwarder)
please note the use of the "" to glob both servers on one argument and
the ', ' separating the DNS servers IPs
$0 -g 192.168.100.254 -m 192.168.100.50 -n 90-100 \
$0 -g 192.168.100.254 -m 192.168.100.50 -n 90-100 \\
-d "192.168.100.254, 1.1.1.1" -i skybian.img
EOF
Expand Down Expand Up @@ -146,7 +149,7 @@ function set_defaults() {
# check for blank/bad arguments.
function blank_bad_args() {
# exits with an error if an arg is missing, else pass silent
local raw=`echo "Gateway:$1 Manager:$2 Nodes:$3 Image:$4 DNS:$5" | xargs`
local raw=`echo "Gateway:$1 Manager:$2 Minions:$3 Image:$4 DNS:$5" | xargs`

for arg in $raw ; do
# extract
Expand Down Expand Up @@ -210,15 +213,15 @@ function validate_generate_nodes() {
# validate start </!= stop
if [ $start -eq $stop -o $start -gt $stop ] ; then
# not equal, nor backwards
echo "Error: Node start number in range must be lower than end one [$2] is wrong"
echo "Error: Minion start number in range must be lower than end one [$2] is wrong"
echo "Please fix that"
exit 1
fi

# validate stop being less than 254
if [ $stop -gt 254 ] ; then
# can't fit on a subnet
echo "Error: last digit of a node IP can be 255 or greater"
echo "Error: last digit of a minions IP can be 255 or greater"
echo "Please fix that"
exit 1
fi
Expand All @@ -238,7 +241,7 @@ function validate_generate_nodes() {
local ismgt=`echo $NODEIPS | grep "$MAN "`
if [ -n "$isgwt" -o -n "$ismgt" ] ; then
# manager or gateway in node range
echo "Error: manager and gateway IPs can be on the node ranges"
echo "Error: manager and gateway IPs can be on the minion's ranges"
echo "Please fix that"
exit 1
fi
Expand All @@ -253,8 +256,8 @@ function display_proceed() {
echo "Gateway is: $GW"
echo "DNS is: $DNS"
echo "Manager is: $MAN"
echo "Will build $NAMOUNT nodes with the following IPs:"
echo "$NODEIPS"
echo "Will build $NAMOUNT minions with the following IPs:"
echo "$NODEIPS" | tr ' ' '\n'
echo ""
echo "All looks good, take a time to review the info, will resume the work in"
echo "30 seconds if no answer, this is the last chance to quit."
Expand Down Expand Up @@ -290,13 +293,13 @@ function create_images() {

# check for old files
local OLDMAN=`ls | grep manager | grep \.img`
local OLDNOD=`ls | grep node | grep \.img`
local OLDNOD=`ls | grep minion | grep \.img`
if [ -n "$OLDMAN" -o -n "$OLDNOD" ] ; then
# yes, there is old files here
echo "Warning: there are old generated files on the FS, will erase them"
echo ""
rm -f *manager*img
rm -f *node*img
rm -f *minion*img
fi

# iterate
Expand All @@ -310,7 +313,7 @@ function create_images() {
if [ "$type" = "manager" ] ; then
IMAGE=$name-$type.img
else
IMAGE=$name-$type$count.img
IMAGE=$name-minion$count.img
count=`echo "$count + 1" | bc`
fi

Expand Down
12 changes: 6 additions & 6 deletions skyflash/data/skyflash.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ ApplicationWindow {
radius: 3

Label {
text: "1. Download it or browse a local Skybian release file:"
text: "1. Download or browse a local Skybian release file:"
font.pixelSize: 14
font.bold: true
color: "black"
Expand Down Expand Up @@ -207,7 +207,7 @@ ApplicationWindow {
// defaults CheckBox
CheckBox {
id: ckbDefaultNetwork
text: "Use skyminner defaults"
text: "Use the Skyminer's defaults"
checked: true

onCheckedChanged: {
Expand Down Expand Up @@ -292,7 +292,7 @@ ApplicationWindow {
}

// node count
Label { text: "Node's count:" }
Label { text: "Minions count:" }

TextField {
id: txtNodes
Expand All @@ -302,7 +302,7 @@ ApplicationWindow {
maximumLength: 5
enabled: false
inputMask: "000"
// ToolTip.text: "How many nodes we must build images for, not counting the manager node"
// ToolTip.text: "How many minions we must build images for, not counting the manager node"
}
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ ApplicationWindow {
// build button
Button {
id: btBuild
text: "Build the Images "
text: "Build the images "

onClicked: {
// call skyflash to build the images
Expand Down Expand Up @@ -505,7 +505,7 @@ ApplicationWindow {
anchors.fill: parent
Label {
id: sbText
text: "Welcomed, please follow the steps"
text: "Welcome, please follow the steps"
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions skyflash/skyflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
imageConfigDataSize = 256

# skybian URL
# TODO Change it to the final skycoin repository
skybianUrl = "https://github.com/simelo/skybian/releases/download/0.1.0-alpha/Skybian-0.1.0-alpha.tar.xz"

# OS dependent imports for windows.
Expand Down Expand Up @@ -917,16 +918,16 @@ def validateNetworkData(self, gw, dns, manager, nodes):
# validation #4, node counts + ip is not bigger than 255
endip = int(manager[manager.rfind('.') + 1:]) + int(nodes)
if endip > 255:
self.uiError.emit("Validation error", "The node IP distribution is beyond 255, please lower your manager ip",
"The IP of the nodes are distributed from the manager IP and up, if you set the manager node IP so high the node count may not fit")
logging.debug("Manager IP to high, last node will be {} and that's not possible".format(endip))
self.uiError.emit("Validation error", "The nodes IP distribution is beyond 255, please lower your manager ip",
"The IP of the minions are distributed from the manager IP and up, if you set the manager node IP so high the minion count may not fit")
logging.debug("Manager IP to high, last minion will be {} and that's not possible".format(endip))
return False

# validation #5, gw not in manager & nodes range
if int(gw[gw.rfind('.') + 1:]) in range(int(manager[manager.rfind('.') + 1:]), endip):
self.uiError.emit("Validation error", "Please check your GW, Manager & Node selection, the GW is one of the Nodes or Manager IPs",
"When we distribute the manager & nodes IP we found that the GW is one of that IP and that's wrong")
logging.debug("GW ip is on generated nodes range.")
self.uiError.emit("Validation error", "Please check your GW, Manager & Minion selection, the GW is one of the Minions or Manager IPs",
"When we distribute the manager & Minions IP we found that the GW is one of that IP and that's wrong")
logging.debug("GW ip is on generated Minions range.")
return False

# If you reached this point then all is ok
Expand Down Expand Up @@ -1021,9 +1022,9 @@ def buildTheImages(self, data_callback, progress_callback):
# new file and it's name
nodeNick = "manager"
if nip != self.netManager:
nodeNick = "node-" + str(actual)
nodeNick = "minion-" + str(actual)

nodeName = "Skywire_your_" + nodeNick + ".img"
nodeName = "Skybian_your_" + nodeNick + ".img"

nnfp = os.path.join(self.localPath, nodeName)
newNode = open(nnfp, 'wb')
Expand Down

0 comments on commit 5ffad66

Please sign in to comment.