diff --git a/backend/app/service/backup_website.go b/backend/app/service/backup_website.go
index 9eaab1c62..e7e7c3da1 100644
--- a/backend/app/service/backup_website.go
+++ b/backend/app/service/backup_website.go
@@ -154,7 +154,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback
if err != nil {
return err
}
- if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava {
+ if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava || runtime.Type == constant.RuntimeGo {
if err := handleRuntimeRecover(runtime, fmt.Sprintf("%s/%s.runtime.tar.gz", tmpPath, website.Alias), true, ""); err != nil {
return err
}
@@ -225,7 +225,7 @@ func handleWebsiteBackup(website *model.Website, backupDir, fileName string, exc
if err != nil {
return err
}
- if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava {
+ if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava || runtime.Type == constant.RuntimeGo {
if err := handleRuntimeBackup(runtime, tmpDir, fmt.Sprintf("%s.runtime.tar.gz", website.Alias), excludes, ""); err != nil {
return err
}
diff --git a/backend/app/service/runtime.go b/backend/app/service/runtime.go
index a88712182..acef2dca5 100644
--- a/backend/app/service/runtime.go
+++ b/backend/app/service/runtime.go
@@ -83,7 +83,7 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (*model.Runtime, e
if exist != nil {
return nil, buserr.New(constant.ErrImageExist)
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
if !fileOp.Stat(create.CodeDir) {
return nil, buserr.New(constant.ErrPathNotFound)
}
@@ -133,7 +133,7 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (*model.Runtime, e
if err = handlePHP(create, runtime, fileOp, appVersionDir); err != nil {
return nil, err
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
runtime.Port = create.Port
if err = handleNodeAndJava(create, runtime, fileOp, appVersionDir); err != nil {
return nil, err
@@ -217,7 +217,7 @@ func (r *RuntimeService) Delete(runtimeDelete request.RuntimeDelete) error {
global.LOG.Errorf("delete image id [%s] error %v", imageID, err)
}
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
if out, err := compose.Down(runtime.GetComposePath()); err != nil && !runtimeDelete.ForceDelete {
if out != "" {
return errors.New(out)
@@ -300,7 +300,7 @@ func (r *RuntimeService) Get(id uint) (*response.RuntimeDTO, error) {
}
}
res.AppParams = appParams
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
res.Params = make(map[string]interface{})
envs, err := gotenv.Unmarshal(runtime.Env)
if err != nil {
@@ -361,7 +361,7 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
if exist != nil {
return buserr.New(constant.ErrImageExist)
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
if runtime.Port != req.Port {
if err = checkPortExist(req.Port); err != nil {
return err
@@ -441,7 +441,7 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
return err
}
go buildRuntime(runtime, imageID, req.Rebuild)
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
runtime.Version = req.Version
runtime.CodeDir = req.CodeDir
runtime.Port = req.Port
@@ -610,7 +610,7 @@ func (r *RuntimeService) SyncRuntimeStatus() error {
return err
}
for _, runtime := range runtimes {
- if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava {
+ if runtime.Type == constant.RuntimeNode || runtime.Type == constant.RuntimeJava || runtime.Type == constant.RuntimeGo {
_ = SyncRuntimeContainerStatus(&runtime)
}
}
diff --git a/backend/app/service/runtime_utils.go b/backend/app/service/runtime_utils.go
index 9e8e7669c..acebcf24d 100644
--- a/backend/app/service/runtime_utils.go
+++ b/backend/app/service/runtime_utils.go
@@ -330,6 +330,14 @@ func handleParams(create request.RuntimeCreate, projectDir string) (composeConte
if err != nil {
return
}
+ case constant.RuntimeGo:
+ create.Params["CODE_DIR"] = create.CodeDir
+ create.Params["GO_VERSION"] = create.Version
+ create.Params["PANEL_APP_PORT_HTTP"] = create.Port
+ composeContent, err = handleCompose(env, composeContent, create, projectDir)
+ if err != nil {
+ return
+ }
}
newMap := make(map[string]string)
@@ -374,6 +382,9 @@ func handleCompose(env gotenv.Env, composeContent []byte, create request.Runtime
ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}")
case constant.RuntimeJava:
ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${JAVA_APP_PORT}")
+ case constant.RuntimeGo:
+ ports = append(ports, "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${GO_APP_PORT}")
+
}
for i, port := range create.ExposedPorts {
diff --git a/backend/app/service/website.go b/backend/app/service/website.go
index 4f35c61b0..e0d40115e 100644
--- a/backend/app/service/website.go
+++ b/backend/app/service/website.go
@@ -336,7 +336,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
}
website.Proxy = proxy
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
website.Proxy = fmt.Sprintf("127.0.0.1:%d", runtime.Port)
}
}
diff --git a/backend/app/service/website_utils.go b/backend/app/service/website_utils.go
index 17a3441ad..bad21c998 100644
--- a/backend/app/service/website_utils.go
+++ b/backend/app/service/website_utils.go
@@ -276,7 +276,7 @@ func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, a
server.UpdateRoot(rootIndex)
server.UpdatePHPProxy([]string{website.Proxy}, "")
}
- case constant.RuntimeNode, constant.RuntimeJava:
+ case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo:
proxy := fmt.Sprintf("http://127.0.0.1:%d", runtime.Port)
server.UpdateRootProxy([]string{proxy})
}
diff --git a/backend/constant/runtime.go b/backend/constant/runtime.go
index 51a2e8a22..55a524983 100644
--- a/backend/constant/runtime.go
+++ b/backend/constant/runtime.go
@@ -17,6 +17,7 @@ const (
RuntimePHP = "php"
RuntimeNode = "node"
RuntimeJava = "java"
+ RuntimeGo = "go"
RuntimeProxyUnix = "unix"
RuntimeProxyTcp = "tcp"
diff --git a/frontend/src/routers/modules/website.ts b/frontend/src/routers/modules/website.ts
index 26dddc9ca..39b24aa4a 100644
--- a/frontend/src/routers/modules/website.ts
+++ b/frontend/src/routers/modules/website.ts
@@ -68,6 +68,16 @@ const webSiteRouter = {
requiresAuth: false,
},
},
+ {
+ path: '/websites/runtimes/go',
+ name: 'go',
+ hidden: true,
+ component: () => import('@/views/website/runtime/go/index.vue'),
+ meta: {
+ activeMenu: '/websites/runtimes/go',
+ requiresAuth: false,
+ },
+ },
],
};
diff --git a/frontend/src/views/website/runtime/go/index.vue b/frontend/src/views/website/runtime/go/index.vue
new file mode 100644
index 000000000..1c618f19c
--- /dev/null
+++ b/frontend/src/views/website/runtime/go/index.vue
@@ -0,0 +1,296 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('runtime.create') }}
+
+
+
+ {{ $t('container.cleanBuildCache') }}
+
+
+
+
+
+
+
+ {{ row.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.port }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('website.check') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/website/runtime/go/operate/index.vue b/frontend/src/views/website/runtime/go/operate/index.vue
new file mode 100644
index 000000000..2c1bdc96f
--- /dev/null
+++ b/frontend/src/views/website/runtime/go/operate/index.vue
@@ -0,0 +1,395 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('runtime.customScriptHelper') }}
+
+
+
+
+
+
+
+
+ {{ $t('runtime.appPortHelper') }}
+
+
+
+
+
+ {{ $t('runtime.externalPortHelper') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('commons.button.delete') }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('commons.button.cancel') }}
+
+ {{ $t('commons.button.confirm') }}
+
+
+
+
+
+
+
diff --git a/frontend/src/views/website/runtime/index.vue b/frontend/src/views/website/runtime/index.vue
index fe59a8094..7e403aa33 100644
--- a/frontend/src/views/website/runtime/index.vue
+++ b/frontend/src/views/website/runtime/index.vue
@@ -21,5 +21,9 @@ const buttons = [
label: 'Node.js',
path: '/websites/runtimes/node',
},
+ {
+ label: 'Go',
+ path: '/websites/runtimes/go',
+ },
];
diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue
index d89b55e20..96121c98c 100644
--- a/frontend/src/views/website/website/create/index.vue
+++ b/frontend/src/views/website/website/create/index.vue
@@ -164,6 +164,7 @@
+
diff --git a/frontend/src/views/website/website/html/index.vue b/frontend/src/views/website/website/html/index.vue
index 51fabd630..115afb732 100644
--- a/frontend/src/views/website/website/html/index.vue
+++ b/frontend/src/views/website/website/html/index.vue
@@ -1,7 +1,7 @@
-
+