fix: 解决 nexus 安装失败的问题 (#461)

pull/465/head
zhengkunwang223 2 years ago committed by GitHub
parent 4ad3b82c84
commit 3457b99df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -257,6 +257,9 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) (
if err := createLink(ctx, app, &appInstall, req.Params); err != nil {
return nil, err
}
if err := upAppPre(app, appInstall); err != nil {
return nil, err
}
go upApp(appInstall.GetComposePath(), appInstall)
go updateToolApp(appInstall)
return &appInstall, nil

@ -339,6 +339,17 @@ func copyAppData(key, version, installName string, params map[string]interface{}
return
}
// 处理文件夹权限等问题
func upAppPre(app model.App, appInstall model.AppInstall) error {
if app.Key == "nexus" {
dataPath := path.Join(appInstall.GetPath(), "data")
if err := files.NewFileOp().Chown(dataPath, 200, 0); err != nil {
return err
}
}
return nil
}
func upApp(composeFilePath string, appInstall model.AppInstall) {
out, err := compose.Up(composeFilePath)
if err != nil {

@ -106,6 +106,10 @@ func (f FileOp) Chmod(dst string, mode fs.FileMode) error {
return f.Fs.Chmod(dst, mode)
}
func (f FileOp) Chown(dst string, uid int, gid int) error {
return f.Fs.Chown(dst, uid, gid)
}
func (f FileOp) Rename(oldName string, newName string) error {
return f.Fs.Rename(oldName, newName)
}

Loading…
Cancel
Save