[skip ci] refactor packages

This commit is contained in:
az 2021-11-27 10:35:00 +01:00
parent abb93ebb13
commit d56ef884e5
16 changed files with 50 additions and 45 deletions

View file

@ -4,8 +4,8 @@ import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.NginxConf import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxHttpConf import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxHttpConf
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base.configurePrometheusDocker import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.configurePrometheusDocker
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base.runPrometheusDocker import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.runPrometheusDocker
@Suppress("unused") // used externally @Suppress("unused") // used externally

View file

@ -6,8 +6,8 @@ import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxCreateSelfSignedCertificate import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxCreateSelfSignedCertificate
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxHttpsConfWithLocationFiles import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxHttpsConfWithLocationFiles
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base.prometheusNginxConfig import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.prometheusNginxConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.provisionPrometheusDocker import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.provisionPrometheusDocker
@Suppress("unused") // used externally @Suppress("unused") // used externally

View file

@ -0,0 +1,31 @@
import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.applyK3sConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.infrastructure.apple.appleConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.infrastructure.apple.checkAppleService
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.installK3sServer
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
fun main() {
val host = "192.168.56.141"
val remoteUser = "usr"
val passwordK3sUser = PromptSecretSource("Enter Password").secret()
val prov = remote(host, remoteUser, passwordK3sUser)
// val prov = local()
prov.task {
installK3sServer()
// print pods for information purpose
println(cmd("sudo k3s kubectl get pods --all-namespaces").out)
applyK3sConfig(appleConfig())
// print pods for information purpose
println(cmd("sudo k3s kubectl get services").out)
checkAppleService("sudo k3s kubectl")
}
}

View file

@ -3,11 +3,7 @@ package org.domaindrivenarchitecture.provs.extensions.server_software.k3s
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult
import org.domaindrivenarchitecture.provs.core.echoCommandForText import org.domaindrivenarchitecture.provs.core.echoCommandForText
import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.apple.appleConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.k3s.apple.checkAppleService
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
/** /**
@ -39,30 +35,8 @@ fun Prov.uninstallK3sServer() = task {
} }
fun Prov.applyConfig(configAsYaml: String) = task { fun Prov.applyK3sConfig(configAsYaml: String) = task {
cmd(echoCommandForText(configAsYaml) + " | sudo k3s kubectl apply -f -") cmd(echoCommandForText(configAsYaml) + " | sudo k3s kubectl apply -f -")
} }
fun main() {
val host = "192.168.56.141"
val remoteUser = "usr"
val passwordK3sUser = PromptSecretSource("Enter Password").secret()
remote(host, remoteUser, passwordK3sUser).def {
// local().task {
installK3sServer()
// print pods for information purpose
println(cmd("sudo k3s kubectl get pods --all-namespaces").out)
applyConfig(appleConfig())
// print pods for information purpose
println(cmd("sudo k3s kubectl get services").out)
checkAppleService("sudo k3s kubectl")
}
}

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.k3s.apple package org.domaindrivenarchitecture.provs.extensions.server_software.k3s.infrastructure.apple
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.certbot package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.certbot
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.firewall package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.firewall
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.firewall.base package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.firewall.base
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.nexus package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.nexus
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult
@ -7,7 +7,7 @@ import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.user.base.createUser import org.domaindrivenarchitecture.provs.ubuntu.user.base.createUser
import org.domaindrivenarchitecture.provs.extensions.server_software.certbot.provisionCertbot import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.certbot.provisionCertbot
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.NginxConf import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxReverseProxyHttpConfig import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.nginxReverseProxyHttpConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.nexus.base package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.nexus.base
fun reverseProxyConfigHttpPort80(serverName: String): String { fun reverseProxyConfigHttpPort80(serverName: String): String {
// see https://help.sonatype.com/repomanager3/installation/run-behind-a-reverse-proxy // see https://help.sonatype.com/repomanager3/installation/run-behind-a-reverse-proxy

View file

@ -1,7 +1,7 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.prometheus package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base.* import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.*
/** /**
* Provisions prometheus monitoring. * Provisions prometheus monitoring.

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDir import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDir

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.docker.containerRuns import org.domaindrivenarchitecture.provs.core.docker.containerRuns

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base
val prometheusNginxConfig = """ val prometheusNginxConfig = """
proxy_pass http://localhost:9090/prometheus; proxy_pass http://localhost:9090/prometheus;

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.extensions.server_software.firewall package org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.firewall
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.docker.dockerProvideImage import org.domaindrivenarchitecture.provs.core.docker.dockerProvideImage

View file

@ -1,7 +1,7 @@
package nexus package nexus
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.extensions.server_software.nexus.provisionNexusWithDocker import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.nexus.provisionNexusWithDocker
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test