mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-24 23:04:40 +08:00
fix: mysql 端口修改时,重启相关容器
This commit is contained in:
parent
0ff7c418bd
commit
5c84277f12
1 changed files with 22 additions and 1 deletions
|
@ -273,7 +273,28 @@ func (a AppInstallService) ChangeAppPort(req request.PortUpdate) error {
|
||||||
if common.ScanPort(int(req.Port)) {
|
if common.ScanPort(int(req.Port)) {
|
||||||
return buserr.WithDetail(constant.ErrPortInUsed, req.Port, nil)
|
return buserr.WithDetail(constant.ErrPortInUsed, req.Port, nil)
|
||||||
}
|
}
|
||||||
return updateInstallInfoInDB(req.Key, "", "port", true, strconv.FormatInt(req.Port, 10))
|
|
||||||
|
appInstall, err := appInstallRepo.LoadBaseInfo(req.Key, req.Name)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := updateInstallInfoInDB(req.Key, "", "port", true, strconv.FormatInt(req.Port, 10)); err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
appRess, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithLinkId(appInstall.ID))
|
||||||
|
for _, appRes := range appRess {
|
||||||
|
appInstall, err := appInstallRepo.GetFirst(commonRepo.WithByID(appRes.AppInstallId))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, err := compose.Restart(fmt.Sprintf("%s/%s/%s/docker-compose.yml", constant.AppInstallDir, appInstall.App.Key, appInstall.Name)); err != nil {
|
||||||
|
global.LOG.Errorf("docker-compose restart %s[%s] failed, err: %v", appInstall.App.Key, appInstall.Name, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AppInstallService) DeleteCheck(installId uint) ([]dto.AppResource, error) {
|
func (a AppInstallService) DeleteCheck(installId uint) ([]dto.AppResource, error) {
|
||||||
|
|
Loading…
Reference in a new issue