Merge branch 'master' of gitlab.com:domaindrivenarchitecture/provs

This commit is contained in:
see 2022-01-21 18:29:36 +01:00
commit c7c93c34f5
7 changed files with 69 additions and 11 deletions

View file

@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization'
group = 'org.domaindrivenarchitecture.provs'
version = '0.8.37-SNAPSHOT'
version = '0.9.0-SNAPSHOT'
repositories {
mavenCentral()
@ -99,10 +99,10 @@ task fatJarLatest(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Fatjar of provs',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliWorkplaceKt'
'Main-Class': 'org.domaindrivenarchitecture.provs.desktop.application.CliWorkplaceKt'
}
with jar
archiveFileName = 'provs.jar'
archiveFileName = 'provs-desktop.jar'
}
task fatJarK3s(type: Jar) {
@ -116,13 +116,13 @@ task fatJarK3s(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Fatjar of provs k3s',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.extensions.server_software.k3s.application.CliKt'
'Main-Class': 'org.domaindrivenarchitecture.provs.server.application.ApplicationKt'
}
with jar
archiveFileName = 'provs-server.jar'
}
task uberjarWorkplace(type: Jar) {
task uberjarDesktop(type: Jar) {
from sourceSets.main.output
@ -137,9 +137,29 @@ task uberjarWorkplace(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Uberjar of provs',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
'Main-Class': 'org.domaindrivenarchitecture.provs.desktop.application.CliKt'
}
archiveFileName = 'provs-workplace.jar'
archiveFileName = 'provs-desktop.jar'
}
task uberjarServer(type: Jar) {
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
} {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
manifest {
attributes 'Implementation-Title': 'Uberjar of provs',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.server.application.ApplicationKt'
}
archiveFileName = 'provs-server.jar'
}
task uberjarEntry(type: Jar) {

View file

@ -10,6 +10,7 @@ package org.domaindrivenarchitecture.provs.framework.core.entry
* @param args[1] (optional) static method of the class with a vararg parameter of type String; if not specified, the "main" method is used
* @param args[2...] (optional) String parameters that are passed to the method; can be only used if method name (args[1]) is provided
*/
// TODO: jem - 2022.01.21 - do we need this way or can this be removed?
fun main(vararg args: String) {
if (args.isNotEmpty()) {

View file

@ -4,8 +4,6 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
import org.domaindrivenarchitecture.provs.framework.core.remote
import org.domaindrivenarchitecture.provs.framework.core.repeatTaskUntilSuccess
import org.domaindrivenarchitecture.provs.server.domain.applyK3sConfig
import org.domaindrivenarchitecture.provs.server.domain.installK3sServer
/**
@ -80,8 +78,8 @@ fun main() {
val host = "123.34.56.78"
remote(host, "root").task {
installK3sServer(tlsHost = host)
applyK3sConfig(appleConfig())
//installK3sServer(tlsHost = host)
//applyK3sConfig(appleConfig())
// optional check
checkAppleService(host)

View file

@ -5,6 +5,7 @@ import org.domaindrivenarchitecture.provs.framework.core.ProvResult
import org.domaindrivenarchitecture.provs.framework.core.echoCommandForText
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionK3sInfra
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionNetwork
/**
@ -13,5 +14,6 @@ import org.domaindrivenarchitecture.provs.server.infrastructure.provisionK3sInfr
* If tlsHost is specified, then tls (if configured) also applies to the specified host.
*/
fun Prov.provisionK3s() = task {
provisionNetwork()
provisionK3sInfra()
}

View file

@ -0,0 +1,28 @@
package org.domaindrivenarchitecture.provs.server.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFileFromResource
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileExists
val loopbackFile = "/etc/netplan/99-loopback.yaml"
val resourcePath = "org/domaindrivenarchitecture/provs/infrastructure/network/"
fun Prov.testNetworkExists(): Boolean {
return fileExists(loopbackFile)
}
fun Prov.provisionNetwork() = task {
if(!testNetworkExists()) {
createFileFromResource(
loopbackFile,
"99-loopback.yaml.template",
resourcePath,
"644",
sudo = true
)
cmd("netplan apply", sudo = true)
} else {
ProvResult(true)
}
}

View file

@ -0,0 +1,9 @@
network:
version: 2
ethernets:
lo:
renderer: networkd
match:
name: lo
addresses:
- 192.168.5.1/32