Bump up Micronaut to 3.6.1 + remove Asciidoctor and DocController + prepare for Graalvm native image

Signed-off-by: Thraax Session <thraax.session@iatlas.technology>
This commit is contained in:
Thraax Session 2022-08-20 13:00:00 +02:00
parent 92969f2e42
commit 7c33b69583
6 changed files with 52 additions and 221 deletions

4
.gitignore vendored
View File

@ -10,4 +10,6 @@ out/
*.iws
.project
.settings
.classpath
.classpath
.asciidoctor/

View File

@ -1,11 +1,11 @@
plugins {
id "org.asciidoctor.jvm.convert" version "3.3.2"
id "com.github.jruby-gradle.base" version "2.0.2"
id "org.jetbrains.kotlin.jvm" version "1.7.10"
id "org.jetbrains.kotlin.kapt" version "1.7.10"
id "org.jetbrains.kotlin.plugin.allopen" version "1.7.10"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "org.sonarqube" version "3.3"
id 'io.micronaut.application' version '3.5.1'
id "application"
id 'maven-publish'
}
@ -28,15 +28,15 @@ configurations {
dependencies {
kapt(platform("io.micronaut:micronaut-bom:$micronautVersion"))
kapt('io.micronaut:micronaut-inject-java:3.5.1')
kapt('io.micronaut:micronaut-validation:3.5.1')
kapt('io.micronaut:micronaut-inject-java:3.5.4')
kapt('io.micronaut:micronaut-validation:3.5.4')
kapt("io.micronaut:micronaut-graal:$micronautVersion")
kapt('io.micronaut.openapi:micronaut-openapi:4.3.0')
kapt('io.micronaut.security:micronaut-security-annotations:3.6.1')
kapt('io.micronaut.openapi:micronaut-openapi:4.4.3')
kapt('io.micronaut.security:micronaut-security-annotations:3.6.3')
compileOnly(platform("io.micronaut:micronaut-bom:$micronautVersion"))
compileOnly('org.graalvm.nativeimage:svm:22.1.0.1')
compileOnly('org.graalvm.nativeimage:svm:22.2.0')
implementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))
implementation('io.micronaut:micronaut-management:3.5.1')
implementation('io.micronaut:micronaut-management:3.5.4')
implementation("io.micronaut:micronaut-inject:$micronautVersion")
implementation("io.micronaut:micronaut-validation:$micronautVersion")
implementation('io.micronaut.rxjava3:micronaut-rxjava3:2.2.1')
@ -48,31 +48,29 @@ dependencies {
implementation('javax.annotation:javax.annotation-api:1.3.2')
implementation("io.micronaut:micronaut-http-server-netty:$micronautVersion")
implementation("io.micronaut:micronaut-http-client:$micronautVersion")
implementation('io.swagger.core.v3:swagger-annotations:2.2.0')
implementation("io.micronaut.reactor:micronaut-reactor")
implementation('io.swagger.core.v3:swagger-annotations:2.2.2')
implementation('io.micronaut:micronaut-tracing:3.2.7')
runtimeOnly('io.jaegertracing:jaeger-thrift:1.8.0')
runtimeOnly('io.jaegertracing:jaeger-thrift:1.8.1')
implementation("io.micronaut.security:micronaut-security:3.2.0")
implementation('io.micronaut.security:micronaut-security-jwt:3.6.1')
implementation('io.micronaut.security:micronaut-security-jwt:3.6.3')
implementation('io.micronaut.kotlin:micronaut-kotlin-extension-functions:3.2.2')
implementation('io.micronaut.cache:micronaut-cache-caffeine:3.4.1')
implementation('io.micronaut.cache:micronaut-cache-caffeine:3.5.0')
implementation('com.google.code.gson:gson:2.9.0')
implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2')
implementation('com.github.mwiede:jsch:0.2.1')
implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4')
implementation('com.github.mwiede:jsch:0.2.2')
// NoSQL
implementation('io.micronaut.mongodb:micronaut-mongo-reactive:4.3.0')
implementation("org.litote.kmongo:kmongo:4.5.1")
implementation("org.litote.kmongo:kmongo-async:4.5.1")
implementation('org.litote.kmongo:kmongo:4.6.1')
implementation('org.litote.kmongo:kmongo-async:4.6.1')
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
// Shell commands
implementation('com.lordcodes.turtle:turtle:0.7.0')
// Asciidoc Plantuml
implementation group: 'org.asciidoctor', name: 'asciidoctorj', version: '2.5.2'
implementation group: 'org.asciidoctor', name: 'asciidoctorj-api', version: '2.5.2'
implementation group: 'org.asciidoctor', name: 'asciidoctorj-diagram', version: '2.2.1'
// https://mvnrepository.com/artifact/org.jasypt/jasypt
// used for De-Encryption
implementation('org.jasypt:jasypt:1.9.3')
// My stuff
@ -80,17 +78,17 @@ dependencies {
runtimeOnly("ch.qos.logback:logback-classic")
runtimeOnly('com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1')
runtimeOnly('io.netty:netty-tcnative:2.0.53.Final')
runtimeOnly('io.netty:netty-tcnative-boringssl-static:2.0.53.Final')
runtimeOnly('io.netty:netty-tcnative:2.0.54.Final')
runtimeOnly('io.netty:netty-tcnative-boringssl-static:2.0.54.Final')
implementation("org.reflections:reflections:0.10.2")
kaptTest(enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion"))
kaptTest("io.micronaut:micronaut-inject-java:$micronautVersion")
testImplementation(enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion"))
testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.2')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0')
testImplementation("io.micronaut.test:micronaut-test-junit5:$micronautVersion")
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.2')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.0')
// Docker Testcontainer
testImplementation 'org.testcontainers:testcontainers:1.17.2'
testImplementation 'org.testcontainers:testcontainers:1.17.3'
}
test.classpath += configurations.developmentOnly
@ -178,7 +176,14 @@ tasks.withType(JavaExec) {
}
}
apply from: 'gradle/asciidoc.gradle'
graalvmNative {
binaries {
main {
imageName.set('SpaceUp-Server')
buildArgs.add('--verbose')
}
}
}
publishing {
publications {

View File

@ -8,6 +8,6 @@
# 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.
#
micronautVersion=3.5.4
micronautVersion=3.6.1
kotlinVersion=1.7.10
kotlin.code.style=official

View File

@ -1,47 +1,16 @@
/*
* Copyright (c) 2022 spaceup@iatlas.technology.
* SpaceUp-Server is free software; You can redistribute it and/or modify it under the terms of:
* - the GNU Affero General Public License version 3 as published by the Free Software Foundation.
* You don't have to do anything special to accept the license and you dont have to notify anyone which that you have made that decision.
* Copyright (c) 2022 Gino Atlas.
*
* SpaceUp-Server is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See your chosen license for more details.
* 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:
*
* You should have received a copy of both licenses along with SpaceUp-Server
* If not, see <http://www.gnu.org/licenses/>.
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
*
* There is a strong belief within us that the license we have chosen provides not only the best solution for providing you with the essential freedom necessary to use SpaceUp-Server within your projects, but also for maintaining enough copyleft strength for us to feel confident and secure with releasing our hard work to the public. For your convenience we've included our own interpretation of the license we chose, which can be seen below.
*
* Our interpretation of the GNU Affero General Public License version 3: (Quoted words are words in which there exists a definition within the license to avoid ambiguity.)
* 1. You must always provide the source code, copyright and license information of SpaceUp-Server whenever you "convey" any part of SpaceUp-Server;
* be it a verbatim copy or a modified copy.
* 2. SpaceUp-Server was developed as a library and has therefore been designed without knowledge of your work; as such the following should be implied:
* a) SpaceUp-Server was developed without knowledge of your work; as such the following should be implied:
* i) SpaceUp-Server should not fall under a work which is "based on" your work.
* ii) You should be free to use SpaceUp-Server in a work covered by the:
* - GNU General Public License version 2
* - GNU Lesser General Public License version 2.1
* This is due to those licenses classifying SpaceUp-Server as a work which would fall under an "aggregate" work by their terms and definitions;
* as such it should not be covered by their terms and conditions. The relevant passages start at:
* - Line 129 of the GNU General Public License version 2
* - Line 206 of the GNU Lesser General Public License version 2.1
* b) If you have not "modified", "adapted" or "extended" SpaceUp-Server then your work should not be bound by this license,
* as you are using SpaceUp-Server under the definition of an "aggregate" work.
* c) If you have "modified", "adapted" or "extended" SpaceUp-Server then any of those modifications/extensions/adaptations which you have made
* should indeed be bound by this license, as you are using SpaceUp-Server under the definition of a "based on" work.
*
* Our hopes is that our own interpretation of license aligns perfectly with your own values and goals for using our work freely and securely. If you have any questions at all about the licensing chosen for SpaceUp-Server you can email us directly at spaceup@iatlas.technology or you can get in touch with the license authors (the Free Software Foundation) at licensing@fsf.org to gain their opinion too.
*
* Alternatively you can provide feedback and acquire the support you need at our support forum. We'll definitely try and help you as soon as possible, and to the best of our ability; as we understand that user experience is everything, so we want to make you as happy as possible! So feel free to get in touch via our support forum and chat with other users of SpaceUp-Server here at:
* https://spaceup.iatlas.technology
*
* Thanks, and we hope you enjoy using SpaceUp-Server and that it's everything you ever hoped it could be.
* 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 technology.iatlas.spaceup
import io.micronaut.core.annotation.TypeHint
import io.micronaut.http.HttpResponse
import io.micronaut.runtime.Micronaut.build
import io.swagger.v3.oas.annotations.OpenAPIDefinition
@ -49,6 +18,12 @@ import io.swagger.v3.oas.annotations.info.Info
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor
import technology.iatlas.spaceup.dto.Feedback
@TypeHint(
typeNames = [
"com.github.benmanes.caffeine.cache.SSMS"
]
)
@OpenAPIDefinition(
info = Info(
title = "SpaceUp",

View File

@ -1,119 +0,0 @@
/*
* Copyright (c) 2022 spaceup@iatlas.technology.
* SpaceUp-Server is free software; You can redistribute it and/or modify it under the terms of:
* - the GNU Affero General Public License version 3 as published by the Free Software Foundation.
* You don't have to do anything special to accept the license and you dont have to notify anyone which that you have made that decision.
*
* SpaceUp-Server is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See your chosen license for more details.
*
* You should have received a copy of both licenses along with SpaceUp-Server
* If not, see <http://www.gnu.org/licenses/>.
*
*
* There is a strong belief within us that the license we have chosen provides not only the best solution for providing you with the essential freedom necessary to use SpaceUp-Server within your projects, but also for maintaining enough copyleft strength for us to feel confident and secure with releasing our hard work to the public. For your convenience we've included our own interpretation of the license we chose, which can be seen below.
*
* Our interpretation of the GNU Affero General Public License version 3: (Quoted words are words in which there exists a definition within the license to avoid ambiguity.)
* 1. You must always provide the source code, copyright and license information of SpaceUp-Server whenever you "convey" any part of SpaceUp-Server;
* be it a verbatim copy or a modified copy.
* 2. SpaceUp-Server was developed as a library and has therefore been designed without knowledge of your work; as such the following should be implied:
* a) SpaceUp-Server was developed without knowledge of your work; as such the following should be implied:
* i) SpaceUp-Server should not fall under a work which is "based on" your work.
* ii) You should be free to use SpaceUp-Server in a work covered by the:
* - GNU General Public License version 2
* - GNU Lesser General Public License version 2.1
* This is due to those licenses classifying SpaceUp-Server as a work which would fall under an "aggregate" work by their terms and definitions;
* as such it should not be covered by their terms and conditions. The relevant passages start at:
* - Line 129 of the GNU General Public License version 2
* - Line 206 of the GNU Lesser General Public License version 2.1
* b) If you have not "modified", "adapted" or "extended" SpaceUp-Server then your work should not be bound by this license,
* as you are using SpaceUp-Server under the definition of an "aggregate" work.
* c) If you have "modified", "adapted" or "extended" SpaceUp-Server then any of those modifications/extensions/adaptations which you have made
* should indeed be bound by this license, as you are using SpaceUp-Server under the definition of a "based on" work.
*
* Our hopes is that our own interpretation of license aligns perfectly with your own values and goals for using our work freely and securely. If you have any questions at all about the licensing chosen for SpaceUp-Server you can email us directly at spaceup@iatlas.technology or you can get in touch with the license authors (the Free Software Foundation) at licensing@fsf.org to gain their opinion too.
*
* Alternatively you can provide feedback and acquire the support you need at our support forum. We'll definitely try and help you as soon as possible, and to the best of our ability; as we understand that user experience is everything, so we want to make you as happy as possible! So feel free to get in touch via our support forum and chat with other users of SpaceUp-Server here at:
* https://spaceup.iatlas.technology
*
* Thanks, and we hope you enjoy using SpaceUp-Server and that it's everything you ever hoped it could be.
*/
package technology.iatlas.spaceup.controller
import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import io.micronaut.runtime.server.EmbeddedServer
import io.micronaut.security.annotation.Secured
import io.micronaut.security.rules.SecurityRule
import org.asciidoctor.*
import org.slf4j.LoggerFactory
import java.io.File
import java.util.*
@Secured(SecurityRule.IS_ANONYMOUS)
@Controller("/")
class DocController(
private val es: EmbeddedServer
) {
private val log = LoggerFactory.getLogger(DocController::class.java)
private val stylesDir = this.javaClass.getResource("/docs/asciidoc/style")!!
@Secured(SecurityRule.IS_ANONYMOUS)
@Get(uri = "{?theme}", produces = [MediaType.TEXT_HTML])
fun getDocs(theme: Optional<String>): String {
val baseUrl = es.scheme + "://" + es.host + ":" + es.port
val applyTheme = if(theme.isPresent) theme.get() else "asciidoctor"
val adoc = this.javaClass.getResource("/docs/asciidoc/index.adoc")!!.readText()
val cssDir = File(stylesDir.file).canonicalPath
log.debug("CSS dir: $cssDir")
System.setProperty("jruby.compat.version", "RUBY1_9")
System.setProperty("jruby.compile.mode", "OFF")
val asciidoc = Asciidoctor.Factory.create()
asciidoc.requireLibrary("asciidoctor-diagram")
val attr = Attributes.builder()
.styleSheetName("$applyTheme.css")
.stylesDir(cssDir)
.linkCss(false)
.copyCss(false)
.tableOfContents(true)
.tableOfContents(Placement.LEFT)
.dataUri(true)
.allowUriRead(true)
.experimental(true)
.attribute("data-baseurl", baseUrl)
.attribute("data-themes", getAllStylesheets())
.build()
val options = Options.builder()
.safe(SafeMode.SAFE)
.headerFooter(true)
.backend("html5")
.build()
options.setAttributes(attr)
return asciidoc.convert(adoc, options)
}
private fun getAllStylesheets(): List<String> {
val allFiles = mutableListOf<String>()
File(stylesDir.file).walk().forEach {
log.trace("CSS file: $it")
if(it.isFile && it.name.contains(".css")) {
allFiles.add(it.name.split(".")[0])
}
}
return allFiles.sorted()
}
}

View File

@ -1,49 +1,17 @@
<!--
~ Copyright (c) 2022 spaceup@iatlas.technology.
~ SpaceUp-Server is free software; You can redistribute it and/or modify it under the terms of:
~ - the GNU Affero General Public License version 3 as published by the Free Software Foundation.
~ You don't have to do anything special to accept the license and you dont have to notify anyone which that you have made that decision.
~ Copyright (c) 2022 Gino Atlas.
~
~ SpaceUp-Server is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See your chosen license for more details.
~ 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:
~
~ You should have received a copy of both licenses along with SpaceUp-Server
~ If not, see <http://www.gnu.org/licenses/>.
~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
~
~
~ There is a strong belief within us that the license we have chosen provides not only the best solution for providing you with the essential freedom necessary to use SpaceUp-Server within your projects, but also for maintaining enough copyleft strength for us to feel confident and secure with releasing our hard work to the public. For your convenience we've included our own interpretation of the license we chose, which can be seen below.
~
~ Our interpretation of the GNU Affero General Public License version 3: (Quoted words are words in which there exists a definition within the license to avoid ambiguity.)
~ 1. You must always provide the source code, copyright and license information of SpaceUp-Server whenever you "convey" any part of SpaceUp-Server;
~ be it a verbatim copy or a modified copy.
~ 2. SpaceUp-Server was developed as a library and has therefore been designed without knowledge of your work; as such the following should be implied:
~ a) SpaceUp-Server was developed without knowledge of your work; as such the following should be implied:
~ i) SpaceUp-Server should not fall under a work which is "based on" your work.
~ ii) You should be free to use SpaceUp-Server in a work covered by the:
~ - GNU General Public License version 2
~ - GNU Lesser General Public License version 2.1
~ This is due to those licenses classifying SpaceUp-Server as a work which would fall under an "aggregate" work by their terms and definitions;
~ as such it should not be covered by their terms and conditions. The relevant passages start at:
~ - Line 129 of the GNU General Public License version 2
~ - Line 206 of the GNU Lesser General Public License version 2.1
~ b) If you have not "modified", "adapted" or "extended" SpaceUp-Server then your work should not be bound by this license,
~ as you are using SpaceUp-Server under the definition of an "aggregate" work.
~ c) If you have "modified", "adapted" or "extended" SpaceUp-Server then any of those modifications/extensions/adaptations which you have made
~ should indeed be bound by this license, as you are using SpaceUp-Server under the definition of a "based on" work.
~
~ Our hopes is that our own interpretation of license aligns perfectly with your own values and goals for using our work freely and securely. If you have any questions at all about the licensing chosen for SpaceUp-Server you can email us directly at spaceup@iatlas.technology or you can get in touch with the license authors (the Free Software Foundation) at licensing@fsf.org to gain their opinion too.
~
~ Alternatively you can provide feedback and acquire the support you need at our support forum. We'll definitely try and help you as soon as possible, and to the best of our ability; as we understand that user experience is everything, so we want to make you as happy as possible! So feel free to get in touch via our support forum and chat with other users of SpaceUp-Server here at:
~ https://spaceup.iatlas.technology
~
~ Thanks, and we hope you enjoy using SpaceUp-Server and that it's everything you ever hoped it could be.
~ 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 scan="true" scanPeriod="15 seconds">
<!--configuration scan="true" scanPeriod="15 seconds" does not work with GraalVM -->
<configuration>
<appender name="root" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<!--withJansi>true</withJansi does not work with GraalVM-->
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>