diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionMonitoring.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionMonitoring.kt index 8c85888..522b110 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionMonitoring.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionMonitoring.kt @@ -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.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 +import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.configurePrometheusDocker +import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.runPrometheusDocker @Suppress("unused") // used externally diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionNginxAndMonitoring.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionNginxAndMonitoring.kt index 9320da8..208393f 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionNginxAndMonitoring.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_compounds/monitoring/ProvisionNginxAndMonitoring.kt @@ -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.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 +import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.prometheusNginxConfig +import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.provisionPrometheusDocker @Suppress("unused") // used externally diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt new file mode 100644 index 0000000..67c3c70 --- /dev/null +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt @@ -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") + } +} \ No newline at end of file diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/K3s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/domain/K3s.kt similarity index 59% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/K3s.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/domain/K3s.kt index 4a817ba..d67e88d 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/K3s.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/domain/K3s.kt @@ -3,11 +3,7 @@ package org.domaindrivenarchitecture.provs.extensions.server_software.k3s import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.ProvResult 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.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 -") } -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") - } -} \ No newline at end of file diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/apple/Apple.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/infrastructure/apple/Apple.kt similarity index 97% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/apple/Apple.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/infrastructure/apple/Apple.kt index ec869c8..e23154b 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/apple/Apple.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/infrastructure/apple/Apple.kt @@ -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.ProvResult diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/certbot/ProvisionCertbot.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/certbot/ProvisionCertbot.kt similarity index 97% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/certbot/ProvisionCertbot.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/certbot/ProvisionCertbot.kt index ad66362..e52023b 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/certbot/ProvisionCertbot.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/certbot/ProvisionCertbot.kt @@ -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.ProvResult diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewall.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewall.kt similarity index 99% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewall.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewall.kt index 1cc8ed2..89e630f 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewall.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewall.kt @@ -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.ProvResult diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/base/FirewallBackup.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/base/FirewallBackup.kt similarity index 95% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/base/FirewallBackup.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/base/FirewallBackup.kt index f4b6068..032bff3 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/base/FirewallBackup.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/base/FirewallBackup.kt @@ -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.ProvResult diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexus.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexus.kt similarity index 97% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexus.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexus.kt index 1a4193b..63c3fa4 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexus.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexus.kt @@ -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.ProvResult @@ -7,7 +7,7 @@ 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.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.nginxReverseProxyHttpConfig import org.domaindrivenarchitecture.provs.extensions.server_software.nginx.provisionNginxStandAlone diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/base/NginxConf.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/base/NginxConf.kt similarity index 98% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/base/NginxConf.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/base/NginxConf.kt index 25e3b58..3193321 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/base/NginxConf.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/base/NginxConf.kt @@ -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 { // see https://help.sonatype.com/repomanager3/installation/run-behind-a-reverse-proxy diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/ProvisionPrometheus.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/ProvisionPrometheus.kt similarity index 90% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/ProvisionPrometheus.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/ProvisionPrometheus.kt index d138fb0..4d61c0f 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/ProvisionPrometheus.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/ProvisionPrometheus.kt @@ -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.extensions.server_software.prometheus.base.* +import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.prometheus.base.* /** * Provisions prometheus monitoring. diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/NodeExporter.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/NodeExporter.kt similarity index 98% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/NodeExporter.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/NodeExporter.kt index be205d4..2aedfa7 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/NodeExporter.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/NodeExporter.kt @@ -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.ubuntu.filesystem.base.createDir diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/Prometheus.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/Prometheus.kt similarity index 98% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/Prometheus.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/Prometheus.kt index 5b3fea4..a795998 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/Prometheus.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/Prometheus.kt @@ -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.docker.containerRuns diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/PrometheusNginxConfig.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/PrometheusNginxConfig.kt similarity index 80% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/PrometheusNginxConfig.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/PrometheusNginxConfig.kt index 39fdb22..41962e6 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/prometheus/base/PrometheusNginxConfig.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/prometheus/base/PrometheusNginxConfig.kt @@ -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 = """ proxy_pass http://localhost:9090/prometheus; diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewallKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt similarity index 98% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewallKtTest.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt index cab3b19..ce025c4 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/firewall/ProvisionFirewallKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt @@ -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.docker.dockerProvideImage diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexusKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexusKtTest.kt similarity index 92% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexusKtTest.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexusKtTest.kt index 797f472..fe8f95b 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/nexus/ProvisionNexusKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nexus/ProvisionNexusKtTest.kt @@ -1,7 +1,7 @@ package nexus 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.Disabled import org.junit.jupiter.api.Test