Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First step to implement the frontend #194

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 1 addition & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"postStartCommand": ".devcontainer/postStart.sh",
"postCreateCommand": ".devcontainer/postCreate.sh",
"forwardPorts": [
1984,
1985,
3000,
4173
1985
],
"customizations": {
"vscode": {
Expand Down
5 changes: 4 additions & 1 deletion .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

echo "Setting up pnpm store..."
mkdir -p /tmp/pnpm && pnpm config set store-dir /tmp/pnpm/

echo "Building the project..."
gradle npmInstall build
gradle pnpmInstall build
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
- [ ] I have added unit and integration tests for my change
- [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green
<!-- Before adding documentation and example(s) (below), please wait until the PR is reviewed and approved. -->
- [ ] I have added/updated the [documentation](https://github.com/dRAGon-Okinawa/dRAGon/tree/main/docs)
- [ ] I have added/updated the [documentation](https://docs.dragon.okinawa)
22 changes: 5 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.7
Expand All @@ -42,15 +45,10 @@ jobs:
run: gradle createRelease

- name: Set Frontend Version
run: npm version from-git --no-git-tag-version --prefix frontend
- name: Set Docs Version
run: npm version from-git --no-git-tag-version --prefix docs
run: pnpm version from-git --no-git-tag-version --prefix frontend

- name: Test dRAGon
run: gradle npmInstall npmLint checkstyleMain checkstyleTest test

- name: Build Documentation
run: npm install --prefix docs && npm run build --prefix docs
run: gradle pnpmInstall pnpmLint checkstyleMain checkstyleTest test --stacktrace

- name: Build dRAGon
run: gradle bootJar -Pversion=$(gradle cV -q -Prelease.quiet)
Expand Down Expand Up @@ -93,13 +91,3 @@ jobs:
github.ref == 'refs/heads/main' &&
github.repository == 'dragon-okinawa/dragon'
run: gradle pushRelease

- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@releases/v3
if: |
github.ref == 'refs/heads/main' &&
github.repository == 'dragon-okinawa/dragon'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build
gradle
.gradle
bin
.vscode
.DS_Store
*.class
*.class
.pnpm-store
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/openjdk/jdk:17-ubuntu
LABEL org.opencontainers.image.source="https://github.com/dRAGon-Okinawa/dRAGon"

EXPOSE 1985
EXPOSE 1984
EXPOSE 8519

RUN mkdir /data
RUN chown app:app /data
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Build dRAGon Project](https://github.com/dragon-okinawa/dragon/actions/workflows/build.yml/badge.svg?branch=main)
[![Build dRAGon Project](https://github.com/dragon-okinawa/dragon/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/dRAGon-Okinawa/dRAGon/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dRAGon-Okinawa_dRAGon&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dRAGon-Okinawa_dRAGon)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=dRAGon-Okinawa_dRAGon&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=dRAGon-Okinawa_dRAGon)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dRAGon-Okinawa_dRAGon&metric=bugs)](https://sonarcloud.io/summary/new_code?id=dRAGon-Okinawa_dRAGon)
Expand Down
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
9 changes: 6 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,20 @@ tasks.register("bootProdRun") {
systemProperty("spring.profiles.active", "prod")
}
}
finalizedBy("bootRun")
}

jacoco {
toolVersion = "0.8.12"
}

tasks.register('copyWebApp', Copy) {
dependsOn(':frontend:jar')
dependsOn(':frontend:pnpmBuild')
from "$rootDir/frontend/dist"
into "$buildDir/resources/main/static/."
}

tasks.named('compileJava') {
dependsOn(':frontend:jar')
dependsOn(':frontend:pnpmBuild')
}

tasks.named('processResources') {
Expand Down
3 changes: 2 additions & 1 deletion backend/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
version=0.0.0
version=0.0.0
org.gradle.daemon=false
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/app/health")
@RequestMapping("/api/app")
@Tag(name = "Health", description = "Health Check API Endpoints")
public class HealthOpenApiController {
@GetMapping("/status")
public class HealthAppApiController {
@GetMapping("/health")
@ApiResponse(responseCode = "200", description = "dRAGon app is alive.")
@Operation(summary = "Check dRAGon app health", description = "Returns a simple message to confirm that the app is alive.")
public String health() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ai.dragon.controller.api.app;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import ai.dragon.util.VersionUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@RequestMapping("/api/app/info")
@Tag(name = "App Information", description = "Information about the dRAGon app.")
public class InfoAppApiController {
@GetMapping("/version")
@ApiResponse(responseCode = "200", description = "dRAGon app version.")
@Operation(summary = "Get dRAGon app version", description = "Returns the version of the dRAGon app.")
public String version() {
return VersionUtil.getVersion();

Check warning on line 20 in backend/src/main/java/ai/dragon/controller/api/app/InfoAppApiController.java

View check run for this annotation

Codecov / codecov/patch

backend/src/main/java/ai/dragon/controller/api/app/InfoAppApiController.java#L20

Added line #L20 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
System.out.println("================================================");
System.out.println(String.format("APP URL\t\t : %s://%s:%d/", scheme, host, port));
System.out.println(String.format("Swagger UI\t : %s://%s:%d/api/swagger-ui.html", scheme, host, port));
System.out.println(String.format("JobRunr\t\t : %s://%s:%d/", scheme, host, 1984));
System.out.println(String.format("JobRunr\t\t : %s://%s:%d/", scheme, host, 8519));

Check warning on line 41 in backend/src/main/java/ai/dragon/listener/DragonApplicationListener.java

View check run for this annotation

Codecov / codecov/patch

backend/src/main/java/ai/dragon/listener/DragonApplicationListener.java#L41

Added line #L41 was not covered by tests
System.out.println("================================================");
}
}
2 changes: 1 addition & 1 deletion backend/src/main/resources/application-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org:
enabled: true
dashboard:
enabled: true
port: 1984
port: 8519
jobs:
default-number-of-retries: 10 # Number of retries for a failing job
retry-back-off-time-seed: 3 # Time seed for the exponential back-off policy
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ org:
enabled: true
dashboard:
enabled: true
port: 1984
port: 8519
jobs:
default-number-of-retries: 10 # Number of retries for a failing job
retry-back-off-time-seed: 3 # Time seed for the exponential back-off policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void beforeAll(@Autowired FarmRepository farmRepository,

// OpenAI settings for RaaG
String apiKeySetting = String.format("apiKey=%s", System.getenv("OPENAI_API_KEY"));
String modelNameSetting = "modelName=gpt-4o";
String modelNameSetting = "modelName=gpt-3.5-turbo"; // TODO Migrate to gpt-4o-mini when reliable

// Farm with no silo
FarmEntity farmWithoutSilo = new FarmEntity();
Expand Down
23 changes: 0 additions & 23 deletions docs/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions docs/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/babel.config.js

This file was deleted.

36 changes: 0 additions & 36 deletions docs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'com.github.node-gradle.node' version '7.0.2'
id 'org.openapi.generator' version '7.5.0'
}

ext {
Expand All @@ -22,38 +21,3 @@ task test(type: NpmTask) {
outputs.dir("dist")
args = ['run', 'build']
}

task buildOpenApiMarkdownDocs(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
dependsOn(':backend:generateOpenApiDocs')
generatorName.set("markdown")
inputSpecRootDirectory.set("$backendBuildDir/docs/api")
cleanupOutput.set(true)
outputDir.set("$backendBuildDir/docs/api/markdown")
doFirst {
delete "$backendBuildDir/docs/api/markdown"
}
doLast {
delete "docs/api/specification"
copy {
from("$backendBuildDir/docs/api/markdown")
into("docs/api/specification")
filter {
String line -> line
.replace("[**Map**](../Models/object.md)", "**Map**")
.replace("[**Object**](.md)", "**object**")
.replace("{uuid}", "\\{uuid\\}")
.replace("http://localhost:8080", "http://localhost:1985")
.replace("# Documentation for merged spec", "# Specification")
}
}
delete "docs/api/specification/.openapi-generator"
delete "docs/api/specification/.openapi-generator-ignore"
delete "static/openapi"
copy {
from("$backendBuildDir/docs/api") {
include 'swagger-*.json'
}
into("static/openapi")
}
}
}
28 changes: 0 additions & 28 deletions docs/docs/about-dragon/README.mdx

This file was deleted.

1 change: 0 additions & 1 deletion docs/docs/about-dragon/_category_.yml

This file was deleted.

1 change: 0 additions & 1 deletion docs/docs/about-dragon/glossary/_category_.yml

This file was deleted.

27 changes: 0 additions & 27 deletions docs/docs/about-dragon/glossary/farm.mdx

This file was deleted.

Loading