SudoBox FF#11

image

Fellow Boxers,

As of tomorrow Staff and selected SudoBox testers will be given the SudoBox-CLI which in turn gives them access to SudoBox Uploader.

Here’s Sudobox-CLI in action

sudobox_cli (1)

This means you can deploy the SudoBox-Uploader as seen below.

We would like you to be brutal in your testing. We conducted in-house testing however every system is different, so now it’s your turn. Naturally, we would prefer if you did follow the template for support.

Please do not worry when it comes to bug IDs or priority as we will sort that out on our end.

As you can see the CLI follows the same methods as the dashboard wherein it will hold your hand and carry you through with simple questions. The user storyboard for this is pretty huge and this is to be accessed by Staff members soon so they can collaboratively improve on it with the conclusion being conducted in Staff VC.

So how does it work?

Many parts of the Sudobox-cli now communicate directly with the Sudobox-API. For example, when you want to install a new app, a request is made to retrieve all the premade config files. When you select the app you wish to install, things like your domain name will be dynamically injected to allow the app UI to be accessible on your server. By doing this, it has completely eliminated the need to constantly pull a Github repo which caused things to be slow and inefficient. An added benefit is when we update an app on our API, the changes will be instantaneous.

Why does it matter what previous system I was on?

Since both PTS and PG utilised an older version of Traefik ( Reverse Proxy ), it’s very important that the correct configuration is used when deploying your apps. Selecting the system you used before allows us to maintain compatibility on your server.

Adding / Editing Apps

Why are we doing this

From the very beginning, we have always loved the idea of users being able to easily create and add there own apps, and in turn also wanted it to be very easy to publish those apps for others in the community to use. This of course would be through the community apps sections. Those of you who are coming from a PTS / PG background will know the basic idea behind the community apps section.

So how do we do that?

So, there will be 2 ways to accomplish this task ( Unimplemented ), The first will be through the sudobox-cli. When doing it this way, a series of questions will be asked such as name, image, ports etc. The second method would be through the Sudobox Dashboard, here you would be presented with an interactive form similar to the one above.

:bulb:Please Note
The GIF above is actually from our Sudobox Admin Dashboard, this will be our tool to add, edit and delete apps on our API, but will also give us the ability to approve community app requests. You will most likely never see this page but we though you guys would be interested in seeing it.

How does this work on a technical level

If you like hearing how things are being implemented on a more technical level, then you can continue reading, however, if you’re not too bothered then you can skip this bit.

If you don’t know already know, we utilise docker-compose to install docker containers on your servers. This works by looking at a configuration file ( .json ), as mentioned already, this configuration is hosted on our API. Both the CLI and Dashboard make requests to the API and convert it into a json file that docker-compose can understand.

The way the Editing tool generates all the inputs is by taking a JSON file and looping through all the values. It then stores this in a 1 dimensional array, along with the path to that value, and the content.

let tempArr = {};

let matching = new Map();

for (const path of propertiesToArray(app.compose)) {
    let splitPath = path.split(".");
    let endPath = splitPath[splitPath.length > 1 ? splitPath.length - 2 : splitPath.length - 1];
    if (!matching.has(endPath)) {
        matching.set(endPath, [path]);
    } else {
        matching.get(endPath).push(path);
    }
}

Array.from(matching.keys()).forEach((group) => {
    let tempArr2 = [];

    matching.get(group).forEach((a) => {
    const aSplit = a.split(".");

      tempArr2.push({
           title: aSplit.length > 1 ? `${aSplit[aSplit.length - 1]}` : `${aSplit[0]}`,
           content: a.split(".").reduce((o, i) => o[i], app.compose),
           path: a,
       });
    });
      tempArr[group] = tempArr2;
});

In addition, the way we are updating the values is through the following snippet of code. This takes in a string “.” notation such as “test.test2.test3”, loops through the JSON obj, figures out where the path is and then updates the value

const setPath = (object, path, value, index) =>
  path
    .split(".")
    .reduce(
      (o, p, i) =>
        (o[p] =
          path.split(".").length === ++i
            ? Array.isArray(o[p])
              ? [...o[p].map((t, index2) => (index === index2 ? value : t))]
              : value
            : o[p] || {}),
      object
    );

Gotta Catch 'Em All!

The most recent bug was with how file paths were being parsed into Rclone.

Sometimes, file names can be deeply nested within the server, when calculating this and parsing it into Rclone, it would sometimes fail due to Rclone not be able to properly link to the file. @Xaritomi has since taken some extra steps to solve this. Now the uploader utilises a built in Node.js module called “path.join()” which takes in a bunch of paths as arguments and then joins them up correctly in a way that your OS can understand.

Your Thoughts?

Let us know what you think below, are you looking forward to trying the upload container yourself? Have you enjoyed seeing the more technical side of the project and would you like to see more posts like this?

3 Likes

How can we volunteer to be a tester?

1 Like

We have enough testers for now. You will be able to use it soon anyway :blush:

3 Likes

I know you can’t give an exact timeline, but do you think it will be days, weeks or months? Everything looks great so far. Thanks for all the work you guys are putting into it!

@stroodle96 because the coding of the projected is done on our own time we can not pin down a date. We rather say really soon.

5 Likes

Excellent work. I am still aware of every advance and news they give :slight_smile: