mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
fix: 延长进程状态获取等待时间 (#1986)
This commit is contained in:
parent
e67d9055aa
commit
da8a06909b
@ -161,6 +161,11 @@ func (u *ContainerService) CreateCompose(req dto.ComposeCreate) (string, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dockerLogDir := path.Join(global.CONF.System.TmpDir, "docker_logs")
|
dockerLogDir := path.Join(global.CONF.System.TmpDir, "docker_logs")
|
||||||
|
if _, err := os.Stat(dockerLogDir); err != nil && os.IsNotExist(err) {
|
||||||
|
if err = os.MkdirAll(dockerLogDir, os.ModePerm); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
logItem := fmt.Sprintf("%s/compose_create_%s_%s.log", dockerLogDir, req.Name, time.Now().Format("20060102150405"))
|
logItem := fmt.Sprintf("%s/compose_create_%s_%s.log", dockerLogDir, req.Name, time.Now().Format("20060102150405"))
|
||||||
file, err := os.OpenFile(logItem, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
file, err := os.OpenFile(logItem, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -379,7 +379,7 @@ func (h *HostToolService) OperateSupervisorProcess(req request.SupervisorProcess
|
|||||||
|
|
||||||
func (h *HostToolService) LoadProcessStatus() ([]response.ProcessStatus, error) {
|
func (h *HostToolService) LoadProcessStatus() ([]response.ProcessStatus, error) {
|
||||||
var datas []response.ProcessStatus
|
var datas []response.ProcessStatus
|
||||||
statuLines, err := cmd.Exec("supervisorct status")
|
statuLines, err := cmd.Exec("supervisorctl status")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return datas, fmt.Errorf("exec `supervisorctl status` failed, err: %v", statuLines)
|
return datas, fmt.Errorf("exec `supervisorctl status` failed, err: %v", statuLines)
|
||||||
}
|
}
|
||||||
@ -398,12 +398,12 @@ func (h *HostToolService) LoadProcessStatus() ([]response.ProcessStatus, error)
|
|||||||
for t := 0; t < 3; t++ {
|
for t := 0; t < 3; t++ {
|
||||||
status, err := cmd.ExecWithTimeOut(fmt.Sprintf("supervisorctl status %s", datas[index].Name), 2*time.Second)
|
status, err := cmd.ExecWithTimeOut(fmt.Sprintf("supervisorctl status %s", datas[index].Name), 2*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fields := strings.Fields(status)
|
fields := strings.Fields(status)
|
||||||
if len(fields) < 5 {
|
if len(fields) < 5 {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
datas[index].Name = fields[0]
|
datas[index].Name = fields[0]
|
||||||
|
@ -123,7 +123,6 @@ func (u *ImageService) ImageBuild(req dto.ImageBuild) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
fileName := "Dockerfile"
|
fileName := "Dockerfile"
|
||||||
dockerLogDir := path.Join(global.CONF.System.TmpDir, "docker_logs")
|
|
||||||
if req.From == "edit" {
|
if req.From == "edit" {
|
||||||
dir := fmt.Sprintf("%s/docker/build/%s", constant.DataDir, strings.ReplaceAll(req.Name, ":", "_"))
|
dir := fmt.Sprintf("%s/docker/build/%s", constant.DataDir, strings.ReplaceAll(req.Name, ":", "_"))
|
||||||
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
|
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
|
||||||
@ -158,6 +157,12 @@ func (u *ImageService) ImageBuild(req dto.ImageBuild) (string, error) {
|
|||||||
Labels: stringsToMap(req.Tags),
|
Labels: stringsToMap(req.Tags),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dockerLogDir := path.Join(global.CONF.System.TmpDir, "docker_logs")
|
||||||
|
if _, err := os.Stat(dockerLogDir); err != nil && os.IsNotExist(err) {
|
||||||
|
if err = os.MkdirAll(dockerLogDir, os.ModePerm); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
logItem := fmt.Sprintf("%s/image_build_%s_%s.log", dockerLogDir, strings.ReplaceAll(req.Name, ":", "_"), time.Now().Format("20060102150405"))
|
logItem := fmt.Sprintf("%s/image_build_%s_%s.log", dockerLogDir, strings.ReplaceAll(req.Name, ":", "_"), time.Now().Format("20060102150405"))
|
||||||
file, err := os.OpenFile(logItem, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
file, err := os.OpenFile(logItem, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex; flex-wrap: wrap">
|
<div style="display: flex; flex-wrap: wrap">
|
||||||
<el-select @change="searchLogs" v-model="logSearch.mode" style="width: 100px">
|
<el-select @change="searchLogs" v-model="logSearch.mode" style="width: 150px">
|
||||||
<template #prefix>{{ $t('container.fetch') }}</template>
|
<template #prefix>{{ $t('container.fetch') }}</template>
|
||||||
<el-option v-for="item in timeOptions" :key="item.label" :value="item.value" :label="item.label" />
|
<el-option v-for="item in timeOptions" :key="item.label" :value="item.value" :label="item.label" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -235,10 +235,10 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
|
|
||||||
const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => {
|
const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => {
|
||||||
if (url.startsWith('https://')) {
|
if (url.startsWith('https://')) {
|
||||||
return { protocol: 'https', host: url.replaceAll('https://', '') };
|
return { protocol: 'https://', host: url.replaceAll('https://', '') };
|
||||||
}
|
}
|
||||||
if (url.startsWith('http://')) {
|
if (url.startsWith('http://')) {
|
||||||
return { protocol: 'http', host: url.replaceAll('http://', '') };
|
return { protocol: 'http://', host: url.replaceAll('http://', '') };
|
||||||
}
|
}
|
||||||
return { protocol: '', host: url };
|
return { protocol: '', host: url };
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user