1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: Installed Openresty and added automatic directory creation. (#7768)

This commit is contained in:
zhengkunwang 2025-01-24 15:59:13 +08:00 committed by GitHub
parent 8283cd7d02
commit 77f8db7d38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 79 additions and 61 deletions

View File

@ -351,7 +351,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
return return
} }
} }
if app.Key == "openresty" && app.Resource == "remote" && common.CompareVersion(appDetail.Version, "1.21.4.3-3-3") { if app.Key == "openresty" && app.Resource == "remote" && common.CompareVersion(appDetail.Version, "1.27") {
if dir, ok := req.Params["WEBSITE_DIR"]; ok { if dir, ok := req.Params["WEBSITE_DIR"]; ok {
siteDir := dir.(string) siteDir := dir.(string)
if siteDir == "" || !strings.HasPrefix(siteDir, "/") { if siteDir == "" || !strings.HasPrefix(siteDir, "/") {
@ -365,6 +365,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
} }
if !fileOp.Stat(siteDir) { if !fileOp.Stat(siteDir) {
_ = fileOp.CreateDir(siteDir, constant.DirPerm) _ = fileOp.CreateDir(siteDir, constant.DirPerm)
_ = fileOp.CreateDir(path.Join(siteDir, "conf.d"), constant.DirPerm)
} }
err = settingRepo.UpdateOrCreate("WEBSITE_DIR", siteDir) err = settingRepo.UpdateOrCreate("WEBSITE_DIR", siteDir)
if err != nil { if err != nil {
@ -377,16 +378,16 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
continue continue
} }
var port int var port int
if port, err = checkPort(key, req.Params); err == nil { port, err = checkPort(key, req.Params)
if key == "PANEL_APP_PORT_HTTP" { if err != nil {
httpPort = port
}
if key == "PANEL_APP_PORT_HTTPS" {
httpsPort = port
}
} else {
return return
} }
if key == "PANEL_APP_PORT_HTTP" {
httpPort = port
}
if key == "PANEL_APP_PORT_HTTPS" {
httpsPort = port
}
} }
if err = checkRequiredAndLimit(app); err != nil { if err = checkRequiredAndLimit(app); err != nil {
@ -919,11 +920,11 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
appTags []*model.AppTag appTags []*model.AppTag
oldAppIds []uint oldAppIds []uint
) )
for _, t := range list.Extra.Tags { for _, tag := range list.Extra.Tags {
tags = append(tags, &model.Tag{ tags = append(tags, &model.Tag{
Key: t.Key, Key: tag.Key,
Name: t.Name, Name: tag.Name,
Sort: t.Sort, Sort: tag.Sort,
}) })
} }
deleteCustomApp() deleteCustomApp()

View File

@ -207,7 +207,7 @@ var InitDefaultCA = &gormigrate.Migration{
var InitPHPExtensions = &gormigrate.Migration{ var InitPHPExtensions = &gormigrate.Migration{
ID: "20240722-add-php-extensions", ID: "20240722-add-php-extensions",
Migrate: func(tx *gorm.DB) error { Migrate: func(tx *gorm.DB) error {
if err := tx.Create(&model.PHPExtensions{Name: "Default", Extensions: "bcmath,gd,gettext,intl,pcntl,shmop,soap,sockets,sysvsem,xmlrpc,zip"}).Error; err != nil { if err := tx.Create(&model.PHPExtensions{Name: "Default", Extensions: "bcmath,ftp,gd,gettext,intl,mysqli,pcntl,pdo_mysql,shmop,soap,sockets,sysvsem,xmlrpc,zip"}).Error; err != nil {
return err return err
} }
if err := tx.Create(&model.PHPExtensions{Name: "WordPress", Extensions: "exif,igbinary,imagick,intl,zip,apcu,memcached,opcache,redis,bc,image,shmop,mysqli,pdo_mysql,gd"}).Error; err != nil { if err := tx.Create(&model.PHPExtensions{Name: "WordPress", Extensions: "exif,igbinary,imagick,intl,zip,apcu,memcached,opcache,redis,bc,image,shmop,mysqli,pdo_mysql,gd"}).Error; err != nil {

View File

@ -72,7 +72,6 @@ var WebUrlMap = map[string]struct{}{
"/hosts/files": {}, "/hosts/files": {},
"/hosts/monitor/monitor": {}, "/hosts/monitor/monitor": {},
"/hosts/monitor/setting": {}, "/hosts/monitor/setting": {},
"/hosts/terminal": {},
"/hosts/firewall/port": {}, "/hosts/firewall/port": {},
"/hosts/firewall/forward": {}, "/hosts/firewall/forward": {},
"/hosts/firewall/ip": {}, "/hosts/firewall/ip": {},
@ -82,6 +81,8 @@ var WebUrlMap = map[string]struct{}{
"/hosts/ssh/log": {}, "/hosts/ssh/log": {},
"/hosts/ssh/session": {}, "/hosts/ssh/session": {},
"/terminal": {},
"/logs": {}, "/logs": {},
"/logs/operation": {}, "/logs/operation": {},
"/logs/login": {}, "/logs/login": {},

View File

@ -21,8 +21,6 @@
}, },
"dependencies": { "dependencies": {
"@codemirror/lang-json": "^6.0.1", "@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-html": "^6.4.9",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/language": "^6.10.2", "@codemirror/language": "^6.10.2",
"@codemirror/legacy-modes": "^6.4.0", "@codemirror/legacy-modes": "^6.4.0",
"@codemirror/theme-one-dark": "^6.1.2", "@codemirror/theme-one-dark": "^6.1.2",

View File

@ -97,10 +97,10 @@
> >
<el-select v-model="runtime.source" filterable default-first-option> <el-select v-model="runtime.source" filterable default-first-option>
<el-option <el-option
v-for="service in formFields['CONTAINER_PACKAGE_URL'].values" v-for="source in phpSources"
:key="service.label" :key="source.label"
:value="service.value" :value="source.value"
:label="service.label" :label="source.label + ' [' + source.value + ']'"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -216,41 +216,41 @@ const phpSources = globalStore.isIntl
? [ ? [
{ {
label: i18n.global.t('runtime.default'), label: i18n.global.t('runtime.default'),
value: 'dl-cdn.alpinelinux.org', value: 'https://dl-cdn.alpinelinux.org',
}, },
{ {
label: i18n.global.t('runtime.xtom'), label: i18n.global.t('runtime.xtom'),
value: 'mirrors.xtom.com', value: 'https://mirrors.xtom.com',
}, },
] ]
: [ : [
{ {
label: i18n.global.t('runtime.ustc'), label: i18n.global.t('runtime.ustc'),
value: 'mirrors.ustc.edu.cn', value: 'https://mirrors.ustc.edu.cn',
}, },
{ {
label: i18n.global.t('runtime.netease'), label: i18n.global.t('runtime.netease'),
value: 'mirrors.163.com', value: 'https://mirrors.163.com',
}, },
{ {
label: i18n.global.t('runtime.aliyun'), label: i18n.global.t('runtime.aliyun'),
value: 'mirrors.aliyun.com', value: 'https://mirrors.aliyun.com',
}, },
{ {
label: i18n.global.t('runtime.tsinghua'), label: i18n.global.t('runtime.tsinghua'),
value: 'mirrors.tuna.tsinghua.edu.cn', value: 'https://mirrors.tuna.tsinghua.edu.cn',
}, },
{ {
label: i18n.global.t('runtime.xtomhk'), label: i18n.global.t('runtime.xtomhk'),
value: 'mirrors.xtom.com.hk', value: 'https://mirrors.xtom.com.hk',
}, },
{ {
label: i18n.global.t('runtime.xtom'), label: i18n.global.t('runtime.xtom'),
value: 'mirrors.xtom.com', value: 'https://mirrors.xtom.com',
}, },
{ {
label: i18n.global.t('runtime.default'), label: i18n.global.t('commons.table.default'),
value: 'dl-cdn.alpinelinux.org', value: 'https://dl-cdn.alpinelinux.org',
}, },
]; ];
@ -476,8 +476,8 @@ const acceptParams = async (props: OperateRrops) => {
getRuntime(props.id); getRuntime(props.id);
} }
extensions.value = ''; extensions.value = '';
listPHPExtensions();
open.value = true; open.value = true;
listPHPExtensions();
}; };
defineExpose({ defineExpose({

View File

@ -1,28 +1,52 @@
<template> <template>
<div> <div>
<el-row> <el-form label-position="top">
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> <el-row type="flex" class="ml-5" justify="center">
<el-statistic :title="$t('nginx.connections')" :value="data.active" /> <el-form-item class="w-1/4">
</el-col> <template #label>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> <span class="status-label">{{ $t('nginx.connections') }}</span>
<el-statistic :title="$t('nginx.accepts')" :value="data.accepts" /> </template>
</el-col> <span class="status-count">{{ data.active }}</span>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> </el-form-item>
<el-statistic :title="$t('nginx.handled')" :value="data.handled" /> <el-form-item class="w-1/4">
</el-col> <template #label>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> <span class="status-label">{{ $t('nginx.accepts') }}</span>
<el-statistic :title="$t('nginx.requests')" :value="data.requests" /> </template>
</el-col> <span class="status-count">{{ data.accepts }}</span>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> </el-form-item>
<el-statistic :title="$t('nginx.reading')" :value="data.reading" /> <el-form-item class="w-1/4">
</el-col> <template #label>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> <span class="status-label">{{ $t('nginx.handled') }}</span>
<el-statistic :title="$t('nginx.writing')" :value="data.writing" /> </template>
</el-col> <span class="status-count">{{ data.handled }}</span>
<el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> </el-form-item>
<el-statistic :title="$t('nginx.waiting')" :value="data.waiting" /> <el-form-item class="w-1/4">
</el-col> <template #label>
</el-row> <span class="status-label">{{ $t('nginx.requests') }}</span>
</template>
<span class="status-count">{{ data.requests }}</span>
</el-form-item>
<el-form-item class="w-1/4">
<template #label>
<span class="status-label">{{ $t('nginx.reading') }}</span>
</template>
<span class="status-count">{{ data.reading }}</span>
</el-form-item>
<el-form-item class="w-1/4">
<template #label>
<span class="status-label">{{ $t('nginx.writing') }}</span>
</template>
<span class="status-count">{{ data.writing }}</span>
</el-form-item>
<el-form-item class="w-1/4">
<template #label>
<span class="status-label">{{ $t('nginx.waiting') }}</span>
</template>
<span class="status-count">{{ data.waiting }}</span>
</el-form-item>
<el-form-item class="w-1/4" />
</el-row>
</el-form>
</div> </div>
</template> </template>
@ -60,9 +84,3 @@ onMounted(() => {
get(); get();
}); });
</script> </script>
<style scoped>
.el-col {
text-align: center;
}
</style>