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

View File

@ -207,7 +207,7 @@ var InitDefaultCA = &gormigrate.Migration{
var InitPHPExtensions = &gormigrate.Migration{
ID: "20240722-add-php-extensions",
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
}
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/monitor/monitor": {},
"/hosts/monitor/setting": {},
"/hosts/terminal": {},
"/hosts/firewall/port": {},
"/hosts/firewall/forward": {},
"/hosts/firewall/ip": {},
@ -82,6 +81,8 @@ var WebUrlMap = map[string]struct{}{
"/hosts/ssh/log": {},
"/hosts/ssh/session": {},
"/terminal": {},
"/logs": {},
"/logs/operation": {},
"/logs/login": {},

View File

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

View File

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

View File

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