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

feat: 增加Nginx应用

This commit is contained in:
zhengkunwang223 2022-09-27 22:53:24 +08:00 committed by zhengkunwang223
parent 000c475626
commit 5855e9b0d8
17 changed files with 86 additions and 15 deletions

BIN
apps/icons/mysql.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
apps/icons/nginx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
apps/icons/redis.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -5,6 +5,10 @@
"key": "WebSite", "key": "WebSite",
"name": "网站" "name": "网站"
}, },
{
"key": "Server",
"name": "服务器"
},
{ {
"key": "Datastore", "key": "Datastore",
"name": "数据库" "name": "数据库"
@ -21,6 +25,17 @@
"author": "Oracle", "author": "Oracle",
"type": "internal", "type": "internal",
"source": "https://www.mysql.com" "source": "https://www.mysql.com"
},
{
"key": "nginx",
"name": "Nginx",
"tags": ["Server"],
"versions": ["1.23.1"],
"short_desc": "高性能的HTTP和反向代理web服务器",
"icon": "nginx.png",
"author": "Nginx",
"type": "internal",
"source": "http://nginx.org/"
} }
] ]
} }

View File

@ -16,6 +16,7 @@ services:
volumes: volumes:
- ./data/:/var/lib/mysql - ./data/:/var/lib/mysql
- ./conf/my.cnf:/etc/mysql/my.cnf - ./conf/my.cnf:/etc/mysql/my.cnf
- ./log:/var/log/mysql
command: command:
--character-set-server=utf8mb4 --character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci --collation-server=utf8mb4_general_ci

View File

@ -16,6 +16,7 @@ services:
volumes: volumes:
- ./data/:/var/lib/mysql - ./data/:/var/lib/mysql
- ./conf/my.cnf:/etc/mysql/my.cnf - ./conf/my.cnf:/etc/mysql/my.cnf
- ./log:/var/log/mysql
command: command:
--character-set-server=utf8mb4 --character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci --collation-server=utf8mb4_general_ci

View File

@ -0,0 +1,29 @@
events {
# 设置网路连接序列化
accept_mutex on;
# 一个进程是否同时接受多个网络连接
multi_accept on;
# 事件驱动模型
use epoll;
# 最大连接数
worker_connections 1024;
}
http {
#http全局块
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#server块
server {
#server全局块
listen 80;
server_name localhost;
#location块
location / {
root html;
index index.html index.htm;
}
}
}

View File

@ -0,0 +1,13 @@
services:
nginx1.23.1:
container_name: ${CONTAINER_NAME}
image: nginx:1.23.1
restart: always
ports:
- ${PORT}:80
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./www:/home/www
- ./log:/var/log/nginx
- ./conf/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ./html:/usr/share/nginx/html

View File

@ -0,0 +1 @@
test

View File

@ -0,0 +1,12 @@
{
"formFields": [
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 3306,
"envKey": "PORT"
}
]
}

View File

