New Internal Dashboard

Hi all,

You may know that at the start of the year I published with a friend an online dashboard to monitor your nodes and a place to see progression of your node.

Lots of you wanted a dashboard which is kept locally, so we worked hard to figure out how we could do this be implemented for multiple nodes or possibly multiple virtual machines running storj nodes.

IT IS NOW HERE!
News Update from StorjDashboard
GitHub Repo
Install Guide

I hope this helps you all manage your nodes easier and more so for those that have more than one node.

Finally… I want to wish everyone a happy new year !

Screenshots
Dashboard:


Docker Logs View:

Docker Container View:

Individual Node View:

17 Likes

The Stop button… is it using the stop -t300 delayed command? Or is it a forced stop?

1 Like

Thank you and your friend for this contribution !
Please invite your friend to join the community if they have not already done so.

Happy new year !

3 Likes

Hi !

Yes if this is set in your docker run command , it will do this.

Happy new year !

Are you planning on making a docker container of this?

1 Like

Not something I’ve looked into just yet, it would be good if it’s possible to make a container with nginx/php/MySQL and the GitHub all in one… will take a look :slight_smile:

Cheers
Hass

1 Like

That would be great especially for SNOs like me who don’t know what nginx/php/MySQL is… :face_with_monocle:

Definitely will look into it, maybe look at a docker install method at minimum , will need to do some testing and then could possibly make a video guide :+1:

3 Likes

Does it only work with NGINX, or will Apache2 work too?

It will work with almost any web server as long as its running PHP 8+ and you have a empty MySQL Database it can add tables to.

Hope that helps :slight_smile:

Any issues - give me a message :slight_smile:

I’m struggling at the last step of the db setup

[TEST] SQL Database Check/Test (*storjdashboard*)
[FAIL] SQL Tables Do Not Match Expected > Create DB

The mysql user storjdashboard exists and has full permissions on the database with the same name. I tested it on the command line and can create tables.

When I click on “Create DB” the next window shows the credentials, after Next I’m asked for the Admin Usernam and password. I can only assume that I create an admin user here which I use later for logging into the dashboard. Your docs don’t say anything about this step.

After typing in a username and password I’m back to the error message from the beginning and turning in circles.

Hi Donald

Let me help you with this

do you have the mysql host set as localhost, or as the local (internal) ip ?

you could also try this :

edit : /install/db_setup_complete.php
and add // in front of line 206.
this will stop the redirect, and display any error.

https://github.com/storjdashboard/storjdashboard-internal/blob/616660f47f3a4c6c6efcd19db52060f5a6a53529/web/install/db_setup_complete.php#L206

your assumption is correct, the last step is to create your account account after it has created all the tables.

Let me know how you get on

yes and I tried on the command line with -h localhost too.

When I do this, I get no errors. Everything looks ok.

Drop tables if exists
Created config
Created docker
Created login
Created nodes
Created paystubs
Flushed config
Flushed docker
Flushed login
Flushed nodes
Flushed paystubs
Admin Account Created
Config SQL Created

BUT, no tables get created

MariaDB [storjdashboard]> show tables;
Empty set (0.000 sec)

Hi Donald,

thanks for trying this !

yes, you should definitely be getting some error if there has been no tables written :confused:

PMd you – we can post a solution to this thread one once we’ve found the solution/issue here

Hass

I wanted to try this, but run into several issues.

header redirect in index is placed after empty line is already written, which is not allowed and will just throw header error.

Redirect itself ignores port number, so it will fail anyway unless default ports are used.

Once I got past that, it just broke completly:


This is because there is no error message when connection to SQL is not working.

Afterwards I ran into another issue caused by empty lines being put into HTML. This time it was session initialization, which is also header information.
It was caused by 2 empty lines inbetween php blocks in cfg.php

Hi tomaae

Could you let me know which SQL you have and if you have amended the connections/sql.php file with your DB information?

Thanks for info on the white space , will look to fix for a next version

Feel free to PM me if you get any further issues , happy to work through it and hopefully prevent anyone else getting an issue

Cheers
Hass

Just regular MySQL, latest version. I used docker compose to deploy this dashboard.
Problem there is that you are just opening a connection and not catching errors, while supressing php errors so it silently fails.
Just test check for sql errors and test connection after mysqli_connect:

if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

if (!mysqli_query($sql, "SET a=1")) {
    printf("Error message: %s\n", mysqli_error($sql));
}

Best practice to avoid whitespaces is not to use multiple php blocks, just merge them all together. There is no benefit of having multiple ones like that.

For example in index.php:

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
// COUNTING PAGE TIME

// config

?>

<?php if(!isset($_GET['page']) && file_exists("install")){header("location: install");exit;}?>
<?php if(isset($_GET['page']) && $_GET['page']=='install' && isset($_GET['complete']) && $_GET['complete']==1) {
	if(@rmdir("install")){header("location ./");}
	if(file_exists('install')){ echo "<h2>Warning: Unable to remove install directory<br><br>You must remove INSTALL folder manually if there is no FAIL tasks.<br>Otherwise you will need to fix the FAIL tasks manually.</h2>"; }else{ header("location: ./"); } exit; }?>
<?php require_once("cfg.php"); ?>
<?php if($config_row['restrict']==1){ require_once($resitrct_file); } ?>
<?php require_once($sql_conn_file); ?>
<?php if($_SERVER['QUERY_STRING']==''){	header("location: ./?page=dashboard"); };	?>

to

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
// COUNTING PAGE TIME

// config

if(!isset($_GET['page']) && file_exists("install")){header("location: install");exit;}
if(isset($_GET['page']) && $_GET['page']=='install' && isset($_GET['complete']) && $_GET['complete']==1) {
	if(@rmdir("install")){header("location ./");}
	if(file_exists('install')){ echo "<h2>Warning: Unable to remove install directory<br><br>You must remove INSTALL folder manually if there is no FAIL tasks.<br>Otherwise you will need to fix the FAIL tasks manually.</h2>"; }else{ header("location: ./"); }
    exit;
 }
require_once("cfg.php");
if($config_row['restrict']==1){ require_once($resitrct_file); }
require_once($sql_conn_file);
if($_SERVER['QUERY_STRING']==''){	header("location: ./?page=dashboard"); };
?>

This way you dont have to worry about whitespaces.

Redirects can be solved this way:

header('Location: '.($_SERVER['HTTPS'] ? 'https' : 'http').'://' . $_SERVER['HTTP_HOST'].'/install');

Only other problem I had was installer failed to delete install directory, but I didnt looked into code for that and just deleted it by hand. Everything works fine afterwards.

1 Like

Hi Tomaae,

really appriciate you taking some time for this - I will test too and make an update to the github repo :slight_smile:

I’m glad you have it all up and running

Kind regards
Hass

looking into making some changes to the /install/ directory files so that it can capture if there is no connection possible, it will go to the db_setup.php page

Thanks again Tomaae,

your index.php update, has been published and will get built in the next release.
https://github.com/storjdashboard/storjdashboard-internal/commit/a27553f4bcdd48e83d84bab685dd82971475b87e

We appriciate your input to the community project

Cheers
Hass

1 Like

It should be right after mysqli_connect. can be in different file, but always after connect before any sql commands.
That way you can show an error when mysql breaks/crashes/permission are changed. Not just during setup.