refactor package extensions

This commit is contained in:
az 2021-08-07 18:58:52 +02:00
parent 3810fe6723
commit 27a803a591
42 changed files with 92 additions and 98 deletions

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.demos
package org.domaindrivenarchitecture.provs.extensions.demos
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.local

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.demos
package org.domaindrivenarchitecture.provs.extensions.demos
import org.domaindrivenarchitecture.provs.core.*

View file

@ -0,0 +1,18 @@
package org.domaindrivenarchitecture.provs.extensions.server_compounds.monitoring
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.nginxHttpConf
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.prometheus.base.runPrometheusDocker
@Suppress("unused") // used externally
fun Prov.provisionMonitoring() = requireAll {
configurePrometheusDocker()
runPrometheusDocker()
provisionNginxStandAlone(NginxConf.nginxHttpConf())
}

View file

@ -0,0 +1,20 @@
package org.domaindrivenarchitecture.provs.extensions.server_compounds.monitoring
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.nginxAddLocation
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.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.base.prometheusNginxConfig
import org.domaindrivenarchitecture.provs.extensions.server_software.prometheus.provisionPrometheusDocker
@Suppress("unused") // used externally
fun Prov.provisionNginxMonitoring(nginxHost: String = "localhost") = def {
provisionPrometheusDocker(nginxHost)
nginxCreateSelfSignedCertificate()
provisionNginxStandAlone(NginxConf.nginxHttpsConfWithLocationFiles())
nginxAddLocation("443", nginxHost, "/prometheus", prometheusNginxConfig)
}

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nexus
package org.domaindrivenarchitecture.provs.extensions.server_software.nexus
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult
@ -7,10 +7,10 @@ import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.user.base.createUser
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.certbot.provisionCertbot
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.nginxReverseProxyHttpConfig
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.certbot.provisionCertbot
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.provisionNginxStandAlone
/**

View file

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

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult
@ -6,8 +6,8 @@ import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createFile
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.createNginxLocationFolders
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.createNginxLocationFolders
import kotlin.system.exitProcess

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.Secret

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base
class NginxConf(val conf: String = NGINX_MINIMAL_CONF) {
companion object {}

View file

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

View file

@ -1,8 +1,8 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone
internal val certificateName = "selfsigned"

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace
package org.domaindrivenarchitecture.provs.extensions.workplace
import org.domaindrivenarchitecture.provs.core.*
import org.domaindrivenarchitecture.provs.core.processors.RemoteProcessor
import org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base.*
import org.domaindrivenarchitecture.provs.extensions.workplace.base.*
import org.domaindrivenarchitecture.provs.ubuntu.git.provisionGit
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstallFromPpa

View file

@ -1,10 +1,6 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace
package org.domaindrivenarchitecture.provs.extensions.workplace
import org.domaindrivenarchitecture.provs.ubuntu.keys.KeyPairSource
import org.domaindrivenarchitecture.provs.ubuntu.secret.SecretSource
import org.domaindrivenarchitecture.provs.ubuntu.secret.SecretSourceType
import org.domaindrivenarchitecture.provs.ubuntu.secret.SecretSupplier
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PlainSecretSource
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import java.io.*

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall

View file

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

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.addTextToFile

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
val OS_ANALYSIS = "lsof strace ncdu iptraf htop iotop iftop"

View file

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

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult

View file

@ -1,18 +0,0 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_compounds.monitoring
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.nginxHttpConf
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.prometheus.base.configurePrometheusDocker
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.prometheus.base.runPrometheusDocker
@Suppress("unused") // used externally
fun Prov.provisionMonitoring() = requireAll {
configurePrometheusDocker()
runPrometheusDocker()
provisionNginxStandAlone(NginxConf.nginxHttpConf())
}

View file

@ -1,20 +0,0 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_compounds.monitoring
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.NginxConf
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.nginxAddLocation
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.nginxCreateSelfSignedCertificate
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.nginxHttpsConfWithLocationFiles
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.prometheus.base.prometheusNginxConfig
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.prometheus.provisionPrometheusDocker
@Suppress("unused") // used externally
fun Prov.provisionNginxMonitoring(nginxHost: String = "localhost") = def {
provisionPrometheusDocker(nginxHost)
nginxCreateSelfSignedCertificate()
provisionNginxStandAlone(NginxConf.nginxHttpsConfWithLocationFiles())
nginxAddLocation("443", nginxHost, "/prometheus", prometheusNginxConfig)
}

View file

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

View file

@ -1,11 +1,10 @@
package nexus
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nexus.provisionNexusWithDocker
import org.domaindrivenarchitecture.provs.extensions.server_software.nexus.provisionNexusWithDocker
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
internal class ProvisionNexusKtTest {

View file

@ -1,10 +1,10 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.NonCi
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.replaceTextInFile
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base.*
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base.*
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

View file

@ -1,9 +1,9 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.base
package org.domaindrivenarchitecture.provs.extensions.server_software.nginx.base
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createFile
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContainsText
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.configFile
import org.domaindrivenarchitecture.provs.ubuntu.extensions.server_software.nginx.provisionNginxStandAlone
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.configFile
import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.test_keys
package org.domaindrivenarchitecture.provs.extensions.test_keys
fun publicGPGSnakeoilKey(): String {

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace
package org.domaindrivenarchitecture.provs.extensions.workplace
import org.domaindrivenarchitecture.provs.core.Password
import org.junit.jupiter.api.Assertions.assertTrue

View file

@ -1,7 +1,6 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult
@ -15,8 +15,8 @@ import org.domaindrivenarchitecture.provs.ubuntu.keys.base.configureGpgKeys
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.ubuntu.extensions.test_keys.privateGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.ubuntu.extensions.test_keys.publicGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.extensions.test_keys.privateGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.extensions.test_keys.publicGPGSnakeoilKey
internal class GopassBridgeKtTest {

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.remote
@ -13,8 +13,8 @@ import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecr
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.ubuntu.extensions.test_keys.privateGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.ubuntu.extensions.test_keys.publicGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.extensions.test_keys.privateGPGSnakeoilKey
import org.domaindrivenarchitecture.provs.extensions.test_keys.publicGPGSnakeoilKey
internal class GopassKtTest {

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.ubuntu.extensions.workplace.base
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.junit.jupiter.api.Assertions.assertTrue