@ -14,7 +14,6 @@ import (
"github.com/1Panel-dev/1Panel/utils/files" "github.com/1Panel-dev/1Panel/utils/files"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"golang.org/x/net/context" "golang.org/x/net/context"
"math"
"os" "os"
"path" "path"
"reflect" "reflect"
@ -219,8 +218,8 @@ func (a AppService) Install(name string, appDetailId uint, params map[string]int
port, ok := params["PORT"] port, ok := params["PORT"]
if ok { if ok {
port := int(math.Floor(port.(float64))) portStr := strconv.FormatFloat(port.(float64), 'f', -1, 32)
if common.ScanPort(string(port)) { if common.ScanPort(portStr) {
return errors.New("port is in used") return errors.New("port is in used")
} }
} }

View File

@ -19,6 +19,7 @@ require (
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.0
github.com/gwatts/gin-adapter v1.0.0 github.com/gwatts/gin-adapter v1.0.0
github.com/jinzhu/copier v0.3.5 github.com/jinzhu/copier v0.3.5
github.com/joho/godotenv v1.4.0
github.com/kr/pty v1.1.1 github.com/kr/pty v1.1.1
github.com/mholt/archiver/v4 v4.0.0-alpha.7 github.com/mholt/archiver/v4 v4.0.0-alpha.7
github.com/minio/minio-go/v7 v7.0.36 github.com/minio/minio-go/v7 v7.0.36
@ -39,6 +40,7 @@ require (
github.com/swaggo/swag v1.8.4 github.com/swaggo/swag v1.8.4
github.com/xlzd/gotp v0.0.0-20220817083547-a63b9d03d72f github.com/xlzd/gotp v0.0.0-20220817083547-a63b9d03d72f
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
golang.org/x/text v0.3.7 golang.org/x/text v0.3.7
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.3.5 gorm.io/driver/mysql v1.3.5
@ -76,7 +78,6 @@ require (
github.com/google/flatbuffers v1.12.1 // indirect github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/uuid v1.3.0 // indirect github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/securecookie v1.1.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
@ -117,7 +118,6 @@ require (
go.opentelemetry.io/otel v1.0.0 // indirect go.opentelemetry.io/otel v1.0.0 // indirect
go.opentelemetry.io/otel/trace v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.0.0 // indirect
golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.1.10 // indirect golang.org/x/tools v0.1.10 // indirect

View File

@ -247,8 +247,6 @@ github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78= github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
github.com/gwatts/gin-adapter v1.0.0 h1:TsmmhYTR79/RMTsfYJ2IQvI1F5KZ3ZFJxuQSYEOpyIA= github.com/gwatts/gin-adapter v1.0.0 h1:TsmmhYTR79/RMTsfYJ2IQvI1F5KZ3ZFJxuQSYEOpyIA=
github.com/gwatts/gin-adapter v1.0.0/go.mod h1:44AEV+938HsS0mjfXtBDCUZS9vONlF2gwvh8wu4sRYc= github.com/gwatts/gin-adapter v1.0.0/go.mod h1:44AEV+938HsS0mjfXtBDCUZS9vONlF2gwvh8wu4sRYc=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=

View File

@ -31,7 +31,7 @@
<script lang="ts" setup name="appInstall"> <script lang="ts" setup name="appInstall">
import { App } from '@/api/interface/app'; import { App } from '@/api/interface/app';
import { InstallApp } from '@/api/modules/app'; import { InstallApp } from '@/api/modules/app';
import { Rules } from '@/global/form-rues'; import { Rules } from '@/global/form-rules';
import { FormInstance, FormRules } from 'element-plus'; import { FormInstance, FormRules } from 'element-plus';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';

View File

@ -21,23 +21,25 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { SyncApp } from '@/api/modules/app';
import LayoutContent from '@/layout/layout-content.vue'; import LayoutContent from '@/layout/layout-content.vue';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const router = useRouter(); const router = useRouter();
const activeName = ref('all'); const activeName = ref('all');
// const sync = () => { const sync = () => {
// SyncApp().then((res) => { SyncApp().then((res) => {
// console.log(res); console.log(res);
// }); });
// }; };
const routerTo = (path: string) => { const routerTo = (path: string) => {
router.push({ path: path }); router.push({ path: path });
}; };
onMounted(() => { onMounted(() => {
sync();
const path = router.currentRoute.value.path; const path = router.currentRoute.value.path;
if (path === '/apps/all') { if (path === '/apps/all') {
activeName.value = 'all'; activeName.value = 'all';

View File

@ -96,14 +96,14 @@ const loginRules = reactive({
const loginForm = reactive<Login.ReqLoginForm>({ const loginForm = reactive<Login.ReqLoginForm>({
name: 'admin', name: 'admin',
password: 'Calong@2015', password: 'Songliu123++',
captcha: '', captcha: '',
captchaID: '', captchaID: '',
authMethod: '', authMethod: '',
}); });
const mfaLoginForm = reactive<Login.MFALoginForm>({ const mfaLoginForm = reactive<Login.MFALoginForm>({
name: 'admin', name: 'admin',
password: 'Calong@2015', password: 'Songliu123++',
secret: '', secret: '',
code: '', code: '',
authMethod: '', authMethod: '',