diff options
50 files changed, 418 insertions, 187 deletions
diff --git a/.dockerignore b/.dockerignore index c4627e72..e4d96f71 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ +Dockerfile + .git .idea/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..4c74bb36 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,48 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push-simulator: + name: Push Simulator + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: atlargeresearch/opendc + tag_with_ref: true + push-api: + name: Push API + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + context: opendc-web/opendc-web-api + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: atlargeresearch/opendc-web-api + tag_with_ref: true + push-ui: + name: Push UI + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + context: opendc-web/opendc-web-ui + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: atlargeresearch/opendc-web-ui + tag_with_ref: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d9cd6c97 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + tags: ['v*'] + +jobs: + build: + name: Build OpenDC + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 15 ] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.java }}-gradle- + - name: Build with Gradle + run: ./gradlew :assembleDist + - name: Publish with Gradle + run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_signingKeyId: F8134F9C + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-m') }} + files: build/distributions/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -9,9 +9,9 @@ RUN ./gradlew --version # Build project COPY ./ /app/ -RUN ./gradlew --no-daemon :opendc-web:opendc-web-runner:installDist +RUN ./gradlew --no-daemon :installDist FROM openjdk:15-slim -COPY --from=0 /app/opendc-web/opendc-web-runner/build/install /app -WORKDIR /app -CMD opendc-web-runner/bin/opendc-web-runner +COPY --from=0 /app/build/install /opt/ +WORKDIR /opt/opendc +CMD bin/opendc-web-runner diff --git a/build.gradle.kts b/build.gradle.kts index a4d02854..791c6ca8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,5 +28,5 @@ plugins { allprojects { group = "org.opendc" - version = "2.0.0" + version = "2.0-rc1" } diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 5337ee96..c9f9ab38 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -1,6 +1,4 @@ /* - * MIT License - * * Copyright (c) 2019 AtLarge Research * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts index 580f67cb..26780205 100644 --- a/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/experiment-conventions.gradle.kts @@ -23,8 +23,8 @@ import gradle.kotlin.dsl.accessors._9bf86420fccbde1948375f641de89b70.sourceSets */ plugins { - `java-library` distribution + id("kotlin-conventions") id("com.github.johnrengelman.shadow") } diff --git a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts new file mode 100644 index 00000000..7bab52fc --- /dev/null +++ b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 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. + */ + +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `java-library` + kotlin("jvm") + id("org.jlleitschuh.gradle.ktlint") +} + +/* Project configuration */ +repositories { + mavenCentral() +} + +java { + sourceCompatibility = Versions.jvmTarget +} + +tasks.withType<KotlinCompile>().configureEach { + kotlinOptions.jvmTarget = Versions.jvmTarget.toString() + kotlinOptions.useIR = true + kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" +} diff --git a/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts index 43b1d148..296d5967 100644 --- a/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kotlin-library-conventions.gradle.kts @@ -1,7 +1,5 @@ /* - * MIT License - * - * Copyright (c) 2019 atlarge-research + * Copyright (c) 2021 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 @@ -22,30 +20,17 @@ * SOFTWARE. */ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { - `java-library` - kotlin("jvm") - id("org.jlleitschuh.gradle.ktlint") + id("kotlin-conventions") + id("publishing-conventions") id("dokka-conventions") } /* Project configuration */ -repositories { - mavenCentral() -} - java { - sourceCompatibility = Versions.jvmTarget + withSourcesJar() } kotlin { explicitApi() } - -tasks.withType<KotlinCompile>().configureEach { - kotlinOptions.jvmTarget = Versions.jvmTarget.toString() - kotlinOptions.useIR = true - kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" -} diff --git a/buildSrc/src/main/kotlin/publishing-conventions.gradle.kts b/buildSrc/src/main/kotlin/publishing-conventions.gradle.kts new file mode 100644 index 00000000..76f54102 --- /dev/null +++ b/buildSrc/src/main/kotlin/publishing-conventions.gradle.kts @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2021 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. + */ + +import org.gradle.api.credentials.PasswordCredentials + +plugins { + `maven-publish` + signing + id("dokka-conventions") +} + +val isSnapshot = project.version.toString().contains("SNAPSHOT") + +// Ensure project is built successfully before publishing it +tasks.withType<PublishToMavenRepository>().configureEach { + dependsOn(tasks.build) +} +tasks.withType<PublishToMavenLocal>().configureEach { + dependsOn(tasks.build) +} + +val javadocJar by tasks.registering(Jar::class) { + // Note that we publish the Dokka HTML artifacts as Javadoc + dependsOn(tasks.dokkaHtml) + archiveClassifier.set("javadoc") + from(tasks.dokkaHtml) +} + +signing { + val signingKeyId: String? by project + val signingKey: String? by project + val signingPassword: String? by project + + if (!signingKey.isNullOrBlank()) { + if (signingKeyId?.isNotBlank() == true) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + } else { + useInMemoryPgpKeys(signingKey, signingPassword) + } + } + + sign(publishing.publications) +} + +publishing { + publications { + create<MavenPublication>("maven") { + from(components["java"]) + artifact(javadocJar) + + pom { + name.set(project.name) + description.set("Open-source platform for datacenter simulation") + url.set("https://opendc.org") + licenses { + license { + name.set("MIT") + url.set("https://opensource.org/licenses/MIT") + } + } + developers { + developer { + id.set("AtLarge Research") + name.set("AtLarge Research Team") + organization.set("AtLarge Research") + organizationUrl.set("https://atlarge-research.com") + } + } + scm { + connection.set("scm:git:git://github.com/atlarge-research/opendc.git") + developerConnection.set("scm:git:git://github.com/atlarge-research/opendc.git") + url.set("https://github.com/atlarge-research/opendc") + } + } + } + } + + repositories { + maven { + val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + + name = "ossrh" + url = if (isSnapshot) snapshotsRepoUrl else releasesRepoUrl + credentials(PasswordCredentials::class) + } + } +} diff --git a/docker-compose.override.yml b/docker-compose.override.yml index e48f4dff..172cc4cd 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -3,11 +3,10 @@ version: "3.8" # Docker Compose overrides for development environments services: frontend: - build: - args: - OPENDC_API_BASE_URL: http://localhost:8081 ports: - "8080:80" + environment: + API_BASE_URL: http://localhost:8081 api: ports: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 3cefdcdd..96bb004e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -3,11 +3,10 @@ version: "3.8" # Docker Compose overrides for production environments services: frontend: - build: - args: - OPENDC_API_BASE_URL: ${OPENDC_API_BASE_URL} ports: - "8080:80" + environment: + API_BASE_URL: ${OPENDC_API_BASE_URL} api: ports: diff --git a/docker-compose.yml b/docker-compose.yml index 982f2ed8..30c00996 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,13 +3,13 @@ services: frontend: build: context: opendc-web/opendc-web-ui - args: - OPENDC_OAUTH_CLIENT_ID: ${OPENDC_OAUTH_CLIENT_ID} - OPENDC_FRONTEND_SENTRY_DSN: ${OPENDC_FRONTEND_SENTRY_DSN} image: frontend restart: on-failure networks: - backend + environment: + OAUTH_CLIENT_ID: ${OPENDC_OAUTH_CLIENT_ID} + SENTRY_DSN: ${OPENDC_FRONTEND_SENTRY_DSN} api: build: opendc-web/opendc-web-api diff --git a/gradle.properties b/gradle.properties index 20f4b711..f9eabb4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,6 +20,9 @@ # SOFTWARE. # +# For Dokka https://github.com/Kotlin/dokka/issues/1405 +org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G + # Dependencies kotlinx-coroutines.version = 1.4.3 diff --git a/opendc-compute/opendc-compute-api/build.gradle.kts b/opendc-compute/opendc-compute-api/build.gradle.kts index 835dbbb8..880ee03d 100644 --- a/opendc-compute/opendc-compute-api/build.gradle.kts +++ b/opendc-compute/opendc-compute-api/build.gradle.kts @@ -28,5 +28,5 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) } diff --git a/opendc-compute/opendc-compute-service/build.gradle.kts b/opendc-compute/opendc-compute-service/build.gradle.kts index 909e2dcd..4e1be97a 100644 --- a/opendc-compute/opendc-compute-service/build.gradle.kts +++ b/opendc-compute/opendc-compute-service/build.gradle.kts @@ -30,12 +30,12 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-compute:opendc-compute-api")) - api(project(":opendc-telemetry:opendc-telemetry-api")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcCompute.opendcComputeApi) + api(projects.opendcTelemetry.opendcTelemetryApi) + implementation(projects.opendcUtils) implementation("io.github.microutils:kotlin-logging") - testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl") } diff --git a/opendc-compute/opendc-compute-simulator/build.gradle.kts b/opendc-compute/opendc-compute-simulator/build.gradle.kts index 3bf8a114..0d0a57ad 100644 --- a/opendc-compute/opendc-compute-simulator/build.gradle.kts +++ b/opendc-compute/opendc-compute-simulator/build.gradle.kts @@ -30,14 +30,14 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-compute:opendc-compute-service")) - api(project(":opendc-simulator:opendc-simulator-compute")) - api(project(":opendc-simulator:opendc-simulator-failures")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcCompute.opendcComputeService) + api(projects.opendcSimulator.opendcSimulatorCompute) + api(projects.opendcSimulator.opendcSimulatorFailures) + implementation(projects.opendcUtils) implementation("io.github.microutils:kotlin-logging") - testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testImplementation(project(":opendc-telemetry:opendc-telemetry-sdk")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) + testImplementation(projects.opendcTelemetry.opendcTelemetrySdk) testRuntimeOnly("org.slf4j:slf4j-simple:${versions.slf4j}") } diff --git a/opendc-experiments/opendc-experiments-capelin/build.gradle.kts b/opendc-experiments/opendc-experiments-capelin/build.gradle.kts index 06a35c4b..ca4aa35f 100644 --- a/opendc-experiments/opendc-experiments-capelin/build.gradle.kts +++ b/opendc-experiments/opendc-experiments-capelin/build.gradle.kts @@ -24,19 +24,18 @@ description = "Experiments for the Capelin work" /* Build configuration */ plugins { - `kotlin-library-conventions` `experiment-conventions` `testing-conventions` } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-engine")) - implementation(project(":opendc-format")) - implementation(project(":opendc-simulator:opendc-simulator-core")) - implementation(project(":opendc-simulator:opendc-simulator-compute")) - implementation(project(":opendc-simulator:opendc-simulator-failures")) - implementation(project(":opendc-compute:opendc-compute-simulator")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessApi) + implementation(projects.opendcFormat) + implementation(projects.opendcSimulator.opendcSimulatorCore) + implementation(projects.opendcSimulator.opendcSimulatorCompute) + implementation(projects.opendcSimulator.opendcSimulatorFailures) + implementation(projects.opendcCompute.opendcComputeSimulator) implementation("io.github.microutils:kotlin-logging") implementation("com.typesafe:config") @@ -49,5 +48,5 @@ dependencies { exclude(group = "log4j") } - implementation(project(":opendc-telemetry:opendc-telemetry-sdk")) + implementation(projects.opendcTelemetry.opendcTelemetrySdk) } diff --git a/opendc-experiments/opendc-experiments-energy21/build.gradle.kts b/opendc-experiments/opendc-experiments-energy21/build.gradle.kts index fc37fc1c..64e52f88 100644 --- a/opendc-experiments/opendc-experiments-energy21/build.gradle.kts +++ b/opendc-experiments/opendc-experiments-energy21/build.gradle.kts @@ -24,20 +24,20 @@ description = "Experiments for the OpenDC Energy work" /* Build configuration */ plugins { - `kotlin-library-conventions` `experiment-conventions` `testing-conventions` } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-engine")) - implementation(project(":opendc-format")) - implementation(project(":opendc-simulator:opendc-simulator-core")) - implementation(project(":opendc-simulator:opendc-simulator-compute")) - implementation(project(":opendc-compute:opendc-compute-simulator")) - implementation(project(":opendc-experiments:opendc-experiments-capelin")) - implementation(project(":opendc-telemetry:opendc-telemetry-sdk")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessApi) + implementation(projects.opendcFormat) + implementation(projects.opendcSimulator.opendcSimulatorCore) + implementation(projects.opendcSimulator.opendcSimulatorCompute) + implementation(projects.opendcSimulator.opendcSimulatorFailures) + implementation(projects.opendcCompute.opendcComputeSimulator) + implementation(projects.opendcExperiments.opendcExperimentsCapelin) + implementation(projects.opendcTelemetry.opendcTelemetrySdk) implementation("io.github.microutils:kotlin-logging") implementation("com.typesafe:config") diff --git a/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts b/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts index f19d6067..c35070fe 100644 --- a/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts +++ b/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts @@ -24,18 +24,17 @@ description = "Experiments for OpenDC Serverless" /* Build configuration */ plugins { - `kotlin-library-conventions` `experiment-conventions` `testing-conventions` } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-engine")) - implementation(project(":opendc-serverless:opendc-serverless-service")) - implementation(project(":opendc-serverless:opendc-serverless-simulator")) - implementation(project(":opendc-telemetry:opendc-telemetry-sdk")) - implementation(project(":opendc-harness:opendc-harness-cli")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessApi) + implementation(projects.opendcSimulator.opendcSimulatorCore) + implementation(projects.opendcServerless.opendcServerlessService) + implementation(projects.opendcServerless.opendcServerlessSimulator) + implementation(projects.opendcTelemetry.opendcTelemetrySdk) implementation("io.github.microutils:kotlin-logging") implementation("com.typesafe:config") diff --git a/opendc-format/build.gradle.kts b/opendc-format/build.gradle.kts index ea43275a..cfe849e2 100644 --- a/opendc-format/build.gradle.kts +++ b/opendc-format/build.gradle.kts @@ -30,11 +30,11 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-compute:opendc-compute-api")) - api(project(":opendc-workflow:opendc-workflow-api")) - implementation(project(":opendc-simulator:opendc-simulator-compute")) - implementation(project(":opendc-compute:opendc-compute-simulator")) + api(platform(projects.opendcPlatform)) + api(projects.opendcCompute.opendcComputeApi) + api(projects.opendcWorkflow.opendcWorkflowApi) + implementation(projects.opendcSimulator.opendcSimulatorCompute) + implementation(projects.opendcCompute.opendcComputeSimulator) api("com.fasterxml.jackson.module:jackson-module-kotlin:${versions["jackson-module-kotlin"]}") implementation("org.apache.parquet:parquet-avro:${versions["parquet-avro"]}") diff --git a/opendc-harness/opendc-harness-api/build.gradle.kts b/opendc-harness/opendc-harness-api/build.gradle.kts index 67b1ce11..02adae9a 100644 --- a/opendc-harness/opendc-harness-api/build.gradle.kts +++ b/opendc-harness/opendc-harness-api/build.gradle.kts @@ -28,7 +28,7 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("org.junit.platform:junit-platform-commons:${versions.junitPlatform}") implementation("io.github.microutils:kotlin-logging") diff --git a/opendc-harness/opendc-harness-cli/build.gradle.kts b/opendc-harness/opendc-harness-cli/build.gradle.kts index 3e169e2a..b1f049de 100644 --- a/opendc-harness/opendc-harness-cli/build.gradle.kts +++ b/opendc-harness/opendc-harness-cli/build.gradle.kts @@ -24,7 +24,7 @@ description = "Command line interface of OpenDC Harness" /* Build configuration */ plugins { - `kotlin-library-conventions` + `kotlin-conventions` application } @@ -34,8 +34,8 @@ application { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-engine")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessEngine) implementation("io.github.microutils:kotlin-logging") implementation("com.github.ajalt.clikt:clikt:${versions["clikt"]}") diff --git a/opendc-harness/opendc-harness-engine/build.gradle.kts b/opendc-harness/opendc-harness-engine/build.gradle.kts index bffafdac..6b59cbed 100644 --- a/opendc-harness/opendc-harness-engine/build.gradle.kts +++ b/opendc-harness/opendc-harness-engine/build.gradle.kts @@ -30,8 +30,8 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-api")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessApi) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") implementation("io.github.classgraph:classgraph:${versions["classgraph"]}") diff --git a/opendc-harness/opendc-harness-junit5/build.gradle.kts b/opendc-harness/opendc-harness-junit5/build.gradle.kts index aa0b78d5..ba0f323f 100644 --- a/opendc-harness/opendc-harness-junit5/build.gradle.kts +++ b/opendc-harness/opendc-harness-junit5/build.gradle.kts @@ -28,8 +28,8 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-harness:opendc-harness-engine")) + api(platform(projects.opendcPlatform)) + api(projects.opendcHarness.opendcHarnessEngine) implementation("io.github.microutils:kotlin-logging") implementation("org.junit.platform:junit-platform-engine:${versions.junitPlatform}") diff --git a/opendc-serverless/opendc-serverless-api/build.gradle.kts b/opendc-serverless/opendc-serverless-api/build.gradle.kts index ec33ccce..0d9a8036 100644 --- a/opendc-serverless/opendc-serverless-api/build.gradle.kts +++ b/opendc-serverless/opendc-serverless-api/build.gradle.kts @@ -28,5 +28,5 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) } diff --git a/opendc-serverless/opendc-serverless-service/build.gradle.kts b/opendc-serverless/opendc-serverless-service/build.gradle.kts index f7e43aba..9aae05fc 100644 --- a/opendc-serverless/opendc-serverless-service/build.gradle.kts +++ b/opendc-serverless/opendc-serverless-service/build.gradle.kts @@ -30,12 +30,12 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-serverless:opendc-serverless-api")) - api(project(":opendc-telemetry:opendc-telemetry-api")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcServerless.opendcServerlessApi) + api(projects.opendcTelemetry.opendcTelemetryApi) + implementation(projects.opendcUtils) implementation("io.github.microutils:kotlin-logging") - testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl") } diff --git a/opendc-serverless/opendc-serverless-simulator/build.gradle.kts b/opendc-serverless/opendc-serverless-simulator/build.gradle.kts index fe3dca41..08014fce 100644 --- a/opendc-serverless/opendc-serverless-simulator/build.gradle.kts +++ b/opendc-serverless/opendc-serverless-simulator/build.gradle.kts @@ -30,10 +30,10 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-serverless:opendc-serverless-service")) - api(project(":opendc-simulator:opendc-simulator-compute")) + api(platform(projects.opendcPlatform)) + api(projects.opendcServerless.opendcServerlessService) + api(projects.opendcSimulator.opendcSimulatorCompute) - testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) testRuntimeOnly("org.slf4j:slf4j-simple:${versions.slf4j}") } diff --git a/opendc-simulator/opendc-simulator-compute/build.gradle.kts b/opendc-simulator/opendc-simulator-compute/build.gradle.kts index 4b0069e3..a7d396c7 100644 --- a/opendc-simulator/opendc-simulator-compute/build.gradle.kts +++ b/opendc-simulator/opendc-simulator-compute/build.gradle.kts @@ -30,9 +30,9 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-simulator:opendc-simulator-core")) - api(project(":opendc-simulator:opendc-simulator-resources")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcSimulator.opendcSimulatorResources) + implementation(projects.opendcSimulator.opendcSimulatorCore) + implementation(projects.opendcUtils) implementation("org.yaml:snakeyaml:1.28") } diff --git a/opendc-simulator/opendc-simulator-core/build.gradle.kts b/opendc-simulator/opendc-simulator-core/build.gradle.kts index 3ba0d8c3..485bf5a6 100644 --- a/opendc-simulator/opendc-simulator-core/build.gradle.kts +++ b/opendc-simulator/opendc-simulator-core/build.gradle.kts @@ -28,6 +28,6 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") } diff --git a/opendc-simulator/opendc-simulator-failures/build.gradle.kts b/opendc-simulator/opendc-simulator-failures/build.gradle.kts index 0f6b2de2..6c266d23 100644 --- a/opendc-simulator/opendc-simulator-failures/build.gradle.kts +++ b/opendc-simulator/opendc-simulator-failures/build.gradle.kts @@ -27,6 +27,6 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") } diff --git a/opendc-simulator/opendc-simulator-resources/build.gradle.kts b/opendc-simulator/opendc-simulator-resources/build.gradle.kts index 3b0a197c..08e0bc78 100644 --- a/opendc-simulator/opendc-simulator-resources/build.gradle.kts +++ b/opendc-simulator/opendc-simulator-resources/build.gradle.kts @@ -30,10 +30,10 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - implementation(project(":opendc-utils")) + implementation(projects.opendcUtils) - jmhImplementation(project(":opendc-simulator:opendc-simulator-core")) - testImplementation(project(":opendc-simulator:opendc-simulator-core")) + jmhImplementation(projects.opendcSimulator.opendcSimulatorCore) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) } diff --git a/opendc-telemetry/opendc-telemetry-api/build.gradle.kts b/opendc-telemetry/opendc-telemetry-api/build.gradle.kts index d9a4b4dd..927e9bc5 100644 --- a/opendc-telemetry/opendc-telemetry-api/build.gradle.kts +++ b/opendc-telemetry/opendc-telemetry-api/build.gradle.kts @@ -28,7 +28,7 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("io.opentelemetry:opentelemetry-api:${versions.otelApi}") api("io.opentelemetry:opentelemetry-api-metrics:${versions.otelApiMetrics}") } diff --git a/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts b/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts index 350a0f74..b845c1c9 100644 --- a/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts +++ b/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts @@ -28,8 +28,8 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-telemetry:opendc-telemetry-api")) + api(platform(projects.opendcPlatform)) + api(projects.opendcTelemetry.opendcTelemetryApi) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") api("io.opentelemetry:opentelemetry-sdk:${versions.otelSdk}") api("io.opentelemetry:opentelemetry-sdk-metrics:${versions.otelSdkMetrics}") diff --git a/opendc-utils/build.gradle.kts b/opendc-utils/build.gradle.kts index 48214665..9f712b89 100644 --- a/opendc-utils/build.gradle.kts +++ b/opendc-utils/build.gradle.kts @@ -29,8 +29,8 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) + api(platform(projects.opendcPlatform)) api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - testImplementation(project(":opendc-simulator:opendc-simulator-core")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) } diff --git a/opendc-web/opendc-web-api/.dockerignore b/opendc-web/opendc-web-api/.dockerignore new file mode 100644 index 00000000..06d67de9 --- /dev/null +++ b/opendc-web/opendc-web-api/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile + +.idea/ +**/out +*.iml +.idea_modules/ + +.pytest_cache diff --git a/opendc-web/opendc-web-api/.gitlab-ci.yml b/opendc-web/opendc-web-api/.gitlab-ci.yml deleted file mode 100644 index d80ba836..00000000 --- a/opendc-web/opendc-web-api/.gitlab-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -image: "python:3.8" - -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -cache: - paths: - - .cache/pip - -stages: - - static-analysis - - test - -static-analysis: - stage: static-analysis - script: - - python --version - - pip install -r requirements.txt - - pylint opendc - -test: - stage: test - script: - - python --version - - pip install -r requirements.txt - - pytest opendc diff --git a/opendc-web/opendc-web-runner/build.gradle.kts b/opendc-web/opendc-web-runner/build.gradle.kts index fcc78a83..60a24b92 100644 --- a/opendc-web/opendc-web-runner/build.gradle.kts +++ b/opendc-web/opendc-web-runner/build.gradle.kts @@ -24,7 +24,7 @@ description = "Experiment runner for OpenDC" /* Build configuration */ plugins { - `kotlin-library-conventions` + `kotlin-conventions` application } @@ -33,12 +33,12 @@ application { } dependencies { - api(platform(project(":opendc-platform"))) - implementation(project(":opendc-compute:opendc-compute-simulator")) - implementation(project(":opendc-format")) - implementation(project(":opendc-experiments:opendc-experiments-capelin")) - implementation(project(":opendc-simulator:opendc-simulator-core")) - implementation(project(":opendc-simulator:opendc-simulator-compute")) + api(platform(projects.opendcPlatform)) + implementation(projects.opendcCompute.opendcComputeSimulator) + implementation(projects.opendcFormat) + implementation(projects.opendcExperiments.opendcExperimentsCapelin) + implementation(projects.opendcSimulator.opendcSimulatorCore) + implementation(projects.opendcTelemetry.opendcTelemetrySdk) implementation("io.github.microutils:kotlin-logging") implementation("com.github.ajalt.clikt:clikt:${versions["clikt"]}") @@ -48,6 +48,4 @@ dependencies { runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}") runtimeOnly("org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}") - - implementation(project(":opendc-telemetry:opendc-telemetry-sdk")) } diff --git a/opendc-web/opendc-web-ui/.dockerignore b/opendc-web/opendc-web-ui/.dockerignore index dd87e2d7..b91894f6 100644 --- a/opendc-web/opendc-web-ui/.dockerignore +++ b/opendc-web/opendc-web-ui/.dockerignore @@ -1,2 +1,9 @@ +Dockerfile + +.idea/ +**/out +*.iml +.idea_modules/ + node_modules build diff --git a/opendc-web/opendc-web-ui/.travis.yml b/opendc-web/opendc-web-ui/.travis.yml deleted file mode 100644 index c3554fe4..00000000 --- a/opendc-web/opendc-web-ui/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - 10 -cache: - directories: - - node_modules -script: - - npm run build - - npm test diff --git a/opendc-web/opendc-web-ui/Dockerfile b/opendc-web/opendc-web-ui/Dockerfile index 20e16b08..7aa3a7bf 100644 --- a/opendc-web/opendc-web-ui/Dockerfile +++ b/opendc-web/opendc-web-ui/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14 AS staging +FROM node:15 AS staging MAINTAINER OpenDC Maintainers <opendc@atlarge-research.com> # Copy package details @@ -6,21 +6,16 @@ COPY ./package.json ./yarn.lock /opendc/ RUN cd /opendc && yarn # Build frontend -FROM node:14 AS build - -ARG OPENDC_OAUTH_CLIENT_ID -ARG OPENDC_API_BASE_URL -ARG OPENDC_FRONTEND_SENTRY_DSN +FROM node:15 AS build COPY ./ /opendc COPY --from=staging /opendc/node_modules /opendc/node_modules RUN cd /opendc/ \ - && export REACT_APP_OAUTH_CLIENT_ID=$OPENDC_OAUTH_CLIENT_ID \ - && export REACT_APP_API_BASE_URL=$OPENDC_API_BASE_URL \ - && export REACT_APP_SENTRY_DSN=$OPENDC_FRONTEND_SENTRY_DSN \ - && yarn build + && yarn build \ + && mv build/index.html build/index.html.template # Setup nginx to serve the frontend -FROM nginx:1.19 +FROM nginx:1.20 +COPY --from=build /opendc/scripts/envsubst-html.sh /docker-entrypoint.d/00-envsubst-html.sh COPY --from=build /opendc/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/opendc-web/opendc-web-ui/public/index.html b/opendc-web/opendc-web-ui/public/index.html index 44a0d80f..da734797 100644 --- a/opendc-web/opendc-web-ui/public/index.html +++ b/opendc-web/opendc-web-ui/public/index.html @@ -33,7 +33,7 @@ <meta property="og:locale" content="en_US"> <!-- Google meta tags --> - <meta name="google-signin-client_id" content="%REACT_APP_OAUTH_CLIENT_ID%"> + <meta name="google-signin-client_id" content="$OAUTH_CLIENT_ID"> <meta name="google-site-verification" content="YIR4LkQTv6WmOdWv8MkeiUKni-0Yu3WHylLp4VvUMig"/> <!-- CDN dependencies --> @@ -52,6 +52,13 @@ gtag('js', new Date()) gtag('config', 'UA-84285092-3') </script> + <script> + window.$$env = { + API_BASE_URL: "$API_BASE_URL", + OAUTH_CLIENT_ID: "$OAUTH_CLIENT_ID", + SENTRY_DSN: "$SENTRY_DSN", + }; + </script> </head> <body> <noscript> diff --git a/opendc-web/opendc-web-ui/scripts/envsubst-html.sh b/opendc-web/opendc-web-ui/scripts/envsubst-html.sh new file mode 100755 index 00000000..8ca12e8a --- /dev/null +++ b/opendc-web/opendc-web-ui/scripts/envsubst-html.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +# We can use simple version of envsubst execution as +# envsubst < /usr/share/nginx/html/index.html.template > /usr/share/nginx/html/index.html +# but it replaces everything that looks like environment variable substitution +# so it affects `default values` approach. +# we need to replace only provided environment variables. + +auto_envsubst() { + template_path="/usr/share/nginx/html/index.html.template" + output_path="/usr/share/nginx/html/index.html" + defined_envs=$(printf '${%s} ' $(env | cut -d= -f1)) + envsubst "$defined_envs" < "$template_path" > "$output_path" +} + +auto_envsubst +exit 0 diff --git a/opendc-web/opendc-web-ui/src/api/routes/token-signin.js b/opendc-web/opendc-web-ui/src/api/routes/token-signin.js index d6cff570..e40127f2 100644 --- a/opendc-web/opendc-web-ui/src/api/routes/token-signin.js +++ b/opendc-web/opendc-web-ui/src/api/routes/token-signin.js @@ -1,5 +1,5 @@ export function performTokenSignIn(token) { - const apiUrl = process.env.REACT_APP_API_BASE_URL || '' + const apiUrl = window.$$env['API_BASE_URL'] || '' return fetch(`${apiUrl}/tokensignin`, { method: 'POST', diff --git a/opendc-web/opendc-web-ui/src/api/socket.js b/opendc-web/opendc-web-ui/src/api/socket.js index 1c432167..884c4152 100644 --- a/opendc-web/opendc-web-ui/src/api/socket.js +++ b/opendc-web/opendc-web-ui/src/api/socket.js @@ -7,7 +7,7 @@ const callbacks = {} export function setupSocketConnection(onConnect) { const apiUrl = - process.env.REACT_APP_API_BASE_URL || + window.$$env['API_BASE_URL'] || `${window.location.protocol}//${window.location.hostname}:${window.location.port}` socket = io.connect(apiUrl) diff --git a/opendc-web/opendc-web-ui/src/containers/auth/Login.js b/opendc-web/opendc-web-ui/src/containers/auth/Login.js index 2f9726bf..9201c09a 100644 --- a/opendc-web/opendc-web-ui/src/containers/auth/Login.js +++ b/opendc-web/opendc-web-ui/src/containers/auth/Login.js @@ -32,15 +32,15 @@ class LoginContainer extends React.Component { return ( <GoogleLogin - clientId={process.env.REACT_APP_OAUTH_CLIENT_ID} + clientId={window.$$env['OAUTH_CLIENT_ID']} onSuccess={this.onAuthResponse.bind(this)} onFailure={this.onAuthFailure.bind(this)} render={(renderProps) => ( <span onClick={renderProps.onClick} className="login btn btn-primary"> - <span className="fa fa-google" /> Login with Google + <span className="fa fa-google"/> Login with Google </span> )} - ></GoogleLogin> + /> ) } } diff --git a/opendc-web/opendc-web-ui/src/index.js b/opendc-web/opendc-web-ui/src/index.js index 3517147e..bddf0b0e 100644 --- a/opendc-web/opendc-web-ui/src/index.js +++ b/opendc-web/opendc-web-ui/src/index.js @@ -12,10 +12,11 @@ setupSocketConnection(() => { const store = configureStore() // Initialize Sentry if the user has configured a DSN - if (process.env.REACT_APP_SENTRY_DSN) { + const dsn = window.$$env['SENTRY_DSN'] + if (dsn) { Sentry.init({ environment: process.env.NODE_ENV, - dsn: process.env.REACT_APP_SENTRY_DSN, + dsn: dsn, integrations: [new Integrations.BrowserTracing()], tracesSampleRate: 0.1, }) diff --git a/opendc-workflow/opendc-workflow-api/build.gradle.kts b/opendc-workflow/opendc-workflow-api/build.gradle.kts index d3e67bee..45657d27 100644 --- a/opendc-workflow/opendc-workflow-api/build.gradle.kts +++ b/opendc-workflow/opendc-workflow-api/build.gradle.kts @@ -28,8 +28,7 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-compute:opendc-compute-api")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcCompute.opendcComputeApi) implementation("io.github.microutils:kotlin-logging") } diff --git a/opendc-workflow/opendc-workflow-service/build.gradle.kts b/opendc-workflow/opendc-workflow-service/build.gradle.kts index 040a9ff6..8cc66e4c 100644 --- a/opendc-workflow/opendc-workflow-service/build.gradle.kts +++ b/opendc-workflow/opendc-workflow-service/build.gradle.kts @@ -30,17 +30,17 @@ plugins { } dependencies { - api(platform(project(":opendc-platform"))) - api(project(":opendc-workflow:opendc-workflow-api")) - api(project(":opendc-compute:opendc-compute-api")) - api(project(":opendc-telemetry:opendc-telemetry-api")) - implementation(project(":opendc-utils")) + api(platform(projects.opendcPlatform)) + api(projects.opendcWorkflow.opendcWorkflowApi) + api(projects.opendcCompute.opendcComputeApi) + api(projects.opendcTelemetry.opendcTelemetryApi) + implementation(projects.opendcUtils) implementation("io.github.microutils:kotlin-logging") - testImplementation(project(":opendc-simulator:opendc-simulator-core")) - testImplementation(project(":opendc-compute:opendc-compute-simulator")) - testImplementation(project(":opendc-format")) - testImplementation(project(":opendc-telemetry:opendc-telemetry-sdk")) + testImplementation(projects.opendcSimulator.opendcSimulatorCore) + testImplementation(projects.opendcCompute.opendcComputeSimulator) + testImplementation(projects.opendcFormat) + testImplementation(projects.opendcTelemetry.opendcTelemetrySdk) testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:${versions["jackson-module-kotlin"]}") testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 1372f0dc..844c98e7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -48,3 +48,5 @@ include(":opendc-harness:opendc-harness-engine") include(":opendc-harness:opendc-harness-cli") include(":opendc-harness:opendc-harness-junit5") include(":opendc-utils") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") |
