diff --git a/apps/icons/mysql.png b/apps/icons/mysql.png new file mode 100644 index 000000000..73b55bd0d Binary files /dev/null and b/apps/icons/mysql.png differ diff --git a/apps/icons/nginx.png b/apps/icons/nginx.png new file mode 100644 index 000000000..e4ccafdad Binary files /dev/null and b/apps/icons/nginx.png differ diff --git a/apps/icons/redis.png b/apps/icons/redis.png new file mode 100644 index 000000000..ec818fdfd Binary files /dev/null and b/apps/icons/redis.png differ diff --git a/apps/list.json b/apps/list.json index 78fd12ee0..3a9606162 100644 --- a/apps/list.json +++ b/apps/list.json @@ -5,6 +5,10 @@ "key": "WebSite", "name": "网站" }, + { + "key": "Server", + "name": "服务器" + }, { "key": "Datastore", "name": "数据库" @@ -21,6 +25,17 @@ "author": "Oracle", "type": "internal", "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/" } ] } \ No newline at end of file diff --git a/apps/mysql/5.7.39/docker-compose.yml b/apps/mysql/5.7.39/docker-compose.yml index c1910556e..9f9be00a0 100644 --- a/apps/mysql/5.7.39/docker-compose.yml +++ b/apps/mysql/5.7.39/docker-compose.yml @@ -16,6 +16,7 @@ services: volumes: - ./data/:/var/lib/mysql - ./conf/my.cnf:/etc/mysql/my.cnf + - ./log:/var/log/mysql command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci diff --git a/apps/mysql/8.0.30/docker-compose.yml b/apps/mysql/8.0.30/docker-compose.yml index 28ec6574c..4d1780665 100644 --- a/apps/mysql/8.0.30/docker-compose.yml +++ b/apps/mysql/8.0.30/docker-compose.yml @@ -16,6 +16,7 @@ services: volumes: - ./data/:/var/lib/mysql - ./conf/my.cnf:/etc/mysql/my.cnf + - ./log:/var/log/mysql command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci diff --git a/apps/nginx/1.23.1/conf/conf.d/default.conf b/apps/nginx/1.23.1/conf/conf.d/default.conf new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nginx/1.23.1/conf/nginx.conf b/apps/nginx/1.23.1/conf/nginx.conf new file mode 100644 index 000000000..2e3b34698 --- /dev/null +++ b/apps/nginx/1.23.1/conf/nginx.conf @@ -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; + } + } +} \ No newline at end of file diff --git a/apps/nginx/1.23.1/docker-compose.yml b/apps/nginx/1.23.1/docker-compose.yml new file mode 100644 index 000000000..2119703f3 --- /dev/null +++ b/apps/nginx/1.23.1/docker-compose.yml @@ -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 \ No newline at end of file diff --git a/apps/nginx/1.23.1/html/index.html b/apps/nginx/1.23.1/html/index.html new file mode 100644 index 000000000..30d74d258 --- /dev/null +++ b/apps/nginx/1.23.1/html/index.html @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/apps/nginx/1.23.1/params.json b/apps/nginx/1.23.1/params.json new file mode 100644 index 000000000..aee124183 --- /dev/null +++ b/apps/nginx/1.23.1/params.json @@ -0,0 +1,12 @@ +{ + "formFields": [ + { + "type": "number", + "labelZh": "端口", + "labelEn": "Port", + "required": true, + "default": 3306, + "envKey": "PORT" + } + ] +} \ No newline at end of file diff --git a/backend/app/service/app.go b/backend/app/service/app.go index 9e3ef7ede..dbd91a1ca 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -14,7 +14,6 @@ import ( "github.com/1Panel-dev/1Panel/utils/files" "github.com/joho/godotenv" "golang.org/x/net/context" - "math" "os" "path" "reflect" @@ -219,8 +218,8 @@ func (a AppService) Install(name string, appDetailId uint, params map[string]int port, ok := params["PORT"] if ok { - port := int(math.Floor(port.(float64))) - if common.ScanPort(string(port)) { + portStr := strconv.FormatFloat(port.(float64), 'f', -1, 32) + if common.ScanPort(portStr) { return errors.New("port is in used") } } diff --git a/backend/go.mod b/backend/go.mod index c857d7cea..137dfc48e 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -19,6 +19,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/gwatts/gin-adapter v1.0.0 github.com/jinzhu/copier v0.3.5 + github.com/joho/godotenv v1.4.0 github.com/kr/pty v1.1.1 github.com/mholt/archiver/v4 v4.0.0-alpha.7 github.com/minio/minio-go/v7 v7.0.36 @@ -39,6 +40,7 @@ require ( github.com/swaggo/swag v1.8.4 github.com/xlzd/gotp v0.0.0-20220817083547-a63b9d03d72f 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 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/mysql v1.3.5 @@ -76,7 +78,6 @@ require ( github.com/google/flatbuffers v1.12.1 // indirect github.com/google/uuid v1.3.0 // 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/jinzhu/inflection v1.0.0 // 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/trace v1.0.0 // 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/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/tools v0.1.10 // indirect diff --git a/backend/go.sum b/backend/go.sum index c2a8c8279..885b3ef37 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -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/gwatts/gin-adapter v1.0.0 h1:TsmmhYTR79/RMTsfYJ2IQvI1F5KZ3ZFJxuQSYEOpyIA= 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.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= diff --git a/frontend/src/views/app-store/detail/install.vue b/frontend/src/views/app-store/detail/install.vue index b71c1a310..2b46919cd 100644 --- a/frontend/src/views/app-store/detail/install.vue +++ b/frontend/src/views/app-store/detail/install.vue @@ -31,7 +31,7 @@