summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml13
-rw-r--r--docker-compose.override.yml15
-rw-r--r--docker-compose.prod.yml10
-rw-r--r--docker-compose.yml38
-rw-r--r--docs/deploy.md22
-rw-r--r--gradle/libs.versions.toml4
-rw-r--r--opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt12
-rw-r--r--opendc-trace/opendc-trace-parquet/build.gradle.kts4
-rw-r--r--opendc-web/opendc-web-api/src/main/resources/init-dev.sql3
-rw-r--r--opendc-web/opendc-web-runner-quarkus-deployment/build.gradle.kts2
-rw-r--r--opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java30
-rw-r--r--opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java32
-rw-r--r--opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java6
-rw-r--r--opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt3
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/JobManager.kt68
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt56
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManager.kt90
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManagerImpl.kt58
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt6
-rw-r--r--opendc-web/opendc-web-server/Dockerfile (renamed from opendc-web/opendc-web-api/Dockerfile)4
-rw-r--r--opendc-web/opendc-web-server/build.gradle.kts (renamed from opendc-web/opendc-web-api/build.gradle.kts)9
-rw-r--r--opendc-web/opendc-web-server/config/application.properties (renamed from opendc-web/opendc-web-api/config/application.properties)0
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/OpenDCApplication.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/OpenDCApplication.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Job.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Portfolio.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Project.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorization.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorizationKey.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorizationKey.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Scenario.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Topology.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Trace.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Workload.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Workload.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/JobRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/JobRepository.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/PortfolioRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/PortfolioRepository.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ProjectRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ProjectRepository.kt)8
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ScenarioRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ScenarioRepository.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TopologyRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TopologyRepository.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TraceRepository.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TraceRepository.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/SchedulerResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/SchedulerResource.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/TraceResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/GenericExceptionMapper.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/GenericExceptionMapper.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/MissingKotlinParameterExceptionMapper.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/MissingKotlinParameterExceptionMapper.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/runner/JobResource.kt)13
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ProjectResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ScenarioResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/TopologyResource.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/JobService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/JobService.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/PortfolioService.kt)10
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ProjectService.kt)6
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/RunnerConversions.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/RunnerConversions.kt)10
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ScenarioService.kt)6
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TopologyService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TopologyService.kt)8
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TraceService.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TraceService.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/UserConversions.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/Utils.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/Utils.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/DevSecurityOverrideFilter.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/DevSecurityOverrideFilter.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/KotlinModuleCustomizer.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/KotlinModuleCustomizer.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonSqlTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonStringSqlTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonType.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt (renamed from opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonTypeDescriptor.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/runner/QuarkusJobManager.kt67
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/META-INF/branding/logo.png (renamed from opendc-web/opendc-web-api/src/main/resources/META-INF/branding/logo.png)bin2825 -> 2825 bytes
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/application-dev.properties (renamed from opendc-web/opendc-web-api/src/main/resources/application-dev.properties)19
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/application-docker.properties49
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/application-prod.properties (renamed from opendc-web/opendc-web-api/src/main/resources/application-prod.properties)24
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/application-test.properties (renamed from opendc-web/opendc-web-api/src/main/resources/application-test.properties)9
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/application.properties (renamed from opendc-web/opendc-web-api/src/main/resources/application.properties)22
-rw-r--r--opendc-web/opendc-web-server/src/main/resources/db/migration/V1.0.0__core.sql144
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/SchedulerResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/SchedulerResourceTest.kt)2
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/TraceResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/TraceResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/runner/JobResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ProjectResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ProjectResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ScenarioResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/TopologyResourceTest.kt (renamed from opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/TopologyResourceTest.kt)4
-rw-r--r--opendc-web/opendc-web-ui/Dockerfile12
-rwxr-xr-xopendc-web/opendc-web-ui/scripts/envsubst.sh4
-rw-r--r--settings.gradle.kts2
85 files changed, 672 insertions, 366 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2507de64..64eba648 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -62,11 +62,16 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- - name: Build Runner
+ - name: Build UI
uses: docker/build-push-action@v3
with:
- file: opendc-web/opendc-web-runner/Dockerfile
- - name: Build API
+ context: opendc-web/opendc-web-ui
+ file: opendc-web/opendc-web-ui/Dockerfile
+ - name: Build Web Server
+ uses: docker/build-push-action@v3
+ with:
+ file: opendc-web/opendc-web-server/Dockerfile
+ - name: Build Runner
uses: docker/build-push-action@v3
with:
- file: opendc-web/opendc-web-api/Dockerfile
+ file: opendc-web/opendc-web-runner/Dockerfile
diff --git a/docker-compose.override.yml b/docker-compose.override.yml
index 314adcb1..86aff681 100644
--- a/docker-compose.override.yml
+++ b/docker-compose.override.yml
@@ -2,26 +2,19 @@ version: "3.8"
# Docker Compose overrides for development environments
services:
- frontend:
+ ui:
build: opendc-web/opendc-web-ui
ports:
- "8080:3000"
environment:
NEXT_PUBLIC_API_BASE_URL: http://localhost:8081
- api:
+ server:
build:
context: .
- dockerfile: opendc-web/opendc-web-api/Dockerfile
+ dockerfile: opendc-web/opendc-web-server/Dockerfile
ports:
- - "8081:80"
- environment:
- SENTRY_ENVIRONMENT: "development"
-
- runner:
- build:
- context: .
- dockerfile: opendc-web/opendc-web-runner/Dockerfile
+ - "8081:8080"
environment:
SENTRY_ENVIRONMENT: "development"
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 1206ff9c..58d5ce55 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -2,18 +2,14 @@ version: "3.8"
# Docker Compose overrides for production environments
services:
- frontend:
+ ui:
ports:
- "8080:3000"
environment:
NEXT_PUBLIC_API_BASE_URL: ${OPENDC_API_BASE_URL}
- api:
+ server:
ports:
- - "8081:80"
- environment:
- SENTRY_ENVIRONMENT: "production"
-
- runner:
+ - "8081:8080"
environment:
SENTRY_ENVIRONMENT: "production"
diff --git a/docker-compose.yml b/docker-compose.yml
index faaecc03..a6d6ce1d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,51 +1,39 @@
version: "3.8"
services:
- frontend:
- image: atlargeresearch/opendc-web-ui:v2.1
+ ui:
+ image: atlargeresearch/opendc-ui:v2.1
restart: on-failure
networks:
- backend
depends_on:
- - api
+ - server
environment:
NEXT_PUBLIC_AUTH0_DOMAIN: ${OPENDC_AUTH0_DOMAIN}
NEXT_PUBLIC_AUTH0_CLIENT_ID: ${OPENDC_AUTH0_CLIENT_ID}
NEXT_PUBLIC_AUTH0_AUDIENCE: ${OPENDC_AUTH0_AUDIENCE}
- NEXT_PUBLIC_SENTRY_DSN: ${OPENDC_FRONTEND_SENTRY_DSN-}
+ NEXT_PUBLIC_SENTRY_DSN: ${OPENDC_UI_SENTRY_DSN-}
- api:
- image: atlargeresearch/opendc-web-api:v2.1
+ server:
+ image: atlargeresearch/opendc:v2.1
restart: on-failure
networks:
- backend
depends_on:
- postgres
+ volumes:
+ - type: bind
+ source: ./traces
+ target: /opt/opendc/traces
environment:
OPENDC_DB_USERNAME: ${OPENDC_DB_USERNAME:?No database username specified}
OPENDC_DB_PASSWORD: ${OPENDC_DB_PASSWORD:?No database password specified}
OPENDC_DB_URL: jdbc:postgresql://postgres:5432/opendc
OPENDC_AUTH0_DOMAIN: ${OPENDC_AUTH0_DOMAIN:?No Auth0 domain specified}
OPENDC_AUTH0_AUDIENCE: ${OPENDC_AUTH0_AUDIENCE:?No Auth0 audience specified}
- SENTRY_DSN: ${OPENDC_API_SENTRY_DSN-}
-
- runner:
- image: atlargeresearch/opendc:v2.1
- restart: on-failure
- networks:
- - backend
- depends_on:
- - api
- volumes:
- - type: bind
- source: ./traces
- target: /opt/opendc/traces
- environment:
OPENDC_API_URL: ${OPENDC_API_BASE_URL:-http://web:8080}
- AUTH0_DOMAIN: ${OPENDC_AUTH0_DOMAIN:?No Auth0 domain specified}
- AUTH0_AUDIENCE: ${OPENDC_AUTH0_AUDIENCE:?No Auth0 audience specified}
- AUTH0_CLIENT_ID: ${OPENDC_AUTH0_CLIENT_ID_RUNNER:?No client id for runner}
- AUTH0_CLIENT_SECRET: ${OPENDC_AUTH0_CLIENT_SECRET_RUNNER:?No client secret for runner}
- SENTRY_DSN: ${OPENDC_SIMULATOR_SENTRY_DSN-}
+ OPENDC_AUTH0_CLIENT_ID_RUNNER: ${OPENDC_AUTH0_CLIENT_ID_RUNNER:?No client id for runner}
+ OPENDC_AUTH0_CLIENT_SECRET_RUNNER: ${OPENDC_AUTH0_CLIENT_SECRET_RUNNER:?No client secret for runner}
+ SENTRY_DSN: ${OPENDC_SERVER_SENTRY_DSN-}
postgres:
image: postgres
diff --git a/docs/deploy.md b/docs/deploy.md
index da622571..ac417def 100644
--- a/docs/deploy.md
+++ b/docs/deploy.md
@@ -1,7 +1,5 @@
# Deploying OpenDC
-This document explains how you can deploy OpenDC in your local environment.
-The official way to run OpenDC is using Docker. Other options include building and running locally, and building and
-running to deploy on a server.
+This document explains how you can deploy a multi-tenant instance of OpenDC using Docker.
## Contents
@@ -30,13 +28,6 @@ create:
Once your application has been created, you should have a _Domain_ and _Client ID_ which we need to pass to the
frontend application (as `OPENDC_AUTH0_DOMAIN` and `OPENDC_AUTH0_CLIENT_ID` respectively).
-3. **A Machine to Machine Application (M2M)**
- You need to define a Machine to Machine application in Auth0 so that the simulator can communicate with the OpenDC API.
- Please refer to the [following guide](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps)
- on how to create such an application.
-
- Once your application has been created, you should have a _Client ID_ and _Client Secret_ which we need to pass to the
- simulator (as `OPENDC_AUTH0_CLIENT_ID_RUNNER` and `OPENDC_AUTH0_CLIENT_SECRET_RUNNER` respectively).
## Installing Docker
@@ -61,23 +52,16 @@ called `.env` in the `opendc` folder. In this file, replace `your-auth0-*` with
step. For a standard setup, you can leave the other settings as-is.
```.env
-MONGO_INITDB_ROOT_USERNAME=root
-MONGO_INITDB_ROOT_PASSWORD=rootpassword
-MONGO_INITDB_DATABASE=admin
-OPENDC_DB=opendc
OPENDC_DB_USERNAME=opendc
OPENDC_DB_PASSWORD=opendcpassword
-OPENDC_FLASK_SECRET="This is a secret flask key, please change"
OPENDC_AUTH0_DOMAIN=your-auth0-domain
OPENDC_AUTH0_CLIENT_ID=your-auth0-client-id
OPENDC_AUTH0_AUDIENCE=your-auth0-api-identifier
-OPENDC_AUTH0_CLIENT_ID_RUNNER=your-auth0-client-id-for-runner
-OPENDC_AUTH0_CLIENT_SECRET_RUNNER=your-auth0-client-secret-for-runner
OPENDC_API_BASE_URL=http://web
```
We provide a set of default traces for you to experiment with. If you want to add others, place them in the `traces`
-directory and add entries to the database (see also [the database folder](../database/mongo-init-opendc-db.sh))
+directory and add entries to the database (see also [the SQL init script](../opendc-web/opendc-web-server/src/main/resources/db/migration/V1.0.0__core.sql))
If you plan to deploy publicly, please also tweak the other settings. In that case, also check the `docker-compose.yml`
and `docker-compose.prod.yml` for further instructions.
@@ -93,4 +77,4 @@ docker-compose up
```
Wait a few seconds and open `http://localhost:8080` in your browser to use OpenDC. We recommend Google Chrome for the
-best development experience.
+best user experience.
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 899d3cfc..4e81ff35 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -6,7 +6,7 @@ dokka = "1.6.21"
gradle-node = "3.3.0"
hadoop = "3.3.3"
jackson = "2.13.3"
-jandex-gradle = "0.12.0"
+jandex-gradle = "0.13.2"
jline = "3.21.0"
jmh-gradle = "0.6.6"
jakarta-validation = "2.0.2"
@@ -20,7 +20,7 @@ microprofile-openapi = "3.0"
mockk = "1.12.4"
parquet = "1.12.3"
progressbar = "0.9.3"
-quarkus = "2.10.0.Final"
+quarkus = "2.11.1.Final"
quarkus-junit5-mockk = "1.1.1"
sentry = "6.1.2"
slf4j = "1.7.36"
diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt
index eff6fa83..26e81cf8 100644
--- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt
+++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt
@@ -90,18 +90,20 @@ public interface TraceFormat {
*/
public companion object {
/**
- * A list of [TraceFormat] that are available on this system.
+ * Obtain a list of [TraceFormat] that are available in the current thread context.
*/
@JvmStatic
- public val installedProviders: List<TraceFormat> by lazy {
- val loader = ServiceLoader.load(TraceFormat::class.java)
- loader.toList()
+ public fun getInstalledProviders(): Iterable<TraceFormat> {
+ return ServiceLoader.load(TraceFormat::class.java)
}
/**
* Obtain a [TraceFormat] implementation by [name].
*/
@JvmStatic
- public fun byName(name: String): TraceFormat? = installedProviders.find { it.name == name }
+ public fun byName(name: String): TraceFormat? {
+ val loader = ServiceLoader.load(TraceFormat::class.java)
+ return loader.find { it.name == name }
+ }
}
}
diff --git a/opendc-trace/opendc-trace-parquet/build.gradle.kts b/opendc-trace/opendc-trace-parquet/build.gradle.kts
index 9b1e1273..2217a017 100644
--- a/opendc-trace/opendc-trace-parquet/build.gradle.kts
+++ b/opendc-trace/opendc-trace-parquet/build.gradle.kts
@@ -33,8 +33,8 @@ dependencies {
exclude(group = "org.apache.hadoop")
}
api(libs.hadoop.common) {
- exclude(group = "org.slf4j", module = "slf4j-log4j12")
- exclude(group = "log4j")
+ exclude(group = "org.slf4j", module = "slf4j-reload4j")
+ exclude(group = "ch.qos.reload4j", module = "reload4j")
exclude(group = "org.apache.hadoop")
exclude(group = "org.apache.curator")
exclude(group = "org.apache.zookeeper")
diff --git a/opendc-web/opendc-web-api/src/main/resources/init-dev.sql b/opendc-web/opendc-web-api/src/main/resources/init-dev.sql
deleted file mode 100644
index 756eff46..00000000
--- a/opendc-web/opendc-web-api/src/main/resources/init-dev.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
--- Add example traces
-INSERT INTO traces (id, name, type) VALUES ('bitbrains-small', 'Bitbrains Small', 'vm');
diff --git a/opendc-web/opendc-web-runner-quarkus-deployment/build.gradle.kts b/opendc-web/opendc-web-runner-quarkus-deployment/build.gradle.kts
index 24f667cf..b3f1ec3b 100644
--- a/opendc-web/opendc-web-runner-quarkus-deployment/build.gradle.kts
+++ b/opendc-web/opendc-web-runner-quarkus-deployment/build.gradle.kts
@@ -29,7 +29,9 @@ plugins {
dependencies {
implementation(projects.opendcWeb.opendcWebRunnerQuarkus)
+ implementation(projects.opendcTrace.opendcTraceApi)
implementation(platform(libs.quarkus.bom))
implementation(libs.quarkus.core.deployment)
+ implementation(libs.quarkus.arc.deployment)
}
diff --git a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
index b9a334ac..94921454 100644
--- a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
+++ b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java
@@ -22,15 +22,23 @@
package org.opendc.web.runner.deployment;
+import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.*;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.runtime.RuntimeValue;
+import org.opendc.trace.spi.TraceFormat;
+import org.opendc.web.runner.JobManager;
import org.opendc.web.runner.OpenDCRunner;
import org.opendc.web.runner.runtime.OpenDCRunnerRecorder;
import org.opendc.web.runner.runtime.OpenDCRunnerRuntimeConfig;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Set;
import java.util.function.BooleanSupplier;
import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
@@ -51,12 +59,26 @@ public class OpenDCRunnerProcessor {
}
/**
- * Build step to index the necessary dependencies for the OpenDC runner.
+ * Build step to register the trace formats used by OpenDC.
*/
@BuildStep
- void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) {
- indexDependency.produce(new IndexDependencyBuildItem("org.opendc.trace", "opendc-trace-opendc"));
- indexDependency.produce(new IndexDependencyBuildItem("org.opendc.trace", "opendc-trace-bitbrains"));
+ void registerTraceFormats(BuildProducer<ServiceProviderBuildItem> services) throws IOException {
+ String service = "META-INF/services/" + TraceFormat.class.getName();
+
+ Set<String> implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(),
+ service);
+
+ services.produce(
+ new ServiceProviderBuildItem(TraceFormat.class.getName(),
+ implementations.toArray(new String[0])));
+ }
+
+ /**
+ * Mark {@link JobManager} as unremoveable, since we look up this service dynamically in {@link OpenDCRunnerRecorder}.
+ */
+ @BuildStep
+ UnremovableBeanBuildItem unremovableBeans() {
+ return UnremovableBeanBuildItem.beanTypes(JobManager.class);
}
/**
diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
index b243dbc3..f5c056ef 100644
--- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
+++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java
@@ -26,11 +26,11 @@ import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
import org.jboss.logging.Logger;
-import org.opendc.web.client.runner.OpenDCRunnerClient;
+import org.opendc.web.runner.JobManager;
import org.opendc.web.runner.OpenDCRunner;
+import javax.enterprise.inject.spi.CDI;
import java.io.File;
-import java.net.URI;
/**
* Helper class for starting the OpenDC web runner.
@@ -43,12 +43,18 @@ public class OpenDCRunnerRecorder {
* Helper method to create an {@link OpenDCRunner} instance.
*/
public RuntimeValue<OpenDCRunner> createRunner(OpenDCRunnerRuntimeConfig config) {
- URI apiUrl = URI.create(config.apiUrl);
- OpenDCRunnerClient client = new OpenDCRunnerClient(apiUrl, null);
+ int parallelism = config.parallelism;
+ if (parallelism < 0) {
+ throw new IllegalArgumentException("Parallelism must be non-negative");
+ } else if (parallelism == 0) {
+ parallelism = Math.min(1, Runtime.getRuntime().availableProcessors() - 1);
+ }
+
+ JobManager manager = CDI.current().select(JobManager.class).get();
OpenDCRunner runner = new OpenDCRunner(
- client,
+ manager,
new File(config.tracePath),
- config.parallelism,
+ parallelism,
config.jobTimeout,
config.pollInterval,
config.heartbeatInterval
@@ -64,18 +70,10 @@ public class OpenDCRunnerRecorder {
OpenDCRunnerRuntimeConfig config,
ShutdownContext shutdownContext) {
if (config.enable) {
- LOGGER.info("Starting OpenDC Runner in background (polling " + config.apiUrl + ")");
-
- Thread thread = new Thread(() -> {
- try {
- // Wait for some time to allow Vert.x to bind to the local port
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
+ LOGGER.info("Starting OpenDC Runner in background (polling every " + config.pollInterval + ")");
- runner.getValue().run();
- });
+ Thread thread = new Thread(runner.getValue());
+ thread.setName("opendc-runner");
thread.start();
shutdownContext.addShutdownTask(thread::interrupt);
diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
index e1dbf0a8..e9258f06 100644
--- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
+++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java
@@ -40,12 +40,6 @@ public class OpenDCRunnerRuntimeConfig {
public boolean enable;
/**
- * The URI to the (local) API to communicate with.
- */
- @ConfigItem(defaultValue = "http://${quarkus.http.host}:${quarkus.http.port}${quarkus.resteasy.path:}")
- public String apiUrl;
-
- /**
* The path where the workload traces are located.
*/
@ConfigItem(defaultValue = "traces")
diff --git a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
index 348a838c..4cfbdd7c 100644
--- a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
+++ b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
@@ -114,7 +114,8 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
logger.info { "Starting OpenDC web runner" }
val client = OpenDCRunnerClient(baseUrl = apiUrl, OpenIdAuthController(authDomain, authClientId, authClientSecret, authAudience))
- val runner = OpenDCRunner(client, tracePath, parallelism = parallelism)
+ val manager = JobManager(client)
+ val runner = OpenDCRunner(manager, tracePath, parallelism = parallelism)
logger.info { "Watching for queued scenarios" }
runner.run()
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/JobManager.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/JobManager.kt
new file mode 100644
index 00000000..50aa03d8
--- /dev/null
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/JobManager.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2022 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.runner
+
+import org.opendc.web.client.runner.OpenDCRunnerClient
+import org.opendc.web.proto.runner.Job
+import org.opendc.web.runner.internal.JobManagerImpl
+
+/**
+ * Interface used by the [OpenDCRunner] to manage the available jobs to be processed.
+ */
+public interface JobManager {
+ /**
+ * Find the next job that the simulator needs to process.
+ */
+ public fun findNext(): Job?
+
+ /**
+ * Claim the simulation job with the specified id.
+ */
+ public fun claim(id: Long): Boolean
+
+ /**
+ * Update the heartbeat of the specified job.
+ */
+ public fun heartbeat(id: Long)
+
+ /**
+ * Mark the job as failed.
+ */
+ public fun fail(id: Long)
+
+ /**
+ * Persist the specified results for the specified job.
+ */
+ public fun finish(id: Long, results: Map<String, Any>)
+
+ public companion object {
+ /**
+ * Create a [JobManager] given the specified [client].
+ */
+ @JvmStatic
+ @JvmName("create")
+ public operator fun invoke(client: OpenDCRunnerClient): JobManager {
+ return JobManagerImpl(client)
+ }
+ }
+}
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
index 9c9a866d..c958bdb2 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
@@ -36,27 +36,26 @@ import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.LinearPowerModel
import org.opendc.simulator.compute.power.SimplePowerDriver
import org.opendc.simulator.core.runBlockingSimulation
-import org.opendc.web.client.runner.OpenDCRunnerClient
import org.opendc.web.proto.runner.Job
import org.opendc.web.proto.runner.Scenario
-import org.opendc.web.runner.internal.JobManager
import org.opendc.web.runner.internal.WebComputeMonitor
import java.io.File
import java.time.Duration
import java.util.*
import java.util.concurrent.*
+import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory
/**
* Class to execute the pending jobs via the OpenDC web API.
*
- * @param client The [OpenDCRunnerClient] to connect to the OpenDC web API.
+ * @param manager The underlying [JobManager] to manage the available jobs.
* @param tracePath The directory where the traces are located.
* @param jobTimeout The maximum duration of a simulation job.
* @param pollInterval The interval to poll the API with.
* @param heartbeatInterval The interval to send a heartbeat to the API server.
*/
public class OpenDCRunner(
- client: OpenDCRunnerClient,
+ private val manager: JobManager,
private val tracePath: File,
parallelism: Int = Runtime.getRuntime().availableProcessors(),
private val jobTimeout: Duration = Duration.ofMillis(10),
@@ -69,11 +68,6 @@ public class OpenDCRunner(
private val logger = KotlinLogging.logger {}
/**
- * Helper class to manage the available jobs.
- */
- private val manager = JobManager(client)
-
- /**
* Helper class to load the workloads.
*/
private val workloadLoader = ComputeWorkloadLoader(tracePath)
@@ -81,7 +75,7 @@ public class OpenDCRunner(
/**
* The [ForkJoinPool] that is used to execute the simulation jobs.
*/
- private val pool = ForkJoinPool(parallelism)
+ private val pool = ForkJoinPool(parallelism, RunnerThreadFactory(Thread.currentThread().contextClassLoader), null, false)
/**
* A [ScheduledExecutorService] to manage the heartbeat of simulation jobs as well as tracking the deadline of
@@ -97,11 +91,6 @@ public class OpenDCRunner(
override fun run() {
try {
while (true) {
- // Check if anyone has interrupted the thread
- if (Thread.interrupted()) {
- throw InterruptedException()
- }
-
val job = manager.findNext()
if (job == null) {
Thread.sleep(pollInterval.toMillis())
@@ -119,6 +108,8 @@ public class OpenDCRunner(
pool.submit(JobAction(job))
}
+ } catch (_: InterruptedException) {
+ // Gracefully exit when the thread is interrupted
} finally {
workloadLoader.reset()
@@ -144,12 +135,32 @@ public class OpenDCRunner(
try {
val topology = convertTopology(scenario.topology)
val jobs = (0 until scenario.portfolio.targets.repeats).map { repeat -> SimulationTask(scenario, repeat, topology) }
- val results = invokeAll(jobs)
+ val results = invokeAll(jobs).map { it.rawResult }
logger.info { "Finished simulation for job $id" }
heartbeat.cancel(true)
- manager.finish(id, results.map { it.rawResult })
+
+ manager.finish(
+ id,
+ mapOf(
+ "total_requested_burst" to results.map { it.totalActiveTime + it.totalIdleTime },
+ "total_granted_burst" to results.map { it.totalActiveTime },
+ "total_overcommitted_burst" to results.map { it.totalStealTime },
+ "total_interfered_burst" to results.map { it.totalLostTime },
+ "mean_cpu_usage" to results.map { it.meanCpuUsage },
+ "mean_cpu_demand" to results.map { it.meanCpuDemand },
+ "mean_num_deployed_images" to results.map { it.meanNumDeployedImages },
+ "max_num_deployed_images" to results.map { it.maxNumDeployedImages },
+ "total_power_draw" to results.map { it.totalPowerDraw },
+ "total_failure_slices" to results.map { it.totalFailureSlices },
+ "total_failure_vm_slices" to results.map { it.totalFailureVmSlices },
+ "total_vms_submitted" to results.map { it.totalVmsSubmitted },
+ "total_vms_queued" to results.map { it.totalVmsQueued },
+ "total_vms_finished" to results.map { it.totalVmsFinished },
+ "total_vms_failed" to results.map { it.totalVmsFailed }
+ )
+ )
} catch (e: Exception) {
// Check whether the job failed due to exceeding its time budget
if (Thread.interrupted()) {
@@ -303,4 +314,15 @@ public class OpenDCRunner(
override fun toString(): String = "WebRunnerTopologyFactory"
}
}
+
+ /**
+ * A custom [ForkJoinWorkerThreadFactory] that uses the [ClassLoader] of specified by the runner.
+ */
+ private class RunnerThreadFactory(private val classLoader: ClassLoader) : ForkJoinWorkerThreadFactory {
+ override fun newThread(pool: ForkJoinPool): ForkJoinWorkerThread = object : ForkJoinWorkerThread(pool) {
+ init {
+ contextClassLoader = classLoader
+ }
+ }
+ }
}
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManager.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManager.kt
deleted file mode 100644
index 99b8aaf1..00000000
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManager.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.web.runner.internal
-
-import org.opendc.web.client.runner.OpenDCRunnerClient
-import org.opendc.web.proto.JobState
-import org.opendc.web.proto.runner.Job
-
-/**
- * Helper class to manage the queue of jobs that need to be simulated.
- */
-internal class JobManager(private val client: OpenDCRunnerClient) {
- /**
- * Find the next job that the simulator needs to process.
- */
- fun findNext(): Job? {
- return client.jobs.queryPending().firstOrNull()
- }
-
- /**
- * Claim the simulation job with the specified id.
- */
- fun claim(id: Long): Boolean {
- client.jobs.update(id, Job.Update(JobState.CLAIMED)) // TODO Handle conflict
- return true
- }
-
- /**
- * Update the heartbeat of the specified scenario.
- */
- fun heartbeat(id: Long) {
- client.jobs.update(id, Job.Update(JobState.RUNNING))
- }
-
- /**
- * Mark the scenario as failed.
- */
- fun fail(id: Long) {
- client.jobs.update(id, Job.Update(JobState.FAILED))
- }
-
- /**
- * Persist the specified results.
- */
- fun finish(id: Long, results: List<WebComputeMonitor.Results>) {
- client.jobs.update(
- id,
- Job.Update(
- JobState.FINISHED,
- mapOf(
- "total_requested_burst" to results.map { it.totalActiveTime + it.totalIdleTime },
- "total_granted_burst" to results.map { it.totalActiveTime },
- "total_overcommitted_burst" to results.map { it.totalStealTime },
- "total_interfered_burst" to results.map { it.totalLostTime },
- "mean_cpu_usage" to results.map { it.meanCpuUsage },
- "mean_cpu_demand" to results.map { it.meanCpuDemand },
- "mean_num_deployed_images" to results.map { it.meanNumDeployedImages },
- "max_num_deployed_images" to results.map { it.maxNumDeployedImages },
- "total_power_draw" to results.map { it.totalPowerDraw },
- "total_failure_slices" to results.map { it.totalFailureSlices },
- "total_failure_vm_slices" to results.map { it.totalFailureVmSlices },
- "total_vms_submitted" to results.map { it.totalVmsSubmitted },
- "total_vms_queued" to results.map { it.totalVmsQueued },
- "total_vms_finished" to results.map { it.totalVmsFinished },
- "total_vms_failed" to results.map { it.totalVmsFailed }
- )
- )
- )
- }
-}
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManagerImpl.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManagerImpl.kt
new file mode 100644
index 00000000..39a6851c
--- /dev/null
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/JobManagerImpl.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2022 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.runner.internal
+
+import org.opendc.web.client.runner.OpenDCRunnerClient
+import org.opendc.web.proto.JobState
+import org.opendc.web.proto.runner.Job
+import org.opendc.web.runner.JobManager
+
+/**
+ * Default implementation of [JobManager] that uses the OpenDC client to receive jobs.
+ */
+internal class JobManagerImpl(private val client: OpenDCRunnerClient) : JobManager {
+ override fun findNext(): Job? {
+ return client.jobs.queryPending().firstOrNull()
+ }
+
+ override fun claim(id: Long): Boolean {
+ return try {
+ client.jobs.update(id, Job.Update(JobState.CLAIMED))
+ true
+ } catch (e: IllegalStateException) {
+ false
+ }
+ }
+
+ override fun heartbeat(id: Long) {
+ client.jobs.update(id, Job.Update(JobState.RUNNING))
+ }
+
+ override fun fail(id: Long) {
+ client.jobs.update(id, Job.Update(JobState.FAILED))
+ }
+
+ override fun finish(id: Long, results: Map<String, Any>) {
+ client.jobs.update(id, Job.Update(JobState.FINISHED, results))
+ }
+}
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
index 01002c70..4c3d1cfa 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt
@@ -105,9 +105,9 @@ internal class WebComputeMonitor : ComputeMonitor {
hostAggregateMetrics.totalIdleTime,
hostAggregateMetrics.totalStealTime,
hostAggregateMetrics.totalLostTime,
- hostMetrics.map { it.value.cpuUsage / it.value.count }.average(),
- hostMetrics.map { it.value.cpuDemand / it.value.count }.average(),
- hostMetrics.map { it.value.instanceCount.toDouble() / it.value.count }.average(),
+ hostMetrics.map { it.value.cpuUsage / it.value.count }.average().let { if (it.isNaN()) 0.0 else it },
+ hostMetrics.map { it.value.cpuDemand / it.value.count }.average().let { if (it.isNaN()) 0.0 else it },
+ hostMetrics.map { it.value.instanceCount.toDouble() / it.value.count }.average().let { if (it.isNaN()) 0.0 else it },
hostMetrics.map { it.value.instanceCount.toDouble() / it.value.count }.maxOrNull() ?: 0.0,
hostAggregateMetrics.totalPowerDraw,
hostAggregateMetrics.totalFailureSlices.roundToLong(),
diff --git a/opendc-web/opendc-web-api/Dockerfile b/opendc-web/opendc-web-server/Dockerfile
index ff300170..444d787e 100644
--- a/opendc-web/opendc-web-api/Dockerfile
+++ b/opendc-web/opendc-web-server/Dockerfile
@@ -9,9 +9,9 @@ RUN ./gradlew --version
# Build project
COPY ./ /app/
-RUN ./gradlew --no-daemon :opendc-web:opendc-web-api:build
+RUN ./gradlew --no-daemon :opendc-web:opendc-web-server:quarkusBuild -Dquarkus.profile=docker
FROM openjdk:17-slim
-COPY --from=0 /app/opendc-web/opendc-web-api/build/quarkus-app /opt/opendc
+COPY --from=0 /app/opendc-web/opendc-web-server/build/quarkus-app /opt/opendc
WORKDIR /opt/opendc
CMD java -jar quarkus-run.jar
diff --git a/opendc-web/opendc-web-api/build.gradle.kts b/opendc-web/opendc-web-server/build.gradle.kts
index 89b8273c..a55df2f7 100644
--- a/opendc-web/opendc-web-api/build.gradle.kts
+++ b/opendc-web/opendc-web-server/build.gradle.kts
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-description = "REST API for the OpenDC website"
+description = "Web server of OpenDC"
/* Build configuration */
plugins {
@@ -48,8 +48,9 @@ dependencies {
implementation(libs.quarkus.hibernate.orm)
implementation(libs.quarkus.hibernate.validator)
+ implementation(libs.quarkus.flyway)
implementation(libs.quarkus.jdbc.postgresql)
- quarkusDev(libs.quarkus.jdbc.h2)
+ implementation(libs.quarkus.jdbc.h2)
testImplementation(libs.quarkus.junit5.core)
testImplementation(libs.quarkus.junit5.mockk)
@@ -68,8 +69,8 @@ val createStartScripts by tasks.creating(CreateStartScripts::class) {
}
distributions {
- create("server") {
- distributionBaseName.set("opendc-server")
+ main {
+ distributionBaseName.set("opendc")
contents {
from("../../LICENSE.txt")
diff --git a/opendc-web/opendc-web-api/config/application.properties b/opendc-web/opendc-web-server/config/application.properties
index 30eaaef9..30eaaef9 100644
--- a/opendc-web/opendc-web-api/config/application.properties
+++ b/opendc-web/opendc-web-server/config/application.properties
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/OpenDCApplication.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/OpenDCApplication.kt
index ddbd5390..1a426095 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/OpenDCApplication.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/OpenDCApplication.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api
+package org.opendc.web.server
import javax.ws.rs.core.Application
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Job.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt
index b09b46a1..024e7b89 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Job.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import org.hibernate.annotations.Type
import org.hibernate.annotations.TypeDef
-import org.opendc.web.api.util.hibernate.json.JsonType
import org.opendc.web.proto.JobState
+import org.opendc.web.server.util.hibernate.json.JsonType
import java.time.Instant
import javax.persistence.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Portfolio.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt
index c8b94daf..3e3f76a0 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Portfolio.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import org.hibernate.annotations.Type
import org.hibernate.annotations.TypeDef
-import org.opendc.web.api.util.hibernate.json.JsonType
import org.opendc.web.proto.Targets
+import org.opendc.web.server.util.hibernate.json.JsonType
import javax.persistence.*
/**
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Project.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt
index e0440bf4..aa98b677 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Project.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import java.time.Instant
import javax.persistence.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorization.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt
index a72ff06a..a353186e 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorization.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import org.opendc.web.proto.user.ProjectRole
import javax.persistence.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorizationKey.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorizationKey.kt
index b5f66e70..449b6608 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/ProjectAuthorizationKey.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorizationKey.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import javax.persistence.Column
import javax.persistence.Embeddable
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Scenario.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt
index 5c9cb259..e40cff47 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Scenario.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import org.hibernate.annotations.Type
import org.hibernate.annotations.TypeDef
-import org.opendc.web.api.util.hibernate.json.JsonType
import org.opendc.web.proto.OperationalPhenomena
+import org.opendc.web.server.util.hibernate.json.JsonType
import javax.persistence.*
/**
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Topology.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt
index 9b64e382..a190b1ee 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Topology.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import org.hibernate.annotations.Type
import org.hibernate.annotations.TypeDef
-import org.opendc.web.api.util.hibernate.json.JsonType
import org.opendc.web.proto.Room
+import org.opendc.web.server.util.hibernate.json.JsonType
import java.time.Instant
import javax.persistence.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Trace.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt
index 2e2d71f8..8aaac613 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Trace.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import javax.persistence.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Workload.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Workload.kt
index 07fc096b..9c59dc25 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/model/Workload.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Workload.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.model
+package org.opendc.web.server.model
import javax.persistence.Column
import javax.persistence.Embeddable
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/JobRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/JobRepository.kt
index 558d7c38..5fee07a3 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/JobRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/JobRepository.kt
@@ -20,10 +20,10 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Job
import org.opendc.web.proto.JobState
+import org.opendc.web.server.model.Job
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/PortfolioRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/PortfolioRepository.kt
index 34b3598c..77130c15 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/PortfolioRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/PortfolioRepository.kt
@@ -20,9 +20,9 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Portfolio
+import org.opendc.web.server.model.Portfolio
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import javax.persistence.EntityManager
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ProjectRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ProjectRepository.kt
index 6529f778..519da3de 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ProjectRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ProjectRepository.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Project
-import org.opendc.web.api.model.ProjectAuthorization
-import org.opendc.web.api.model.ProjectAuthorizationKey
+import org.opendc.web.server.model.Project
+import org.opendc.web.server.model.ProjectAuthorization
+import org.opendc.web.server.model.ProjectAuthorizationKey
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ScenarioRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ScenarioRepository.kt
index de116ad6..145db71d 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/ScenarioRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/ScenarioRepository.kt
@@ -20,9 +20,9 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Scenario
+import org.opendc.web.server.model.Scenario
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import javax.persistence.EntityManager
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TopologyRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TopologyRepository.kt
index cd8f666e..e8eadd63 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TopologyRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TopologyRepository.kt
@@ -20,9 +20,9 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Topology
+import org.opendc.web.server.model.Topology
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import javax.persistence.EntityManager
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TraceRepository.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TraceRepository.kt
index 6652fc80..f328eea6 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/repository/TraceRepository.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/repository/TraceRepository.kt
@@ -20,9 +20,9 @@
* SOFTWARE.
*/
-package org.opendc.web.api.repository
+package org.opendc.web.server.repository
-import org.opendc.web.api.model.Trace
+import org.opendc.web.server.model.Trace
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import javax.persistence.EntityManager
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/SchedulerResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/SchedulerResource.kt
index 735fdd9b..919b25fc 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/SchedulerResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/SchedulerResource.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest
+package org.opendc.web.server.rest
import javax.ws.rs.GET
import javax.ws.rs.Path
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/TraceResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt
index e87fe602..f46f7f91 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/TraceResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt
@@ -20,10 +20,10 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest
+package org.opendc.web.server.rest
-import org.opendc.web.api.service.TraceService
import org.opendc.web.proto.Trace
+import org.opendc.web.server.service.TraceService
import javax.inject.Inject
import javax.ws.rs.*
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/GenericExceptionMapper.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/GenericExceptionMapper.kt
index fb253758..d8df72e0 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/GenericExceptionMapper.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/GenericExceptionMapper.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.error
+package org.opendc.web.server.rest.error
import org.opendc.web.proto.ProtocolError
import javax.ws.rs.WebApplicationException
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/MissingKotlinParameterExceptionMapper.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/MissingKotlinParameterExceptionMapper.kt
index 57cd35d1..e50917aa 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/error/MissingKotlinParameterExceptionMapper.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/error/MissingKotlinParameterExceptionMapper.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.error
+package org.opendc.web.server.rest.error
import com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException
import org.opendc.web.proto.ProtocolError
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/runner/JobResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt
index 7e31e2c5..351a2237 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/runner/JobResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt
@@ -20,10 +20,10 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.runner
+package org.opendc.web.server.rest.runner
-import org.opendc.web.api.service.JobService
import org.opendc.web.proto.runner.Job
+import org.opendc.web.server.service.JobService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
@@ -60,6 +60,13 @@ class JobResource @Inject constructor(private val jobService: JobService) {
@Path("{job}")
@Transactional
fun update(@PathParam("job") id: Long, @Valid update: Job.Update): Job {
- return jobService.updateState(id, update.state, update.results) ?: throw WebApplicationException("Job not found", 404)
+ return try {
+ jobService.updateState(id, update.state, update.results)
+ ?: throw WebApplicationException("Job not found", 404)
+ } catch (e: IllegalArgumentException) {
+ throw WebApplicationException(e, 400)
+ } catch (e: IllegalStateException) {
+ throw WebApplicationException(e, 409)
+ }
}
}
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt
index e720de75..352dd491 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.quarkus.security.identity.SecurityIdentity
-import org.opendc.web.api.service.PortfolioService
import org.opendc.web.proto.user.Portfolio
+import org.opendc.web.server.service.PortfolioService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt
index 8d24b2eb..f2372bde 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.quarkus.security.identity.SecurityIdentity
-import org.opendc.web.api.service.ScenarioService
import org.opendc.web.proto.user.Scenario
+import org.opendc.web.server.service.ScenarioService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ProjectResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt
index a27d50e7..f3d96f55 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ProjectResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.quarkus.security.identity.SecurityIdentity
-import org.opendc.web.api.service.ProjectService
import org.opendc.web.proto.user.Project
+import org.opendc.web.server.service.ProjectService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt
index 3690f987..24cdcb6a 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/ScenarioResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.quarkus.security.identity.SecurityIdentity
-import org.opendc.web.api.service.ScenarioService
import org.opendc.web.proto.user.Scenario
+import org.opendc.web.server.service.ScenarioService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/TopologyResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt
index 52c5eaaa..40b3741c 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/rest/user/TopologyResource.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.quarkus.security.identity.SecurityIdentity
-import org.opendc.web.api.service.TopologyService
import org.opendc.web.proto.user.Topology
+import org.opendc.web.server.service.TopologyService
import javax.annotation.security.RolesAllowed
import javax.inject.Inject
import javax.transaction.Transactional
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/JobService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/JobService.kt
index 1b33248d..6b49e8b6 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/JobService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/JobService.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.repository.JobRepository
import org.opendc.web.proto.JobState
import org.opendc.web.proto.runner.Job
+import org.opendc.web.server.repository.JobRepository
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/PortfolioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt
index 1f41c2d7..0d380190 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/PortfolioService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt
@@ -20,16 +20,16 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.model.*
-import org.opendc.web.api.repository.PortfolioRepository
-import org.opendc.web.api.repository.ProjectRepository
import org.opendc.web.proto.user.Portfolio
+import org.opendc.web.server.model.*
+import org.opendc.web.server.repository.PortfolioRepository
+import org.opendc.web.server.repository.ProjectRepository
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
-import org.opendc.web.api.model.Portfolio as PortfolioEntity
+import org.opendc.web.server.model.Portfolio as PortfolioEntity
/**
* Service for managing [Portfolio]s.
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ProjectService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt
index c3e43395..44348195 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ProjectService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.model.*
-import org.opendc.web.api.repository.ProjectRepository
import org.opendc.web.proto.user.Project
import org.opendc.web.proto.user.ProjectRole
+import org.opendc.web.server.model.*
+import org.opendc.web.server.repository.ProjectRepository
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/RunnerConversions.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/RunnerConversions.kt
index 3722a641..1dcc95ee 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/RunnerConversions.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/RunnerConversions.kt
@@ -20,12 +20,12 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.model.Job
-import org.opendc.web.api.model.Portfolio
-import org.opendc.web.api.model.Scenario
-import org.opendc.web.api.model.Topology
+import org.opendc.web.server.model.Job
+import org.opendc.web.server.model.Portfolio
+import org.opendc.web.server.model.Scenario
+import org.opendc.web.server.model.Topology
/**
* Conversions into DTOs provided to OpenDC runners.
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ScenarioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt
index dd51a929..5b56068d 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/ScenarioService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.model.*
-import org.opendc.web.api.repository.*
import org.opendc.web.proto.user.Scenario
+import org.opendc.web.server.model.*
+import org.opendc.web.server.repository.*
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TopologyService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TopologyService.kt
index f3460496..5c2a457a 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TopologyService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TopologyService.kt
@@ -20,15 +20,15 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.repository.ProjectRepository
-import org.opendc.web.api.repository.TopologyRepository
import org.opendc.web.proto.user.Topology
+import org.opendc.web.server.repository.ProjectRepository
+import org.opendc.web.server.repository.TopologyRepository
import java.time.Instant
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
-import org.opendc.web.api.model.Topology as TopologyEntity
+import org.opendc.web.server.model.Topology as TopologyEntity
/**
* Service for managing [Topology]s.
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TraceService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TraceService.kt
index a942696e..bd14950c 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/TraceService.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/TraceService.kt
@@ -20,10 +20,10 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.repository.TraceRepository
import org.opendc.web.proto.Trace
+import org.opendc.web.server.repository.TraceRepository
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/UserConversions.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt
index 8612ee8c..ee78d103 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/UserConversions.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt
@@ -20,10 +20,10 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
-import org.opendc.web.api.model.*
import org.opendc.web.proto.user.Project
+import org.opendc.web.server.model.*
/**
* Conversions into DTOs provided to users.
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/Utils.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/Utils.kt
index 254be8b7..2d0da3b3 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/service/Utils.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/Utils.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.service
+package org.opendc.web.server.service
import org.opendc.web.proto.user.ProjectRole
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/DevSecurityOverrideFilter.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/DevSecurityOverrideFilter.kt
index ba2cf2ae..0bdf959a 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/DevSecurityOverrideFilter.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/DevSecurityOverrideFilter.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util
+package org.opendc.web.server.util
import io.quarkus.arc.properties.IfBuildProperty
import java.security.Principal
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/KotlinModuleCustomizer.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/KotlinModuleCustomizer.kt
index 8d91a00c..8634c8a4 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/KotlinModuleCustomizer.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/KotlinModuleCustomizer.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util
+package org.opendc.web.server.util
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt
index 134739c9..9e29b734 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/AbstractJsonSqlTypeDescriptor.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import org.hibernate.type.descriptor.ValueExtractor
import org.hibernate.type.descriptor.WrapperOptions
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
index 32f69928..45752d4e 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt
@@ -1,4 +1,4 @@
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import com.fasterxml.jackson.databind.JsonNode
import org.hibernate.type.descriptor.ValueBinder
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
index eaecc5b0..216c465f 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import org.hibernate.type.descriptor.ValueBinder
import org.hibernate.type.descriptor.WrapperOptions
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt
index e005f368..f5069c4c 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import org.hibernate.dialect.H2Dialect
import org.hibernate.dialect.PostgreSQL81Dialect
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonStringSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
index cf400c95..3d10cb0e 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt
@@ -1,4 +1,4 @@
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import org.hibernate.type.descriptor.ValueBinder
import org.hibernate.type.descriptor.WrapperOptions
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonType.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt
index 2206e82f..98663640 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonType.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import com.fasterxml.jackson.databind.ObjectMapper
import org.hibernate.type.AbstractSingleColumnStandardBasicType
diff --git a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt
index 3386582e..6c6078dd 100644
--- a/opendc-web/opendc-web-api/src/main/kotlin/org/opendc/web/api/util/hibernate/json/JsonTypeDescriptor.kt
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.util.hibernate.json
+package org.opendc.web.server.util.hibernate.json
import com.fasterxml.jackson.databind.ObjectMapper
import org.hibernate.HibernateException
diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/runner/QuarkusJobManager.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/runner/QuarkusJobManager.kt
new file mode 100644
index 00000000..4704c5ae
--- /dev/null
+++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/runner/QuarkusJobManager.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2022 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.server.util.runner
+
+import org.opendc.web.proto.JobState
+import org.opendc.web.proto.runner.Job
+import org.opendc.web.runner.JobManager
+import org.opendc.web.server.service.JobService
+import javax.enterprise.context.ApplicationScoped
+import javax.inject.Inject
+import javax.transaction.Transactional
+
+/**
+ * Implementation of [JobManager] that interfaces directly with [JobService] without overhead of the REST API.
+ */
+@ApplicationScoped
+class QuarkusJobManager @Inject constructor(private val service: JobService) : JobManager {
+ @Transactional
+ override fun findNext(): Job? {
+ return service.queryPending().firstOrNull()
+ }
+
+ @Transactional
+ override fun claim(id: Long): Boolean {
+ return try {
+ service.updateState(id, JobState.CLAIMED, null)
+ true
+ } catch (e: IllegalStateException) {
+ false
+ }
+ }
+
+ @Transactional
+ override fun heartbeat(id: Long) {
+ service.updateState(id, JobState.RUNNING, null)
+ }
+
+ @Transactional
+ override fun fail(id: Long) {
+ service.updateState(id, JobState.FAILED, null)
+ }
+
+ @Transactional
+ override fun finish(id: Long, results: Map<String, Any>) {
+ service.updateState(id, JobState.FINISHED, results)
+ }
+}
diff --git a/opendc-web/opendc-web-api/src/main/resources/META-INF/branding/logo.png b/opendc-web/opendc-web-server/src/main/resources/META-INF/branding/logo.png
index d743038b..d743038b 100644
--- a/opendc-web/opendc-web-api/src/main/resources/META-INF/branding/logo.png
+++ b/opendc-web/opendc-web-server/src/main/resources/META-INF/branding/logo.png
Binary files differ
diff --git a/opendc-web/opendc-web-api/src/main/resources/application-dev.properties b/opendc-web/opendc-web-server/src/main/resources/application-dev.properties
index 08d11609..4065f55f 100644
--- a/opendc-web/opendc-web-api/src/main/resources/application-dev.properties
+++ b/opendc-web/opendc-web-server/src/main/resources/application-dev.properties
@@ -19,22 +19,19 @@
# SOFTWARE.
# Datasource (H2)
-quarkus.datasource.db-kind = h2
-quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;INIT=CREATE TYPE IF NOT EXISTS "JSONB" AS blob;
+quarkus.datasource.db-kind=h2
+quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;INIT=CREATE TYPE IF NOT EXISTS "JSONB" AS json;
# Hibernate
quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
-quarkus.hibernate-orm.database.generation=drop-and-create
-quarkus.hibernate-orm.sql-load-script=init-dev.sql
+quarkus.flyway.clean-at-start=true
-# OpenID
-quarkus.oidc.enabled=false
-quarkus.oidc.auth-server-url=
-quarkus.oidc.client-id=
+# Disable authentication
+opendc.security.enabled=false
-# OpenDC web UI
+# Mount web UI at root and API at "/api"
quarkus.opendc-ui.path=/
quarkus.resteasy.path=/api
-opendc.security.enabled=false
-
+# Swagger UI
+quarkus.smallrye-openapi.servers=http://localhost:8080
diff --git a/opendc-web/opendc-web-server/src/main/resources/application-docker.properties b/opendc-web/opendc-web-server/src/main/resources/application-docker.properties
new file mode 100644
index 00000000..eae9ee1e
--- /dev/null
+++ b/opendc-web/opendc-web-server/src/main/resources/application-docker.properties
@@ -0,0 +1,49 @@
+# Copyright (c) 2022 AtLarge Research
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# Configuration for standalone Docker server distribution without web UI.
+
+# Datasource
+quarkus.datasource.db-kind=postgresql
+quarkus.datasource.username=${OPENDC_DB_USERNAME}
+quarkus.datasource.password=${OPENDC_DB_PASSWORD}
+quarkus.datasource.jdbc.url=${OPENDC_DB_URL}
+
+# Hibernate
+quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQL95Dialect
+
+# Disable OpenDC web UI
+quarkus.opendc-ui.include=false
+
+# Security
+opendc.security.enabled=true
+quarkus.oidc.auth-server-url=https://${OPENDC_AUTH0_DOMAIN}
+quarkus.oidc.client-id=${OPENDC_AUTH0_AUDIENCE}
+quarkus.oidc.token.audience=${quarkus.oidc.client-id}
+quarkus.oidc.roles.role-claim-path=scope
+
+# Swagger UI
+quarkus.swagger-ui.oauth-client-id=${OPENDC_AUTH0_DOCS_CLIENT_ID:}
+quarkus.swagger-ui.oauth-additional-query-string-params={"audience":"${OPENDC_AUTH0_AUDIENCE:https://api.opendc.org/v2/}"}
+
+quarkus.smallrye-openapi.security-scheme=oidc
+quarkus.smallrye-openapi.security-scheme-name=Auth0
+quarkus.smallrye-openapi.oidc-open-id-connect-url=https://${OPENDC_AUTH0_DOMAIN:opendc.eu.auth0.com}/.well-known/openid-configuration
+quarkus.smallrye-openapi.servers=https://api.opendc.org
diff --git a/opendc-web/opendc-web-api/src/main/resources/application-prod.properties b/opendc-web/opendc-web-server/src/main/resources/application-prod.properties
index cebcdaab..8e6a9720 100644
--- a/opendc-web/opendc-web-api/src/main/resources/application-prod.properties
+++ b/opendc-web/opendc-web-server/src/main/resources/application-prod.properties
@@ -18,16 +18,20 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# Datasource
-quarkus.datasource.db-kind=postgresql
-quarkus.datasource.username=${OPENDC_DB_USERNAME}
-quarkus.datasource.password=${OPENDC_DB_PASSWORD}
-quarkus.datasource.jdbc.url=${OPENDC_DB_URL}
+# Datasource (H2)
+quarkus.datasource.db-kind=h2
+quarkus.datasource.jdbc.url=jdbc:h2:file:./data/opendc;DB_CLOSE_DELAY=-1;INIT=CREATE TYPE IF NOT EXISTS "JSONB" AS json;
# Hibernate
-quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQL95Dialect
-quarkus.hibernate-orm.database.generation=validate
+quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
-# Disable OpenDC web UI and runner
-quarkus.opendc-ui.include=false
-quarkus.opendc-runner.include=false
+# Disable authentication
+opendc.security.enabled=false
+quarkus.oidc.enabled=${opendc.security.enabled}
+
+# Mount web UI at root and API at "/api"
+quarkus.opendc-ui.path=/
+quarkus.resteasy.path=/api
+
+# Swagger UI
+quarkus.smallrye-openapi.servers=http://localhost:8080
diff --git a/opendc-web/opendc-web-api/src/main/resources/application-test.properties b/opendc-web/opendc-web-server/src/main/resources/application-test.properties
index 10197119..338a00b9 100644
--- a/opendc-web/opendc-web-api/src/main/resources/application-test.properties
+++ b/opendc-web/opendc-web-server/src/main/resources/application-test.properties
@@ -20,20 +20,17 @@
# Datasource configuration
quarkus.datasource.db-kind = h2
-quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;INIT=CREATE TYPE "JSONB" AS blob;
+quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;INIT=CREATE TYPE IF NOT EXISTS "JSONB" AS json;
quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
-quarkus.hibernate-orm.database.generation=drop-and-create
+quarkus.flyway.clean-at-start=true
-# No OIDC for tests
+# Disable security
quarkus.oidc.enabled=false
-quarkus.oidc.auth-server-url=
-quarkus.oidc.client-id=
# Disable OpenAPI/Swagger
quarkus.smallrye-openapi.enable=false
quarkus.swagger-ui.enable=false
-quarkus.smallrye-openapi.oidc-open-id-connect-url=
# Disable OpenDC web UI and runner
quarkus.opendc-ui.include=false
diff --git a/opendc-web/opendc-web-api/src/main/resources/application.properties b/opendc-web/opendc-web-server/src/main/resources/application.properties
index fa134e7e..40933304 100644
--- a/opendc-web/opendc-web-api/src/main/resources/application.properties
+++ b/opendc-web/opendc-web-server/src/main/resources/application.properties
@@ -18,13 +18,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+# Enable CORS
quarkus.http.cors=true
-# OpenID
-quarkus.oidc.auth-server-url=https://${OPENDC_AUTH0_DOMAIN}
-quarkus.oidc.client-id=${OPENDC_AUTH0_AUDIENCE}
-quarkus.oidc.token.audience=${quarkus.oidc.client-id}
-quarkus.oidc.roles.role-claim-path=scope
+# Security
+quarkus.oidc.enabled=${opendc.security.enabled}
+
+# Runner logging
+quarkus.log.category."org.opendc".level=ERROR
+quarkus.log.category."org.opendc.web".level=INFO
+quarkus.log.category."org.apache".level=WARN
# OpenAPI and Swagger
quarkus.smallrye-openapi.info-title=OpenDC REST API
@@ -39,10 +42,7 @@ quarkus.smallrye-openapi.info-license-url=https://github.com/atlarge-research/op
quarkus.swagger-ui.path=docs
quarkus.swagger-ui.always-include=true
-quarkus.swagger-ui.oauth-client-id=${OPENDC_AUTH0_DOCS_CLIENT_ID:}
-quarkus.swagger-ui.oauth-additional-query-string-params={"audience":"${OPENDC_AUTH0_AUDIENCE:https://api.opendc.org/}"}
-quarkus.smallrye-openapi.security-scheme=oidc
-quarkus.smallrye-openapi.security-scheme-name=Auth0
-quarkus.smallrye-openapi.oidc-open-id-connect-url=https://${OPENDC_AUTH0_DOMAIN:opendc.eu.auth0.com}/.well-known/openid-configuration
-quarkus.smallrye-openapi.servers=http://localhost:8080
+# Flyway database migrations
+quarkus.flyway.baseline-on-migrate=true
+quarkus.flyway.migrate-at-start=true
diff --git a/opendc-web/opendc-web-server/src/main/resources/db/migration/V1.0.0__core.sql b/opendc-web/opendc-web-server/src/main/resources/db/migration/V1.0.0__core.sql
new file mode 100644
index 00000000..183a70ea
--- /dev/null
+++ b/opendc-web/opendc-web-server/src/main/resources/db/migration/V1.0.0__core.sql
@@ -0,0 +1,144 @@
+-- Hibernate sequence for unique identifiers
+create sequence hibernate_sequence start with 1 increment by 1;
+
+-- Projects
+create table projects
+(
+ id bigint not null,
+ created_at timestamp not null,
+ name varchar(255) not null,
+ portfolios_created integer not null,
+ scenarios_created integer not null,
+ topologies_created integer not null,
+ updated_at timestamp not null,
+ primary key (id)
+);
+
+-- Project authorizations authorize users specific permissions to a project.
+create table project_authorizations
+(
+ project_id bigint not null,
+ user_id varchar(255) not null,
+ role integer not null,
+ primary key (project_id, user_id)
+);
+
+-- Topologies represent the datacenter designs created by users.
+create table topologies
+(
+ id bigint not null,
+ created_at timestamp not null,
+ name varchar(255) not null,
+ number integer not null,
+ rooms jsonb not null,
+ updated_at timestamp not null,
+ project_id bigint not null,
+ primary key (id)
+);
+
+-- Portfolios
+create table portfolios
+(
+ id bigint not null,
+ name varchar(255) not null,
+ number integer not null,
+ targets jsonb not null,
+ project_id bigint not null,
+ primary key (id)
+);
+
+create table scenarios
+(
+ id bigint not null,
+ name varchar(255) not null,
+ number integer not null,
+ phenomena jsonb not null,
+ scheduler_name varchar(255) not null,
+ sampling_fraction double precision not null,
+ job_id bigint,
+ portfolio_id bigint not null,
+ project_id bigint not null,
+ topology_id bigint not null,
+ trace_id varchar(255) not null,
+ primary key (id)
+);
+
+create table jobs
+(
+ id bigint not null,
+ created_at timestamp not null,
+ repeats integer not null,
+ results jsonb,
+ state integer not null,
+ updated_at timestamp not null,
+ primary key (id)
+);
+
+-- Workload traces available to the user.
+create table traces
+(
+ id varchar(255) not null,
+ name varchar(255) not null,
+ type varchar(255) not null,
+ primary key (id)
+);
+
+-- Relations
+alter table project_authorizations
+ add constraint FK824hw0npe6gwiamwb6vohsu19
+ foreign key (project_id)
+ references projects;
+
+create index fn_topologies_number on topologies (project_id, number);
+
+alter table topologies
+ add constraint UK2s5na63qtu2of4g7odocmwi2a unique (project_id, number);
+
+alter table topologies
+ add constraint FK1kpw87pylq7m2ct9lq0ed1u3b
+ foreign key (project_id)
+ references projects;
+
+create index fn_portfolios_number on portfolios (project_id, number);
+
+alter table portfolios
+ add constraint FK31ytuaxb7aboxueng9hq7owwa
+ foreign key (project_id)
+ references projects;
+
+alter table portfolios
+ add constraint UK56dtskxruwj22dvxny2hfhks1 unique (project_id, number);
+
+create index fn_scenarios_number on scenarios (project_id, number);
+
+alter table scenarios
+ add constraint UKd0bk6fmtw5qiu9ty7t3g9crqd unique (project_id, number);
+
+alter table scenarios
+ add constraint FK9utvg0i5uu8db9pa17a1d77iy
+ foreign key (job_id)
+ references jobs;
+
+alter table scenarios
+ add constraint FK181y5hv0uibhj7fpbpkdy90s5
+ foreign key (portfolio_id)
+ references portfolios;
+
+alter table scenarios
+ add constraint FKbvwyh4joavs444rj270o3b8fr
+ foreign key (project_id)
+ references projects;
+
+alter table scenarios
+ add constraint FKrk6ltvaf9lp0aukp9dq3qjujj
+ foreign key (topology_id)
+ references topologies;
+
+alter table scenarios
+ add constraint FK5m05tqeekqjkbbsaj3ehl6o8n
+ foreign key (trace_id)
+ references traces;
+
+-- Initial data
+insert into traces (id, name, type)
+values ('bitbrains-small', 'Bitbrains Small', 'vm');
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/SchedulerResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/SchedulerResourceTest.kt
index e88e1c1c..c1460db9 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/SchedulerResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/SchedulerResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest
+package org.opendc.web.server.rest
import io.quarkus.test.junit.QuarkusTest
import io.restassured.http.ContentType
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/TraceResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/TraceResourceTest.kt
index 6fab9953..2490cf46 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/TraceResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/TraceResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest
+package org.opendc.web.server.rest
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -34,8 +34,8 @@ import org.hamcrest.Matchers
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.TraceService
import org.opendc.web.proto.Trace
+import org.opendc.web.server.service.TraceService
/**
* Test suite for [TraceResource].
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/runner/JobResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt
index b82c60e8..c96788b0 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/runner/JobResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.runner
+package org.opendc.web.server.rest.runner
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,13 +35,13 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.JobService
import org.opendc.web.proto.*
import org.opendc.web.proto.Targets
import org.opendc.web.proto.runner.Job
import org.opendc.web.proto.runner.Portfolio
import org.opendc.web.proto.runner.Scenario
import org.opendc.web.proto.runner.Topology
+import org.opendc.web.server.service.JobService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioResourceTest.kt
index f74efbca..5798d2e7 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,11 +35,11 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.PortfolioService
import org.opendc.web.proto.Targets
import org.opendc.web.proto.user.Portfolio
import org.opendc.web.proto.user.Project
import org.opendc.web.proto.user.ProjectRole
+import org.opendc.web.server.service.PortfolioService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt
index dbafa8c0..13c47d19 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/PortfolioScenarioResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,9 +35,9 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.ScenarioService
import org.opendc.web.proto.*
import org.opendc.web.proto.user.*
+import org.opendc.web.server.service.ScenarioService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ProjectResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ProjectResourceTest.kt
index bcbcbab1..fec8759c 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ProjectResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ProjectResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,9 +35,9 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.ProjectService
import org.opendc.web.proto.user.Project
import org.opendc.web.proto.user.ProjectRole
+import org.opendc.web.server.service.ProjectService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ScenarioResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt
index 65e6e9a1..1d63679e 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/ScenarioResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,9 +35,9 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.ScenarioService
import org.opendc.web.proto.*
import org.opendc.web.proto.user.*
+import org.opendc.web.server.service.ScenarioService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/TopologyResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/TopologyResourceTest.kt
index ececeaca..8a542d33 100644
--- a/opendc-web/opendc-web-api/src/test/kotlin/org/opendc/web/api/rest/user/TopologyResourceTest.kt
+++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/TopologyResourceTest.kt
@@ -20,7 +20,7 @@
* SOFTWARE.
*/
-package org.opendc.web.api.rest.user
+package org.opendc.web.server.rest.user
import io.mockk.every
import io.quarkiverse.test.junit.mockk.InjectMock
@@ -35,10 +35,10 @@ import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-import org.opendc.web.api.service.TopologyService
import org.opendc.web.proto.user.Project
import org.opendc.web.proto.user.ProjectRole
import org.opendc.web.proto.user.Topology
+import org.opendc.web.server.service.TopologyService
import java.time.Instant
/**
diff --git a/opendc-web/opendc-web-ui/Dockerfile b/opendc-web/opendc-web-ui/Dockerfile
index 15a92068..5ff85092 100644
--- a/opendc-web/opendc-web-ui/Dockerfile
+++ b/opendc-web/opendc-web-ui/Dockerfile
@@ -2,8 +2,8 @@ FROM node:16 AS staging
MAINTAINER OpenDC Maintainers <opendc@atlarge-research.com>
# Copy package details
-COPY ./package.json ./yarn.lock /opendc/
-RUN cd /opendc && yarn install --frozen-lockfile
+COPY ./package.json ./package-lock.json /opendc/
+RUN cd /opendc && npm ci
# Build frontend
FROM node:16 AS build
@@ -17,12 +17,12 @@ RUN cd /opendc/ \
NEXT_PUBLIC_AUTH0_DOMAIN="%%NEXT_PUBLIC_AUTH0_DOMAIN%%" \
NEXT_PUBLIC_AUTH0_CLIENT_ID="%%NEXT_PUBLIC_AUTH0_CLIENT_ID%%" \
NEXT_PUBLIC_AUTH0_AUDIENCE="%%NEXT_PUBLIC_AUTH0_AUDIENCE%%" \
- && yarn build \
- && yarn cache clean --all \
- && mv .next .next.template
+ && npm run build \
+ && npm cache clean --force \
+ && mv build/next build/next.template
FROM node:16-slim
COPY --from=build /opendc /opendc
WORKDIR /opendc
-CMD ./scripts/envsubst.sh; yarn start
+CMD ./scripts/envsubst.sh; npm run start
diff --git a/opendc-web/opendc-web-ui/scripts/envsubst.sh b/opendc-web/opendc-web-ui/scripts/envsubst.sh
index d7ae9ecb..afc976ed 100755
--- a/opendc-web/opendc-web-ui/scripts/envsubst.sh
+++ b/opendc-web/opendc-web-ui/scripts/envsubst.sh
@@ -3,8 +3,8 @@
set -e
auto_envsubst() {
- input_path="/opendc/.next.template"
- output_path="/opendc/.next"
+ input_path="build/next.template"
+ output_path="build/next"
cp -r "$input_path" "$output_path"
find "$output_path" -type f -name '*.js' -exec perl -pi -e 's/%%(NEXT_PUBLIC_[_A-Z0-9]+)%%/$ENV{$1}/g' {} \;
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 170267a5..860cbda5 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -36,7 +36,7 @@ include(":opendc-faas:opendc-faas-workload")
include(":opendc-experiments:opendc-experiments-capelin")
include(":opendc-experiments:opendc-experiments-tf20")
include(":opendc-web:opendc-web-proto")
-include(":opendc-web:opendc-web-api")
+include(":opendc-web:opendc-web-server")
include(":opendc-web:opendc-web-client")
include(":opendc-web:opendc-web-ui")
include(":opendc-web:opendc-web-ui-quarkus")