136 lines
3.7 KiB
Go
136 lines
3.7 KiB
Go
package deploy
|
|
|
|
import (
|
|
"os"
|
|
image2 "wdd.io/agent-common/image"
|
|
"wdd.io/agent-common/logger"
|
|
"wdd.io/agent-operator/deploy/c_app"
|
|
"wdd.io/agent-operator/deploy/z_dep"
|
|
)
|
|
|
|
var log = logger.Log
|
|
|
|
func OctopusDeploy() {
|
|
|
|
// common environment
|
|
common := &z_dep.CommonEnvironmentConfig{
|
|
WebIP: "10.100.2.121",
|
|
WebPort: "8888",
|
|
HarborIP: "10.100.2.121",
|
|
HarborPort: "8033",
|
|
Namespace: "zjjt",
|
|
TagVersion: "5.5.0",
|
|
TenantEnv: "",
|
|
MinioPublicIP: "10.100.2.116",
|
|
MinioInnerIP: "10.100.2.116",
|
|
NFSServerIP: "10.100.2.121",
|
|
}
|
|
|
|
//a_dashboard.K8sDashboardDeploy(common)
|
|
//
|
|
//a_nfs.NFSDeploy(common)
|
|
//a_nfs.NFSTestDeploy(common)
|
|
//
|
|
//// pvc
|
|
//b_middle.PVCDeploy(common)
|
|
//
|
|
//// middlewares
|
|
//b_middle.MidMySQlDeploy(common)
|
|
//b_middle.MidRedisDeploy(common)
|
|
//b_middle.MidEmqxDeploy(common)
|
|
//b_middle.MidMongoDeploy(common)
|
|
//b_middle.MidRabbitMQDeploy(common)
|
|
//b_middle.MidRabbitMQDeploy(common)
|
|
//b_middle.MidNacosDeploy(common)
|
|
//
|
|
//configMapDeploy(common)
|
|
//c_app.IngressDeploy(common)
|
|
//
|
|
//frontendImageVersionMap, backendImageVersionMap := image.FrontendBackendSrsImageMapFromCmiiImageMap(zjjt.CmiiImageMap)
|
|
//
|
|
//backendDeploy(common, backendImageVersionMap)
|
|
//frontendDeploy(common, frontendImageVersionMap)
|
|
c_app.SRSDeploy(common)
|
|
}
|
|
|
|
func CmiiAppDeploy() {
|
|
|
|
// common environment
|
|
common := &z_dep.CommonEnvironmentConfig{
|
|
WebIP: "36.133.201.78",
|
|
WebPort: "8888",
|
|
HarborIP: "192.168.0.14",
|
|
HarborPort: "8033",
|
|
Namespace: "xjyd",
|
|
TagVersion: "5.5.0",
|
|
TenantEnv: "",
|
|
MinioPublicIP: "36.133.201.146",
|
|
MinioInnerIP: "192.168.0.21",
|
|
NFSServerIP: "192.168.0.14",
|
|
}
|
|
|
|
//frontendImageVersionMap, backendImageVersionMap, _ := image.FrontendBackendSrsImageMapFromCmiiImageMap(zjjt.CmiiImageMap)
|
|
gzipFilePrefix := "/root/octopus_image/xjyd/"
|
|
frontendImageVersionMap, backendImageVersionMap, _ := image2.GzipFolderPathToCmiiImageTagMaps(gzipFilePrefix)
|
|
|
|
backendDeploy(common, backendImageVersionMap)
|
|
frontendDeploy(common, frontendImageVersionMap)
|
|
|
|
configMapDeploy(common)
|
|
//c_app.IngressDeploy(common)
|
|
|
|
}
|
|
|
|
func backendDeploy(common *z_dep.CommonEnvironmentConfig, backendImageVersionMap map[string]string) {
|
|
|
|
os.Remove(c_app.BackendApplyFilePath)
|
|
|
|
for appName, tag := range backendImageVersionMap {
|
|
c_app.DefaultCmiiBackendConfig.AppName = appName
|
|
c_app.DefaultCmiiBackendConfig.ImageTag = tag
|
|
c_app.DefaultCmiiBackendConfig.Replicas = "1"
|
|
c_app.DefaultCmiiBackendConfig.BackendDeploy(common)
|
|
}
|
|
}
|
|
|
|
func frontendDeploy(common *z_dep.CommonEnvironmentConfig, frontendImageVersionMap map[string]string) {
|
|
os.Remove(c_app.FrontendApplyFilePath)
|
|
|
|
c_app.FrontendDefaultNginxDeploy(common)
|
|
|
|
for appName, tag := range frontendImageVersionMap {
|
|
c_app.DefaultCmiiFrontendConfig.AppName = appName
|
|
c_app.DefaultCmiiFrontendConfig.ImageTag = tag
|
|
c_app.DefaultCmiiFrontendConfig.Replicas = "1"
|
|
|
|
value, ok := c_app.FrontendShortNameMaps[appName]
|
|
if !ok {
|
|
log.ErrorF("FrontendShortNameMaps error ! not contains %s", appName)
|
|
continue
|
|
}
|
|
|
|
c_app.DefaultCmiiFrontendConfig.ShortName = value
|
|
|
|
c_app.DefaultCmiiFrontendConfig.FrontendDeploy(common)
|
|
}
|
|
}
|
|
|
|
func configMapDeploy(common *z_dep.CommonEnvironmentConfig) {
|
|
os.Remove(c_app.ConfigMapApplyFilePath)
|
|
|
|
for frontendName, shortName := range c_app.FrontendShortNameMaps {
|
|
c_app.DefaultCmiiFrontendConfig.AppName = frontendName
|
|
c_app.DefaultCmiiFrontendConfig.ShortName = shortName
|
|
|
|
value, ok := c_app.FrontendClientIdMaps[frontendName]
|
|
if !ok {
|
|
log.ErrorF("FrontendClientIdMaps error ! not contains %s", frontendName)
|
|
continue
|
|
}
|
|
|
|
c_app.DefaultCmiiFrontendConfig.ClientId = value
|
|
|
|
c_app.DefaultCmiiFrontendConfig.ConfigMapDeploy(common)
|
|
}
|
|
}
|