mirror of
https://github.com/tnb-labs/panel.git
synced 2026-08-31 09:19:41 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7a79fa53e | |||
| b9b3b9fedf | |||
| e27940a71b | |||
| aa22933b36 | |||
| a1dceaaa82 | |||
| ebd5d37e78 | |||
| 107d2ec658 |
@@ -0,0 +1,239 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"github.com/goravel/framework/contracts/http"
|
||||
|
||||
"github.com/TheTNB/panel/app/http/controllers"
|
||||
requests "github.com/TheTNB/panel/app/http/requests/plugins/podman"
|
||||
"github.com/TheTNB/panel/pkg/tools"
|
||||
)
|
||||
|
||||
type PodmanController struct {
|
||||
}
|
||||
|
||||
func NewPodmanController() *PodmanController {
|
||||
return &PodmanController{}
|
||||
}
|
||||
|
||||
// Status
|
||||
//
|
||||
// @Summary 服务状态
|
||||
// @Description 获取 Podman 服务状态
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/status [get]
|
||||
func (r *PodmanController) Status(ctx http.Context) http.Response {
|
||||
status, err := tools.ServiceStatus("podman")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Podman 服务运行状态失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, status)
|
||||
}
|
||||
|
||||
// IsEnabled
|
||||
//
|
||||
// @Summary 是否启用服务
|
||||
// @Description 获取是否启用 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/isEnabled [get]
|
||||
func (r *PodmanController) IsEnabled(ctx http.Context) http.Response {
|
||||
enabled, err := tools.ServiceIsEnabled("podman")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Podman 服务启用状态失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, enabled)
|
||||
}
|
||||
|
||||
// Enable
|
||||
//
|
||||
// @Summary 启用服务
|
||||
// @Description 启用 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/enable [post]
|
||||
func (r *PodmanController) Enable(ctx http.Context) http.Response {
|
||||
if err := tools.ServiceEnable("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "启用 Podman 服务失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, nil)
|
||||
}
|
||||
|
||||
// Disable
|
||||
//
|
||||
// @Summary 禁用服务
|
||||
// @Description 禁用 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/disable [post]
|
||||
func (r *PodmanController) Disable(ctx http.Context) http.Response {
|
||||
if err := tools.ServiceDisable("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "禁用 Podman 服务失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, nil)
|
||||
}
|
||||
|
||||
// Restart
|
||||
//
|
||||
// @Summary 重启服务
|
||||
// @Description 重启 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/restart [post]
|
||||
func (r *PodmanController) Restart(ctx http.Context) http.Response {
|
||||
if err := tools.ServiceRestart("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "重启 Podman 服务失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, nil)
|
||||
}
|
||||
|
||||
// Start
|
||||
//
|
||||
// @Summary 启动服务
|
||||
// @Description 启动 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/start [post]
|
||||
func (r *PodmanController) Start(ctx http.Context) http.Response {
|
||||
if err := tools.ServiceStart("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "启动 Podman 服务失败")
|
||||
}
|
||||
|
||||
status, err := tools.ServiceStatus("podman")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Podman 服务运行状态失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, status)
|
||||
}
|
||||
|
||||
// Stop
|
||||
//
|
||||
// @Summary 停止服务
|
||||
// @Description 停止 Podman 服务
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/stop [post]
|
||||
func (r *PodmanController) Stop(ctx http.Context) http.Response {
|
||||
if err := tools.ServiceStop("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "停止 Podman 服务失败")
|
||||
}
|
||||
|
||||
status, err := tools.ServiceStatus("podman")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Podman 服务运行状态失败")
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, !status)
|
||||
}
|
||||
|
||||
// GetRegistryConfig
|
||||
//
|
||||
// @Summary 获取注册表配置
|
||||
// @Description 获取 Podman 注册表配置
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/registryConfig [get]
|
||||
func (r *PodmanController) GetRegistryConfig(ctx http.Context) http.Response {
|
||||
config, err := tools.Read("/etc/containers/registries.conf")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, config)
|
||||
}
|
||||
|
||||
// UpdateRegistryConfig
|
||||
//
|
||||
// @Summary 更新注册表配置
|
||||
// @Description 更新 Podman 注册表配置
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.UpdateRegistryConfig true "request"
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/registryConfig [post]
|
||||
func (r *PodmanController) UpdateRegistryConfig(ctx http.Context) http.Response {
|
||||
var updateRequest requests.UpdateRegistryConfig
|
||||
sanitize := controllers.Sanitize(ctx, &updateRequest)
|
||||
if sanitize != nil {
|
||||
return sanitize
|
||||
}
|
||||
|
||||
if err := tools.Write("/etc/containers/registries.conf", updateRequest.Config, 0644); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
if err := tools.ServiceRestart("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, nil)
|
||||
}
|
||||
|
||||
// GetStorageConfig
|
||||
//
|
||||
// @Summary 获取存储配置
|
||||
// @Description 获取 Podman 存储配置
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/storageConfig [get]
|
||||
func (r *PodmanController) GetStorageConfig(ctx http.Context) http.Response {
|
||||
config, err := tools.Read("/etc/containers/storage.conf")
|
||||
if err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, config)
|
||||
}
|
||||
|
||||
// UpdateStorageConfig
|
||||
//
|
||||
// @Summary 更新存储配置
|
||||
// @Description 更新 Podman 存储配置
|
||||
// @Tags 插件-Podman
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.UpdateStorageConfig true "request"
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
// @Router /plugins/podman/storageConfig [post]
|
||||
func (r *PodmanController) UpdateStorageConfig(ctx http.Context) http.Response {
|
||||
var updateRequest requests.UpdateStorageConfig
|
||||
sanitize := controllers.Sanitize(ctx, &updateRequest)
|
||||
if sanitize != nil {
|
||||
return sanitize
|
||||
}
|
||||
|
||||
if err := tools.Write("/etc/containers/storage.conf", updateRequest.Config, 0644); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
if err := tools.ServiceRestart("podman"); err != nil {
|
||||
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return controllers.Success(ctx, nil)
|
||||
}
|
||||
@@ -18,6 +18,8 @@ func MustInstall() http.Middleware {
|
||||
var slug string
|
||||
if strings.HasPrefix(path, "/api/panel/website") {
|
||||
slug = "openresty"
|
||||
} else if strings.HasPrefix(path, "/api/panel/container") {
|
||||
slug = "podman"
|
||||
} else {
|
||||
pathArr := strings.Split(path, "/")
|
||||
if len(pathArr) < 4 {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package requests
|
||||
|
||||
import (
|
||||
"github.com/goravel/framework/contracts/http"
|
||||
"github.com/goravel/framework/contracts/validation"
|
||||
)
|
||||
|
||||
type UpdateRegistryConfig struct {
|
||||
Config string `form:"config" json:"config"`
|
||||
}
|
||||
|
||||
func (r *UpdateRegistryConfig) Authorize(ctx http.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *UpdateRegistryConfig) Rules(ctx http.Context) map[string]string {
|
||||
return map[string]string{
|
||||
"config": "required|string",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *UpdateRegistryConfig) Messages(ctx http.Context) map[string]string {
|
||||
return map[string]string{}
|
||||
}
|
||||
|
||||
func (r *UpdateRegistryConfig) Attributes(ctx http.Context) map[string]string {
|
||||
return map[string]string{}
|
||||
}
|
||||
|
||||
func (r *UpdateRegistryConfig) PrepareForValidation(ctx http.Context, data validation.Data) error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package requests
|
||||
|
||||
import (
|
||||
"github.com/goravel/framework/contracts/http"
|
||||
"github.com/goravel/framework/contracts/validation"
|
||||
)
|
||||
|
||||
type UpdateStorageConfig struct {
|
||||
Config string `form:"config" json:"config"`
|
||||
}
|
||||
|
||||
func (r *UpdateStorageConfig) Authorize(ctx http.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *UpdateStorageConfig) Rules(ctx http.Context) map[string]string {
|
||||
return map[string]string{
|
||||
"config": "required|string",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *UpdateStorageConfig) Messages(ctx http.Context) map[string]string {
|
||||
return map[string]string{}
|
||||
}
|
||||
|
||||
func (r *UpdateStorageConfig) Attributes(ctx http.Context) map[string]string {
|
||||
return map[string]string{}
|
||||
}
|
||||
|
||||
func (r *UpdateStorageConfig) PrepareForValidation(ctx http.Context, data validation.Data) error {
|
||||
return nil
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ func init() {
|
||||
config := facades.Config()
|
||||
config.Add("panel", map[string]any{
|
||||
"name": "耗子 Linux 面板",
|
||||
"version": "v2.2.5",
|
||||
"version": "v2.2.6",
|
||||
"ssl": config.Env("APP_SSL", false),
|
||||
})
|
||||
}
|
||||
|
||||
+309
@@ -3943,6 +3943,299 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/disable": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "禁用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "禁用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/enable": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "启用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "启用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/isEnabled": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取是否启用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "是否启用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/registryConfig": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 注册表配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "获取注册表配置",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "更新 Podman 注册表配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "更新注册表配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/requests.UpdateRegistryConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/restart": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "重启 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "重启服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/start": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "启动 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "启动服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/status": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 服务状态",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "服务状态",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/stop": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "停止 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "停止服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/storageConfig": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 存储配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "获取存储配置",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "更新 Podman 存储配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "更新存储配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/requests.UpdateStorageConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/rsync/config": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -5081,6 +5374,22 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UpdateRegistryConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UpdateStorageConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UserStore": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -3936,6 +3936,299 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/disable": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "禁用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "禁用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/enable": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "启用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "启用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/isEnabled": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取是否启用 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "是否启用服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/registryConfig": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 注册表配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "获取注册表配置",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "更新 Podman 注册表配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "更新注册表配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/requests.UpdateRegistryConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/restart": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "重启 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "重启服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/start": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "启动 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "启动服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/status": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 服务状态",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "服务状态",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/stop": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "停止 Podman 服务",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "停止服务",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/podman/storageConfig": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "获取 Podman 存储配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "获取存储配置",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"description": "更新 Podman 存储配置",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"插件-Podman"
|
||||
],
|
||||
"summary": "更新存储配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/requests.UpdateStorageConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controllers.SuccessResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plugins/rsync/config": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -5074,6 +5367,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UpdateRegistryConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UpdateStorageConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requests.UserStore": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -533,6 +533,16 @@ definitions:
|
||||
path:
|
||||
type: string
|
||||
type: object
|
||||
requests.UpdateRegistryConfig:
|
||||
properties:
|
||||
config:
|
||||
type: string
|
||||
type: object
|
||||
requests.UpdateStorageConfig:
|
||||
properties:
|
||||
config:
|
||||
type: string
|
||||
type: object
|
||||
requests.UserStore:
|
||||
properties:
|
||||
ca:
|
||||
@@ -3053,6 +3063,183 @@ paths:
|
||||
summary: 停止服务
|
||||
tags:
|
||||
- 插件-Gitea
|
||||
/plugins/podman/disable:
|
||||
post:
|
||||
description: 禁用 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 禁用服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/enable:
|
||||
post:
|
||||
description: 启用 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 启用服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/isEnabled:
|
||||
get:
|
||||
description: 获取是否启用 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 是否启用服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/registryConfig:
|
||||
get:
|
||||
description: 获取 Podman 注册表配置
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 获取注册表配置
|
||||
tags:
|
||||
- 插件-Podman
|
||||
post:
|
||||
description: 更新 Podman 注册表配置
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/requests.UpdateRegistryConfig'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 更新注册表配置
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/restart:
|
||||
post:
|
||||
description: 重启 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 重启服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/start:
|
||||
post:
|
||||
description: 启动 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 启动服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/status:
|
||||
get:
|
||||
description: 获取 Podman 服务状态
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 服务状态
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/stop:
|
||||
post:
|
||||
description: 停止 Podman 服务
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 停止服务
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/podman/storageConfig:
|
||||
get:
|
||||
description: 获取 Podman 存储配置
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 获取存储配置
|
||||
tags:
|
||||
- 插件-Podman
|
||||
post:
|
||||
description: 更新 Podman 存储配置
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/requests.UpdateStorageConfig'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.SuccessResponse'
|
||||
security:
|
||||
- BearerToken: []
|
||||
summary: 更新存储配置
|
||||
tags:
|
||||
- 插件-Podman
|
||||
/plugins/rsync/config:
|
||||
get:
|
||||
description: 获取 Rsync 配置
|
||||
|
||||
@@ -9,7 +9,7 @@ require (
|
||||
github.com/gookit/validate v1.5.2
|
||||
github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24
|
||||
github.com/goravel/gin v1.2.1
|
||||
github.com/gorilla/websocket v1.5.1
|
||||
github.com/gorilla/websocket v1.5.2
|
||||
github.com/libdns/alidns v1.0.3
|
||||
github.com/libdns/cloudflare v0.1.1
|
||||
github.com/libdns/dnspod v0.0.3
|
||||
|
||||
@@ -283,8 +283,8 @@ github.com/goravel/gin v1.2.1 h1:lnQX3NKUEaSx8x7AAJpoeVkXgi+MVQ9FXy4QywHQElo=
|
||||
github.com/goravel/gin v1.2.1/go.mod h1:Qt3NJysg/eoxXL4y/swwFUcfcIT7XG+xb0rWChweZfY=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw=
|
||||
github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
||||
|
||||
@@ -53,6 +53,7 @@ func (r *PluginImpl) All() []types.Plugin {
|
||||
types.PluginRsync,
|
||||
types.PluginSupervisor,
|
||||
types.PluginFail2ban,
|
||||
types.PluginPodman,
|
||||
types.PluginFrp,
|
||||
types.PluginGitea,
|
||||
types.PluginToolBox,
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ func Api() {
|
||||
r.Get("pingStatus", safeController.GetPingStatus)
|
||||
r.Post("pingStatus", safeController.SetPingStatus)
|
||||
})
|
||||
r.Prefix("container").Middleware(middleware.Jwt()).Group(func(r route.Router) {
|
||||
r.Prefix("container").Middleware(middleware.Jwt(), middleware.MustInstall()).Group(func(r route.Router) {
|
||||
containerController := controllers.NewContainerController()
|
||||
r.Get("list", containerController.ContainerList)
|
||||
r.Get("search", containerController.ContainerSearch)
|
||||
|
||||
@@ -340,6 +340,20 @@ func Plugin() {
|
||||
route.Post("whiteList", fail2banController.SetWhiteList)
|
||||
route.Get("whiteList", fail2banController.GetWhiteList)
|
||||
})
|
||||
r.Prefix("podman").Group(func(route route.Router) {
|
||||
controller := plugins.NewPodmanController()
|
||||
route.Get("status", controller.Status)
|
||||
route.Get("isEnabled", controller.IsEnabled)
|
||||
route.Post("enable", controller.Enable)
|
||||
route.Post("disable", controller.Disable)
|
||||
route.Post("start", controller.Start)
|
||||
route.Post("stop", controller.Stop)
|
||||
route.Post("restart", controller.Restart)
|
||||
route.Get("registryConfig", controller.GetRegistryConfig)
|
||||
route.Post("registryConfig", controller.UpdateRegistryConfig)
|
||||
route.Get("storageConfig", controller.GetStorageConfig)
|
||||
route.Post("storageConfig", controller.UpdateStorageConfig)
|
||||
})
|
||||
r.Prefix("rsync").Group(func(route route.Router) {
|
||||
rsyncController := plugins.NewRsyncController()
|
||||
route.Get("status", rsyncController.Status)
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/www/server/bin:/www/server/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
ARCH=$(uname -m)
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/frp"
|
||||
frpPath="/www/server/frp"
|
||||
frpVersion="0.58.0"
|
||||
|
||||
if [ ! -d "${frpPath}" ]; then
|
||||
mkdir -p ${frpPath}
|
||||
fi
|
||||
|
||||
# 架构判断
|
||||
if [ "${ARCH}" == "x86_64" ]; then
|
||||
frpFile="frp_${frpVersion}_linux_amd64.7z"
|
||||
elif [ "${ARCH}" == "aarch64" ]; then
|
||||
frpFile="frp_${frpVersion}_linux_arm64.7z"
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:不支持的架构"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 备份配置
|
||||
if [ -f "${frpPath}/frps.toml" ]; then
|
||||
cp -f ${frpPath}/frps.toml ${frpPath}/frps.toml.bak
|
||||
fi
|
||||
if [ -f "${frpPath}/frpc.toml" ]; then
|
||||
cp -f ${frpPath}/frpc.toml ${frpPath}/frpc.toml.bak
|
||||
fi
|
||||
|
||||
# 下载frp
|
||||
cd ${frpPath}
|
||||
wget -T 120 -t 3 -O ${frpPath}/${frpFile} ${downloadUrl}/${frpFile}
|
||||
wget -T 20 -t 3 -O ${frpPath}/${frpFile}.checksum.txt ${downloadUrl}/${frpFile}.checksum.txt
|
||||
if ! sha256sum --status -c ${frpPath}/${frpFile}.checksum.txt; then
|
||||
echo -e $HR
|
||||
echo "错误:frp checksum 校验失败,文件可能被篡改或不完整,已终止操作"
|
||||
rm -rf ${frpPath}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 解压frp
|
||||
cd ${frpPath}
|
||||
7z x ${frpFile}
|
||||
chmod -R 700 ${frpPath}
|
||||
rm -f ${frpFile} ${frpFile}.checksum.txt
|
||||
|
||||
# 还原配置
|
||||
if [ -f "${frpPath}/frps.toml.bak" ]; then
|
||||
cp -f ${frpPath}/frps.toml.bak ${frpPath}/frps.toml
|
||||
fi
|
||||
if [ -f "${frpPath}/frpc.toml.bak" ]; then
|
||||
cp -f ${frpPath}/frpc.toml.bak ${frpPath}/frpc.toml
|
||||
fi
|
||||
|
||||
systemctl restart frps
|
||||
systemctl restart frpc
|
||||
|
||||
panel writePlugin frp ${frpVersion}
|
||||
echo -e ${HR}
|
||||
echo "frp 安装完成"
|
||||
echo -e ${HR}
|
||||
|
||||
@@ -150,14 +150,14 @@ Prepare_System() {
|
||||
# Rocky Linux
|
||||
/usr/bin/crb enable
|
||||
dnf makecache -y
|
||||
dnf install -y curl wget zip unzip tar p7zip p7zip-plugins git jq git-core dos2unix podman rsyslog
|
||||
dnf install -y curl wget zip unzip tar p7zip p7zip-plugins git jq git-core dos2unix rsyslog
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
if ${inChina}; then
|
||||
sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list
|
||||
sed -i 's/security.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list
|
||||
fi
|
||||
apt-get update -y
|
||||
apt-get install -y curl wget zip unzip tar p7zip p7zip-full git jq git dos2unix podman rsyslog
|
||||
apt-get install -y curl wget zip unzip tar p7zip p7zip-full git jq git dos2unix rsyslog
|
||||
fi
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
@@ -166,9 +166,7 @@ Prepare_System() {
|
||||
fi
|
||||
|
||||
systemctl enable rsyslog
|
||||
systemctl enable podman
|
||||
systemctl start rsyslog
|
||||
systemctl start podman
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:安装面板依赖软件失败,请截图错误信息寻求帮助。"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/www/server/bin:/www/server/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
podmanVersion="4.0.0"
|
||||
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf makecache -y
|
||||
dnf install podman -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt-get update
|
||||
apt-get install podman -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子 Linux 面板不支持该系统"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
systemctl enable podman
|
||||
systemctl start podman
|
||||
|
||||
panel writePlugin podman ${podmanVersion}
|
||||
echo -e ${HR}
|
||||
echo "podman 安装完成"
|
||||
echo -e ${HR}
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
|
||||
systemctl stop podman
|
||||
systemctl disable podman
|
||||
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf remove podman -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt-get remove podman -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子 Linux 面板不支持该系统"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
panel deletePlugin podman
|
||||
echo -e $HR
|
||||
echo "podman 卸载完成"
|
||||
echo -e $HR
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/www/server/bin:/www/server/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
podmanVersion="4.0.0"
|
||||
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf makecache -y
|
||||
dnf update podman -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt-get update
|
||||
apt-get upgrade podman -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子 Linux 面板不支持该系统"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
systemctl restart podman
|
||||
|
||||
panel writePlugin podman ${podmanVersion}
|
||||
echo -e ${HR}
|
||||
echo "podman 安装完成"
|
||||
echo -e ${HR}
|
||||
+8
-15
@@ -86,21 +86,6 @@ if version_lt "$oldVersion" "2.1.30"; then
|
||||
openssl req -x509 -nodes -days 36500 -newkey ec:<(openssl ecparam -name secp384r1) -keyout $panelPath/storage/ssl.key -out $panelPath/storage/ssl.crt -subj "/C=CN/ST=Tianjin/L=Tianjin/O=HaoZi Technology Co., Ltd./OU=HaoZi Panel/CN=Panel"
|
||||
fi
|
||||
|
||||
if version_lt "$oldVersion" "2.1.39"; then
|
||||
echo "更新面板到 v2.1.39 ..."
|
||||
echo "Update panel to v2.1.39 ..."
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf makecache
|
||||
dnf install -y podman
|
||||
else
|
||||
apt-get update -y
|
||||
apt-get install -y podman
|
||||
fi
|
||||
|
||||
systemctl enable podman
|
||||
systemctl start podman
|
||||
fi
|
||||
|
||||
if version_lt "$oldVersion" "2.2.0"; then
|
||||
echo "更新面板到 v2.2.0 ..."
|
||||
echo "Update panel to v2.2.0 ..."
|
||||
@@ -121,6 +106,14 @@ if version_lt "$oldVersion" "2.2.4"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if version_lt "$oldVersion" "2.2.6"; then
|
||||
echo "更新面板到 v2.2.6 ..."
|
||||
echo "Update panel to v2.2.6 ..."
|
||||
if [ -f "/usr/bin/podman" ]; then
|
||||
panel writePlugin podman 4.0.0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $HR
|
||||
echo "更新结束"
|
||||
echo "Update finished"
|
||||
|
||||
+34
-22
@@ -2,7 +2,7 @@ package types
|
||||
|
||||
var PluginOpenResty = Plugin{
|
||||
Name: "OpenResty",
|
||||
Description: "OpenResty® 是一款基于 NGINX 和 LuaJIT 的 Web 平台。",
|
||||
Description: "OpenResty® 是一款基于 NGINX 和 LuaJIT 的 Web 平台",
|
||||
Slug: "openresty",
|
||||
Version: "1.25.3.1",
|
||||
Requires: []string{},
|
||||
@@ -14,7 +14,7 @@ var PluginOpenResty = Plugin{
|
||||
|
||||
var PluginMySQL57 = Plugin{
|
||||
Name: "MySQL-5.7",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品。(已停止维护,不建议使用!预计 2025 年 12 月移除)",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品(已停止维护,不建议使用!预计 2025 年 12 月移除)",
|
||||
Slug: "mysql57",
|
||||
Version: "5.7.44",
|
||||
Requires: []string{},
|
||||
@@ -26,7 +26,7 @@ var PluginMySQL57 = Plugin{
|
||||
|
||||
var PluginMySQL80 = Plugin{
|
||||
Name: "MySQL-8.0",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品。(建议内存 > 2G 安装)",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品(建议内存 > 2G 安装)",
|
||||
Slug: "mysql80",
|
||||
Version: "8.0.37",
|
||||
Requires: []string{},
|
||||
@@ -38,7 +38,7 @@ var PluginMySQL80 = Plugin{
|
||||
|
||||
var PluginMySQL84 = Plugin{
|
||||
Name: "MySQL-8.4",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品。(建议内存 > 2G 安装)",
|
||||
Description: "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品(建议内存 > 2G 安装)",
|
||||
Slug: "mysql84",
|
||||
Version: "8.4.0",
|
||||
Requires: []string{},
|
||||
@@ -50,7 +50,7 @@ var PluginMySQL84 = Plugin{
|
||||
|
||||
var PluginPostgreSQL15 = Plugin{
|
||||
Name: "PostgreSQL-15",
|
||||
Description: "PostgreSQL 是世界上最先进的开源关系数据库,在类似 BSD 与 MIT 许可的 PostgreSQL 许可下发行。",
|
||||
Description: "PostgreSQL 是世界上最先进的开源关系数据库,在类似 BSD 与 MIT 许可的 PostgreSQL 许可下发行",
|
||||
Slug: "postgresql15",
|
||||
Version: "15.7",
|
||||
Requires: []string{},
|
||||
@@ -62,7 +62,7 @@ var PluginPostgreSQL15 = Plugin{
|
||||
|
||||
var PluginPostgreSQL16 = Plugin{
|
||||
Name: "PostgreSQL-16",
|
||||
Description: "PostgreSQL 是世界上最先进的开源关系数据库,在类似 BSD 与 MIT 许可的 PostgreSQL 许可下发行。",
|
||||
Description: "PostgreSQL 是世界上最先进的开源关系数据库,在类似 BSD 与 MIT 许可的 PostgreSQL 许可下发行",
|
||||
Slug: "postgresql16",
|
||||
Version: "16.3",
|
||||
Requires: []string{},
|
||||
@@ -74,7 +74,7 @@ var PluginPostgreSQL16 = Plugin{
|
||||
|
||||
var PluginPHP74 = Plugin{
|
||||
Name: "PHP-7.4",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。(已停止维护,不建议使用!预计 2024 年 12 月移除)",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言(已停止维护,不建议使用!预计 2024 年 12 月移除)",
|
||||
Slug: "php74",
|
||||
Version: "7.4.33",
|
||||
Requires: []string{},
|
||||
@@ -86,7 +86,7 @@ var PluginPHP74 = Plugin{
|
||||
|
||||
var PluginPHP80 = Plugin{
|
||||
Name: "PHP-8.0",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。(已停止维护,不建议使用!预计 2025 年 12 月移除)",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言(已停止维护,不建议使用!预计 2025 年 12 月移除)",
|
||||
Slug: "php80",
|
||||
Version: "8.0.30",
|
||||
Requires: []string{},
|
||||
@@ -98,7 +98,7 @@ var PluginPHP80 = Plugin{
|
||||
|
||||
var PluginPHP81 = Plugin{
|
||||
Name: "PHP-8.1",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言",
|
||||
Slug: "php81",
|
||||
Version: "8.1.29",
|
||||
Requires: []string{},
|
||||
@@ -110,7 +110,7 @@ var PluginPHP81 = Plugin{
|
||||
|
||||
var PluginPHP82 = Plugin{
|
||||
Name: "PHP-8.2",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言",
|
||||
Slug: "php82",
|
||||
Version: "8.2.20",
|
||||
Requires: []string{},
|
||||
@@ -122,7 +122,7 @@ var PluginPHP82 = Plugin{
|
||||
|
||||
var PluginPHP83 = Plugin{
|
||||
Name: "PHP-8.3",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。",
|
||||
Description: "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言",
|
||||
Slug: "php83",
|
||||
Version: "8.3.8",
|
||||
Requires: []string{},
|
||||
@@ -134,7 +134,7 @@ var PluginPHP83 = Plugin{
|
||||
|
||||
var PluginPHPMyAdmin = Plugin{
|
||||
Name: "phpMyAdmin",
|
||||
Description: "phpMyAdmin 是一个以 PHP 为基础,以 Web-Base 方式架构在网站主机上的 MySQL 数据库管理工具。",
|
||||
Description: "phpMyAdmin 是一个以 PHP 为基础,以 Web-Base 方式架构在网站主机上的 MySQL 数据库管理工具",
|
||||
Slug: "phpmyadmin",
|
||||
Version: "5.2.1",
|
||||
Requires: []string{},
|
||||
@@ -146,7 +146,7 @@ var PluginPHPMyAdmin = Plugin{
|
||||
|
||||
var PluginPureFTPd = Plugin{
|
||||
Name: "Pure-FTPd",
|
||||
Description: "Pure-Ftpd 是一个快速、高效、轻便、安全的 FTP 服务器,它以安全和配置简单为设计目标,支持虚拟主机,IPV6,PAM 等功能。",
|
||||
Description: "Pure-Ftpd 是一个快速、高效、轻便、安全的 FTP 服务器,它以安全和配置简单为设计目标,支持虚拟主机,IPV6,PAM 等功能",
|
||||
Slug: "pureftpd",
|
||||
Version: "1.0.50",
|
||||
Requires: []string{},
|
||||
@@ -158,7 +158,7 @@ var PluginPureFTPd = Plugin{
|
||||
|
||||
var PluginRedis = Plugin{
|
||||
Name: "Redis",
|
||||
Description: "Redis 是一个开源的使用 ANSI C 语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value 数据库,并提供多种语言的 API。",
|
||||
Description: "Redis 是一个开源的使用 ANSI C 语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value 数据库,并提供多种语言的 API",
|
||||
Slug: "redis",
|
||||
Version: "7.2.5",
|
||||
Requires: []string{},
|
||||
@@ -170,7 +170,7 @@ var PluginRedis = Plugin{
|
||||
|
||||
var PluginS3fs = Plugin{
|
||||
Name: "S3fs",
|
||||
Description: "S3fs 通过 FUSE 挂载兼容 S3 标准的存储桶,例如 Amazon S3、阿里云 OSS、腾讯云 COS、七牛云 Kodo 等。",
|
||||
Description: "S3fs 通过 FUSE 挂载兼容 S3 标准的存储桶,例如 Amazon S3、阿里云 OSS、腾讯云 COS、七牛云 Kodo 等",
|
||||
Slug: "s3fs",
|
||||
Version: "1.9",
|
||||
Requires: []string{},
|
||||
@@ -182,7 +182,7 @@ var PluginS3fs = Plugin{
|
||||
|
||||
var PluginRsync = Plugin{
|
||||
Name: "Rsync",
|
||||
Description: "Rsync 是一款提供快速增量文件传输的开源工具。",
|
||||
Description: "Rsync 是一款提供快速增量文件传输的开源工具",
|
||||
Slug: "rsync",
|
||||
Version: "3.2.7",
|
||||
Requires: []string{},
|
||||
@@ -194,7 +194,7 @@ var PluginRsync = Plugin{
|
||||
|
||||
var PluginSupervisor = Plugin{
|
||||
Name: "Supervisor",
|
||||
Description: "Supervisor 是一个客户端/服务器系统,允许用户监视和控制类 UNIX 操作系统上的多个进程。",
|
||||
Description: "Supervisor 是一个客户端/服务器系统,允许用户监视和控制类 UNIX 操作系统上的多个进程",
|
||||
Slug: "supervisor",
|
||||
Version: "4.2.5",
|
||||
Requires: []string{},
|
||||
@@ -206,7 +206,7 @@ var PluginSupervisor = Plugin{
|
||||
|
||||
var PluginFail2ban = Plugin{
|
||||
Name: "Fail2ban",
|
||||
Description: "Fail2ban 扫描系统日志文件并从中找出多次尝试失败的IP地址,将该IP地址加入防火墙的拒绝访问列表中。",
|
||||
Description: "Fail2ban 扫描系统日志文件并从中找出多次尝试失败的IP地址,将该IP地址加入防火墙的拒绝访问列表中",
|
||||
Slug: "fail2ban",
|
||||
Version: "1.0.2",
|
||||
Requires: []string{},
|
||||
@@ -216,28 +216,40 @@ var PluginFail2ban = Plugin{
|
||||
Update: `bash /www/panel/scripts/fail2ban/update.sh`,
|
||||
}
|
||||
|
||||
var PluginPodman = Plugin{
|
||||
Name: "Podman",
|
||||
Description: "Podman(POD MANager)是一款用于管理容器和镜像、挂载到这些容器中的卷以及由容器组构成的 Pod 的工具",
|
||||
Slug: "podman",
|
||||
Version: "4.0.0",
|
||||
Requires: []string{},
|
||||
Excludes: []string{"docker"},
|
||||
Install: `bash /www/panel/scripts/podman/install.sh`,
|
||||
Uninstall: `bash /www/panel/scripts/podman/uninstall.sh`,
|
||||
Update: `bash /www/panel/scripts/podman/update.sh`,
|
||||
}
|
||||
|
||||
var PluginFrp = Plugin{
|
||||
Name: "Frp",
|
||||
Description: "frp 是一个专注于内网穿透的高性能的反向代理应用。",
|
||||
Description: "frp 是一个专注于内网穿透的高性能的反向代理应用",
|
||||
Slug: "frp",
|
||||
Version: "0.58.0",
|
||||
Requires: []string{},
|
||||
Excludes: []string{},
|
||||
Install: `bash /www/panel/scripts/frp/install.sh`,
|
||||
Uninstall: `bash /www/panel/scripts/frp/uninstall.sh`,
|
||||
Update: `bash /www/panel/scripts/frp/install.sh`,
|
||||
Update: `bash /www/panel/scripts/frp/update.sh`,
|
||||
}
|
||||
|
||||
var PluginGitea = Plugin{
|
||||
Name: "Gitea",
|
||||
Description: "Gitea 是一款极易搭建的自助 Git 服务,它包括 Git 托管、代码审查、团队协作、软件包注册和 CI/CD。",
|
||||
Description: "Gitea 是一款极易搭建的自助 Git 服务,它包括 Git 托管、代码审查、团队协作、软件包注册和 CI/CD",
|
||||
Slug: "gitea",
|
||||
Version: "1.22.0",
|
||||
Requires: []string{},
|
||||
Excludes: []string{},
|
||||
Install: `bash /www/panel/scripts/gitea/install.sh`,
|
||||
Uninstall: `bash /www/panel/scripts/gitea/uninstall.sh`,
|
||||
Update: `bash /www/panel/scripts/gitea/install.sh`,
|
||||
Update: `bash /www/panel/scripts/gitea/update.sh`,
|
||||
}
|
||||
|
||||
var PluginToolBox = Plugin{
|
||||
|
||||
Reference in New Issue
Block a user