EdgeLab-FHDO / Edge-Diagnostic-Platform

MIT License
0 stars 2 forks source link

Edge Diagnostics App v1 #99

Closed juan-castrillon closed 3 years ago

juan-castrillon commented 3 years ago

This is far from finished but will eventually close #95.

I wanted to create this pull request now, because I thought I would share the structure I gave my application, given that I see that Theo created issues to refactor his and I believe this structure eases the whole deployment process a lot (No more sh scripts or manually typing dependencies).

The client and server apps are created as subprojects in gradle, and now is configured to run as a multi-project build. This allows tasks and sources to be specified for only client or server (Apart from handling dependencies independently and automatically). A task was created for both which creates a fatJar (with dependencies included) for them

Dockerfiles are created using docker multi-stage builds, in which the first stage, executes the gradle custom task and creates the jar, and in the second stage a lightweight image is created (with just JRE running in Alpine), the jar from the last stage is copied and executed. Arguments can be passed direcly to the container (docker build) and default parameters can be specified.

Right now my application does nothing, but the structure is ready and may be a good idea to implement also in the opencv app, what do you think @alyhasansakr ?

alyhasansakr commented 3 years ago

@juan-castrillon That is an excellent solution since we are going to have multiple applications that may share the same dependencies. @theodorelu27 Could you implement the same for the OpenCV application?

juan-castrillon commented 3 years ago

Progress so far:

juan-castrillon commented 3 years ago

Diagnostics Application V1

All commits contain the V1 of the Diagnostics Application.

Main features:

Additionally, an external tool was developed to perform experiments. This tool takes "Experiment Files" and turns them into scenarios for the platform to run. This allows to synchronize commands, and to use AdvantEDGE and RemoteControl modules in addition to the Diagnostics App.

Experiment files, define base parameters for client and server and also changes in either one of the possible categories (client, server, network, compute). This changes are explicitly declared specifing a range of values (from and to), a step in between and a scale. Current version supports changes in just one category and only decimal scale.

The application has room for improvement and as discussed, I will submit it to review to change whatever necessary.

Gradle Structure

As of right now, application subprojects are part of the root project from the platform like this:

Root project 'Edge-Diagnostic-Platform'
\--- Project ':EdgeDiagnosticsApp'
     +--- Project ':EdgeDiagnosticsApp:CommonUtils'
          - build.gradle
     +--- Project ':EdgeDiagnosticsApp:DiagnosticsClient'
          - build.gradle
     \--- Project ':EdgeDiagnosticsApp:DiagnosticsServer'
          - build.gradle
build.gradle
settings.gradle

This however, makes tasks in the Edge-Diagnostic-Platform execute also tasks in the application subprojects with the same name. For example calling gradle run on the Edge-Diagnostic-Platform, also executes run in client and server which is not desired. For this, the solution in the commits was to add a parameter to skip the tasks in the application (e.g dockerDClient, runDServer, etc.).

I believe this does not scale well, and if we are to continue doing the applications with this manner, we should restructure the whole project like this:

Root project 'ParentProject'
\--- Project ':Edge-Diagnostics-Platform'
  - build.gradle
\--- Project ':EdgeDiagnosticsApp'
     +--- Project ':EdgeDiagnosticsApp:CommonUtils'
          - build.gradle
     +--- Project ':EdgeDiagnosticsApp:DiagnosticsClient'
          - build.gradle
     \--- Project ':EdgeDiagnosticsApp:DiagnosticsServer'
          - build.gradle
settings.gradle

This is the recommended way by gradle documentation and would allow us to run tasks independently on platform and apps (just by running them from the folders or with the complete name), but also have some common things in the ParentProject. This will also allow to easily add new applications.

I did not make this structure change until know, because I believe is a big change, workflows would have to be modified and I wanted to check your opinion first @alyhasansakr

alyhasansakr commented 3 years ago

What you say is correct, the infrastructure manager is just a component in the edge diagnostics platform. We will do this refactor when both you and Theodore finish their work.

juan-castrillon commented 3 years ago

Latest changes include:

If you think the code is fine, then I think we can merge this @alyhasansakr