diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-08-03 14:42:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-03 14:42:49 +0200 |
| commit | 2692a032b8ecbe2ddccfb88628cf37af56c3ea36 (patch) | |
| tree | 5dde4331c0a10dd8e843c75cf68d2c7d3cd45906 /opendc-web/opendc-web-runner-quarkus-deployment | |
| parent | b023b085425c0d0f7952c2c331576b8d0fc8c857 (diff) | |
| parent | 87df18bb691260ee69d2e48cf1598e6a4acc329b (diff) | |
merge: Simplify OpenDC deployment process
This pull request attempts to simplify the deployment process necessary for
deploying OpenDC locally or using Docker. There was currently not a clear
and simple way to deploy OpenDC locally, yet the Docker-based deployment
was also out-of-sync.
## Implementation Notes :hammer_and_pick:
* Address several bugs in the OpenDC web runner
* Fix dependency related issues
* Rename `opendc-web-api` to `opendc-web-server`
* Create a local distribution of `opendc-web-server`.
* Fix Docker deployment
* Update deployment guide
## External Dependencies :four_leaf_clover:
* Quarkus 2.11.1
* `jandex-gradle-plugin` 0.13.2
## Breaking API Changes :warning:
* `TraceFormat.installedProviders` has been changed to `TraceFormat.getInstalledProviders`.
The list of installed providers is now not cached at first access, but queried every time the
method is invoked and its results depend on the caller context (e.g., context class loader).
* `OpenDCRunner` now requires a `JobManager` as constructor argument, which can be
constructed as follows: `JobManager.create(client)`
* `opendc-web-api` is now renamed to `opendc-web-server`.
Diffstat (limited to 'opendc-web/opendc-web-runner-quarkus-deployment')
2 files changed, 28 insertions, 4 deletions
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); } /** |
