mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-09 20:05:54 +08:00
fix: fix issue with install runtime (#8630)
This commit is contained in:
parent
7fc829d3a6
commit
0941b0aad3
2 changed files with 27 additions and 0 deletions
|
|
@ -375,6 +375,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
go RestartPHPRuntime()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for key := range req.Params {
|
for key := range req.Params {
|
||||||
|
|
|
||||||
|
|
@ -422,6 +422,9 @@ func handleParams(create request.RuntimeCreate, projectDir string) (composeConte
|
||||||
}
|
}
|
||||||
create.Params["CONTAINER_PACKAGE_URL"] = create.Source
|
create.Params["CONTAINER_PACKAGE_URL"] = create.Source
|
||||||
siteDir, _ := settingRepo.Get(settingRepo.WithByKey("WEBSITE_DIR"))
|
siteDir, _ := settingRepo.Get(settingRepo.WithByKey("WEBSITE_DIR"))
|
||||||
|
if siteDir.Value == "" {
|
||||||
|
siteDir.Value = path.Join(global.Dir.BaseDir, "1panel", "www")
|
||||||
|
}
|
||||||
create.Params["PANEL_WEBSITE_DIR"] = siteDir.Value
|
create.Params["PANEL_WEBSITE_DIR"] = siteDir.Value
|
||||||
composeContent, err = handleEnvironments(composeContent, create, projectDir)
|
composeContent, err = handleEnvironments(composeContent, create, projectDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -841,3 +844,26 @@ func getExtensionDir(version string) string {
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RestartPHPRuntime() {
|
||||||
|
runtimes, err := runtimeRepo.List(repo.WithByType(constant.RuntimePHP))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
websiteDir, _ := settingRepo.GetValueByKey("WEBSITE_DIR")
|
||||||
|
for _, runtime := range runtimes {
|
||||||
|
envs, err := gotenv.Unmarshal(runtime.Env)
|
||||||
|
if err != nil {
|
||||||
|
global.LOG.Warningf("restart php runtime failed %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
envs["PANEL_WEBSITE_DIR"] = websiteDir
|
||||||
|
if err = gotenv.Write(envs, runtime.GetEnvPath()); err != nil {
|
||||||
|
global.LOG.Warningf("restart php runtime failed %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
_ = restartRuntime(&runtime)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue