##################### Backend ##################### .. contents:: :local: :depth: 1 Introduction ============== Developing a backend component for a web application depends on the specific requirements and functionalities of this application. In the scope of aerOS, that considers the aerOS Basic Services as a suite of lightweight microservices (including the potential workloads to be orchestrated in the computing continuum), it is evident that heavier computing processes (e.g., data processing) must be removed from the unique web application that aims to act as the management entry point to the continuum. Thus, removing this logic from the frontend component of the portal allows to develop the frontend to just react to user actions and obtain the needed data in the expected format to be then efficiently interpreted, as well as avoiding some security issues like the well-known CORS. Therefore, the backend component acts as a middleware between the web page and third-party APIs Finally, although this component can work as an independent REST API, it is intended to be used as the backend of the `aerOS Management Portal frontend `__. Prerequisities ============== This aerOS Basic Services are needed to cover all the functionalities provided by the backend: - Keycloak - Orion-LD - Entrypoint Balancer & aerOS orchestrator Configuration options ===================== This backend can be configured by using these environment variables: - *SECURITY_LOG_LEVEL*: logging level of the Spring Security 6 framework (ERROR, WARN, INFO, DEBUG, or TRACE). - *LOG_LEVEL*: logging level of the application itself (ERROR, WARN, INFO, DEBUG, or TRACE). - *ENTRYPOINT_BALANCER_URL*: full URL of the Entrypoint Balancer. - *HLO_FE_URL*: full URL of the REST API (FE endpoint) of the of the aerOS HLO's Storage Engine component. Developer guide =============== The Backend of the aerOS Management Portal has been developed a **Spring Framework 6** application, starting the project with **Spring Boot 3** and using some complementary libraries such as **Spring Security** or **Spring Cloud**. Minimum prerequirements for the local development machine: - `Java JDK 21 `__ - `Apache Maven 3.6 `__ The recommended IDE to develop this component is `IntelliJ IDEA `__ but other alternatives such as Eclipse Java IDE and VSCode can be used as well. Now, the application can be run using the selected IDE. It will run by default in the port 8080. Finally, the Spring application can be configured through the modification of the *src/main/resources/application.properties* file: .. code:: text logging.level.org.springframework.security=${SECURITY_LOG_LEVEL:#{INFO}} logging.level.eu.aerosproject=${LOG_LEVEL:#{INFO}} aeros.entrypoint-balancer=${ENTRYPOINT_BALANCER_URL:#{"http://entrypoint-balancer:8080"}} aeros.hlo-fe=${HLO_FE_URL:#{"http://hlo-fe-service:8081"}} Packaging into a JAR file ------------------------- In order to package the application into a JAR file (for instance, to be included into a Dockerfile), run: .. code:: bash mvn clean compile package Build a container image ----------------------- First, package the application into a JAR file. Then, use the included *Dockerfile* to build the container image: .. code:: bash docker build -t aerOS/management-portal-backend . Authors ======= Universitat Politècnica de València