Add node storage on the fog master server.
-
Good morning guys
I know that a new fog node is automatically added to the fog master. However, I created a node container to facilitate its implementation. I have two docker images. One runs the fog installation script in storage mode when it is being started and is later automatically added to the fog master. The other fog node image is already preconfigured and does not automatically enter the fog master. I would like to know what command the script executes to add the fog node to the fog master so that I can place it in the execution of the docker container.
Thank you very much -
@kamburta it’s removed after installation to prevent issues and exposures but you can copy the installer locations: packages/web/maintenance folder to your specifically the ‘create_update_node.php’ file.
It’s used as such in the script:
https://github.com/FOGProject/fogproject/blob/master/lib/common/functions.sh#L38C1-L51C2Specifically this is the function call that does it:
registerStorageNode() { [[ -z $webroot ]] && webroot="/" dots "Checking if this node is registered" storageNodeExists=$(wget --no-check-certificate -qO - ${httpproto}://${ipaddress}${webroot}/maintenance/check_node_exists.php --post-data="ip=${ipaddress}") echo "Done" if [[ $storageNodeExists != exists ]]; then [[ -z $maxClients ]] && maxClients=10 dots "Node being registered" curl -s -k -X POST -d "newNode" -d "name=$(echo -n $ipaddress|base64)" -d "path=$(echo -n $storageLocation|base64)" -d "ftppath=$(echo -n $storageLocation|base64)" -d "snapinpath=$(echo -n $snapindir|base64)" -d "sslpath=$(echo -n $sslpath|base64)" -d "ip=$(echo -n $ipaddress|base64)" -d "maxClients=$(echo -n $maxClients|base64)" -d "user=$(echo -n $username|base64)" --data-urlencode "pass=$(echo -n $password|base64)" -d "interface=$(echo -n $interface|base64)" -d "bandwidth=1" -d "webroot=$(echo -n $webroot|base64)" -d "fogverified" ${httpproto}://${ipaddress}${webroot}/maintenance/create_update_node.php echo "Done" else echo " * Node is registered" fi }
-
@Tom-Elliott
Thank you very much Tom-Elliott. In fact, I had already found this information but I didn’t know what to do or how to do it. I was thinking something more or less like this: mysql -u -p’ ’ -h fog. It would be interesting to have an option here just to perform this task. Thank you so much. I’ll work on it.usage() {
echo -e “Usage: $0 [-h?dEUuHSCKYXTFA] [-f <filename>] [-N <databasename>]”
echo -e “\t\t[-D </directory/to/document/root/>] [-c <ssl-path>]”
echo -e “\t\t[-W <webroot/to/fog/after/docroot/>] [-B </backup/path/>]”
echo -e “\t\t[-s <192.168.1.10>] [-e <192.168.1.254>] [-b <undionly.kpxe>]”
echo -e “\t-h -? --help\t\t\tDisplay this info”
echo -e “\t-o --oldcopy\t\t\tCopy back old data”
echo -e “\t-d --no-defaults\t\tDon’t guess defaults”
echo -e “\t-U --no-upgrade\t\tDon’t attempt to upgrade”
echo -e “\t-H --no-htmldoc\t\tNo htmldoc, means no PDFs”
echo -e “\t-S --force-https\t\tForce HTTPS for all comunication”
echo -e “\t-C --recreate-CA\t\tRecreate the CA Keys”
echo -e “\t-K --recreate-keys\t\tRecreate the SSL Keys”
echo -e “\t-Y -y --autoaccept\t\tAuto accept defaults and install”
echo -e “\t-f --file\t\t\tUse different update file”
echo -e “\t-c --ssl-path\t\tSpecify the ssl path”
echo -e “\t \t\t\t\tdefaults to /opt/fog/snapins/ssl”
echo -e “\t-D --docroot\t\t\tSpecify the Apache Docroot for fog”
echo -e “\t \t\t\t\tdefaults to OS DocumentRoot”
echo -e “\t-W --webroot\t\t\tSpecify the web root url want fog to use”
echo -e "\t \t\t\t\t(E.G. http://127.0.0.1/fog,"
echo -e “\t \t\t\t\t http://127.0.0.1/)”
echo -e “\t \t\t\t\tDefaults to /fog/”
echo -e “\t-B --backuppath\t\tSpecify the backup path”
echo -e “\t --uninstall\t\tUninstall FOG”
echo -e “\t-s --startrange\t\tDHCP Start range”
echo -e “\t-e --endrange\t\tDHCP End range”
echo -e “\t-b --bootfile\t\tDHCP Boot file”
echo -e “\t-E --no-exportbuild\t\tSkip building nfs file”
echo -e “\t-X --exitFail\t\tDo not exit if item fails”
echo -e “\t-T --no-tftpbuild\t\tDo not rebuild the tftpd config file”
echo -e “\t-F --no-vhost\t\tDo not overwrite vhost file”
echo -e “\t-A --arm-support\t\tInstall kernel and initrd for ARM platforms”
exit 0
} -
@kamburta Or you could just source the installer and call the function:
source /path/to/fog/installer/lib/commons/functions.sh source /opt/fog/.fogsettings registerStorageNode
Assuming the fogsettings file has the information to your master node.
-
@Tom-Elliott
Thank you very much and sorry for my English. I created a structure with a master server and eleven node servers in virtual machines and I intend to place the nodes in containers. It was a really cool structure. I’ll work on it. -
@Tom-Elliott
Yes, the fog settings are there and correct.
The command execute as expected but did not appear in master. See the output../add_storage.sh
- Checking if this node is registered…Done
- Node being registered…Done
Could it be that an update command is missing from the master server database?
I made a small change to the script, it presents an output but does not add it to the master
source /fogproject/lib/common/functions.sh
source /opt/fog/.fogsettings
checkDatabaseConnection
registerStorageNode
updateStorageNodeCredentialsExit
./add_storage.sh- Checking connection to master database…OK
- Checking if this node is registered…Done
- Node being registered…Done
- Ensuring node username and passwords match…Done
Note: When the installation script runs completely, it works.
-
@kamburta Wondering if the “node” thinks it’s the master?
For example, let’s say your fogsettings has the snmysqlserver snmysqluser snmysqlpassword has the local database on the storage node rather than the “master” information?
-
@Tom-Elliott
No, the node points to the master configurations.
installtype=‘S’
snmysqluser=‘fogstorage’
snmysqlpass=‘password’
snmysqlhost=‘ip_master’using the fogproject/bin/installfog.sh
-
Checking if this node is registered…Done
-
Node being registered…Done
-
Ensuring node username and passwords match…Done
-
Setup complete
-
You still need to setup this node in the fog management
| portal. You will need the username and password listed
| below. -
Management Server URL:
http://fog.test.test/fog/You will need this, write this down!
IP Address: 172.17.0.2
Interface: eth0
Management Username: fogproject
Management Password: password
I redid the installation using the fogproject/bin/installfog.sh script and everything went well. I deleted the storage node from the master and ran the commands below again, it returned success but the storage node was not added to the master.
source /fogproject/lib/common/functions.sh
source /opt/fog/.fogsettings
registerStorageNode -