mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-11 00:54:55 +08:00
fix: fix some bugs with app-cluster (#9581)
This commit is contained in:
parent
da0f6acd01
commit
80c00c5a8c
11 changed files with 37 additions and 19 deletions
|
@ -919,6 +919,8 @@ func (a *AppInstallService) GetAppInstallInfo(installID uint) (*response.AppInst
|
|||
Status: constant.StatusDeleted,
|
||||
}, nil
|
||||
}
|
||||
_ = syncAppInstallStatus(&appInstall, false)
|
||||
appInstall, _ = appInstallRepo.GetFirst(repo.WithByID(installID))
|
||||
var envMap map[string]interface{}
|
||||
err := json.Unmarshal([]byte(appInstall.Env), &envMap)
|
||||
if err != nil {
|
||||
|
|
|
@ -1028,9 +1028,15 @@ func (u *ContainerService) DownloadContainerLogs(containerType, container, since
|
|||
return buserr.New("ErrCmdIllegal")
|
||||
}
|
||||
commandArg := []string{"logs", container}
|
||||
dockerCommand := global.CONF.DockerConfig.Command
|
||||
if containerType == "compose" {
|
||||
commandArg = []string{"compose", "-f", container, "logs"}
|
||||
if dockerCommand == "docker-compose" {
|
||||
commandArg = []string{"-f", container, "logs"}
|
||||
} else {
|
||||
commandArg = []string{"compose", "-f", container, "logs"}
|
||||
}
|
||||
}
|
||||
|
||||
if tail != "0" {
|
||||
commandArg = append(commandArg, "--tail")
|
||||
commandArg = append(commandArg, tail)
|
||||
|
@ -1039,16 +1045,20 @@ func (u *ContainerService) DownloadContainerLogs(containerType, container, since
|
|||
commandArg = append(commandArg, "--since")
|
||||
commandArg = append(commandArg, since)
|
||||
}
|
||||
|
||||
cmd := exec.Command("docker", commandArg...)
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
var dockerCmd *exec.Cmd
|
||||
if containerType == "compose" && dockerCommand == "docker-compose" {
|
||||
dockerCmd = exec.Command("docker-compose", commandArg...)
|
||||
} else {
|
||||
dockerCmd = exec.Command("docker", commandArg...)
|
||||
}
|
||||
stdout, err := dockerCmd.StdoutPipe()
|
||||
if err != nil {
|
||||
_ = cmd.Process.Signal(syscall.SIGTERM)
|
||||
_ = dockerCmd.Process.Signal(syscall.SIGTERM)
|
||||
return err
|
||||
}
|
||||
cmd.Stderr = cmd.Stdout
|
||||
if err := cmd.Start(); err != nil {
|
||||
_ = cmd.Process.Signal(syscall.SIGTERM)
|
||||
dockerCmd.Stderr = dockerCmd.Stdout
|
||||
if err := dockerCmd.Start(); err != nil {
|
||||
_ = dockerCmd.Process.Signal(syscall.SIGTERM)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ require (
|
|||
github.com/upyun/go-sdk v2.1.0+incompatible
|
||||
golang.org/x/crypto v0.39.0
|
||||
golang.org/x/net v0.41.0
|
||||
golang.org/x/oauth2 v0.29.0
|
||||
golang.org/x/oauth2 v0.30.0
|
||||
golang.org/x/sys v0.33.0
|
||||
golang.org/x/text v0.26.0
|
||||
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38
|
||||
|
|
|
@ -1092,6 +1092,8 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ
|
|||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98=
|
||||
golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
||||
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
|
@ -63,11 +63,11 @@ func (c Client) Close() {
|
|||
_ = c.cli.Close()
|
||||
}
|
||||
|
||||
func (c Client) ListContainersByName(names []string) ([]types.Container, error) {
|
||||
func (c Client) ListContainersByName(names []string) ([]container.Summary, error) {
|
||||
var (
|
||||
options container.ListOptions
|
||||
namesMap = make(map[string]bool)
|
||||
res []types.Container
|
||||
res []container.Summary
|
||||
)
|
||||
options.All = true
|
||||
if len(names) > 0 {
|
||||
|
@ -89,7 +89,7 @@ func (c Client) ListContainersByName(names []string) ([]types.Container, error)
|
|||
}
|
||||
return res, nil
|
||||
}
|
||||
func (c Client) ListAllContainers() ([]types.Container, error) {
|
||||
func (c Client) ListAllContainers() ([]container.Summary, error) {
|
||||
var (
|
||||
options container.ListOptions
|
||||
)
|
||||
|
|
|
@ -42,7 +42,7 @@ require (
|
|||
github.com/xlzd/gotp v0.1.0
|
||||
golang.org/x/crypto v0.39.0
|
||||
golang.org/x/net v0.41.0
|
||||
golang.org/x/oauth2 v0.18.0
|
||||
golang.org/x/oauth2 v0.30.0
|
||||
golang.org/x/sys v0.33.0
|
||||
golang.org/x/term v0.32.0
|
||||
golang.org/x/text v0.26.0
|
||||
|
|
|
@ -589,6 +589,8 @@ golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4Iltr
|
|||
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
|
||||
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
|
||||
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
||||
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
|
@ -36,8 +36,9 @@ export const commitContainer = (params: Container.ContainerCommit) => {
|
|||
export const loadContainerInfo = (name: string) => {
|
||||
return http.post<Container.ContainerHelper>(`/containers/info`, { name: name });
|
||||
};
|
||||
export const cleanContainerLog = (containerName: string) => {
|
||||
return http.post(`/containers/clean/log`, { name: containerName });
|
||||
export const cleanContainerLog = (containerName: string, operateNode?: string) => {
|
||||
const params = operateNode ? `?operateNode=${operateNode}` : '';
|
||||
return http.post(`/containers/clean/log${params}`, { name: containerName });
|
||||
};
|
||||
export const containerListStats = () => {
|
||||
return http.get<Array<Container.ContainerListStats>>(`/containers/list/stats`);
|
||||
|
|
|
@ -203,7 +203,11 @@ const onClean = async () => {
|
|||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||
type: 'info',
|
||||
}).then(async () => {
|
||||
await cleanContainerLog(logSearch.container);
|
||||
let currentNode = globalStore.currentNode;
|
||||
if (props.node && props.node !== '') {
|
||||
currentNode = props.node;
|
||||
}
|
||||
await cleanContainerLog(logSearch.container, currentNode);
|
||||
searchLogs();
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
});
|
||||
|
|
|
@ -318,10 +318,8 @@ const initTerminal = async () => {
|
|||
isRefresh.value = !isRefresh.value;
|
||||
return;
|
||||
}
|
||||
console.log(currentDBName.value);
|
||||
await checkAppInstalled(currentDB.value.type, currentDBName.value)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
redisIsExist.value = res.data.isExist;
|
||||
redisStatus.value = res.data.status;
|
||||
loading.value = false;
|
||||
|
|
|
@ -180,7 +180,6 @@ const acceptParams = (prop: DialogProps): void => {
|
|||
};
|
||||
|
||||
const loadStatus = async () => {
|
||||
console.log('loadStatus', database.value);
|
||||
const res = await loadRedisStatus(dbType.value, database.value);
|
||||
let hit = (
|
||||
(Number(res.data.keyspace_hits) / (Number(res.data.keyspace_hits) + Number(res.data.keyspace_misses))) *
|
||||
|
|
Loading…
Add table
Reference in a new issue