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

feat: 增加halo phpmyadmin redis-commander 应用

This commit is contained in:
zhengkunwang223 2022-11-18 17:00:15 +08:00 committed by zhengkunwang223
parent cfac3419fa
commit 5f9f728d13
30 changed files with 234 additions and 168 deletions

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,22 @@
<p align="center">
<a href="https://halo.run" target="_blank" rel="noopener noreferrer">
<img width="100" src="https://halo.run/logo" alt="Halo logo" />
</a>
</p>
<p align="center"><b>Halo</b> [ˈheɪloʊ],一款现代化的开源建站 / CMS 系统。</p>
<p align="center">
<a href="https://github.com/halo-dev/halo/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/halo-dev/halo.svg?style=flat-square&include_prereleases" /></a>
<a href="https://github.com/halo-dev/halo/releases"><img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/halo-dev/halo/total.svg?style=flat-square" /></a>
<a href="https://hub.docker.com/r/halohub/halo"><img alt="Docker pulls" src="https://img.shields.io/docker/pulls/halohub/halo?style=flat-square" /></a>
<a href="https://github.com/halo-dev/halo/commits"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/halo-dev/halo.svg?style=flat-square" /></a>
<a href="https://github.com/halo-dev/halo/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/halo-dev/halo/Halo%20CI?style=flat-square" /></a>
<br />
<a href="https://halo.run">官网</a>
<a href="https://docs.halo.run/2.0.0-SNAPSHOT">文档2.0 Beta</a>
<a href="https://bbs.halo.run">社区</a>
<a href="https://gitee.com/halo-dev">Gitee</a>
<a href="https://t.me/halo_dev">Telegram 频道</a>
</p>

View File

@ -0,0 +1,45 @@
{
"formFields": [
{
"type": "service",
"key": "mysql",
"labelZh": "数据库服务",
"labelEn": "Database Service",
"required": true,
"default": "",
"envKey": "PANEL_DB_HOST"
},
{
"type": "text",
"labelZh": "数据库名",
"labelEn": "Database",
"required": true,
"default": "random",
"envKey": "PANEL_DB_NAME"
},
{
"type": "text",
"labelZh": "数据库用户",
"labelEn": "User",
"required": true,
"default": "random",
"envKey": "PANEL_DB_USER"
},
{
"type": "text",
"labelZh": "数据库用户密码",
"labelEn": "Password",
"required": true,
"default": "random",
"envKey": "PANEL_DB_USER_PASSWORD"
},
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 8080,
"envKey": "PANEL_APP_PORT_HTTP"
}
]
}

View File

@ -0,0 +1,24 @@
version: "3"
services:
1panel_halo:
image: halohub/halo:1.6.0
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel
volumes:
- ./data:/root/.halo
ports:
- ${PANEL_APP_PORT_HTTP}:8090
environment:
SERVER_PORT: 8090
SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.cj.jdbc.Driver
SPRING_DATASOURCE_URL: jdbc:mysql://${PANEL_DB_HOST}:3306/${PANEL_DB_NAME}?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: ${PANEL_DB_USER}
SPRING_DATASOURCE_PASSWORD: ${PANEL_DB_USER_PASSWORD}
HALO_ADMIN_PATH: admin
HALO_CACHE: memory
networks:
1panel:
external: true

View File

@ -12,27 +12,18 @@
{
"key": "Database",
"name": "数据库"
},
{
"key": "Tool",
"name": "工具"
}
],
"items": [
{
"key": "mysql5.7",
"name": "Mysql5.7",
"key": "mysql",
"name": "Mysql",
"tags": ["Database"],
"versions": ["5.7.39"],
"short_desc": "常用关系型数据库",
"author": "Oracle",
"type": "runtime",
"required": [],
"crossVersionUpdate": false,
"limit": 1,
"source": "https://www.mysql.com"
},
{
"key": "mysql8.0",
"name": "Mysql8.0",
"tags": ["Database"],
"versions": ["8.0.30"],
"versions": ["5.7.39","8.0.30"],
"short_desc": "常用关系型数据库",
"author": "Oracle",
"type": "runtime",
@ -62,7 +53,7 @@
"short_desc": "老牌博客网站模版",
"author": "Wordpress",
"type": "website",
"required": ["mysql8.0"],
"required": ["mysql"],
"limit": 0,
"crossVersionUpdate": true,
"source": "http://wordpress.org/"
@ -79,6 +70,45 @@
"limit": 0,
"crossVersionUpdate": true,
"source": "https://redis.io/"
},
{
"key": "halo",
"name": "Halo",
"tags": ["WebSite"],
"versions": ["1.6.0"],
"short_desc": "现代化的CMS",
"author": "Halo",
"type": "website",
"required": ["mysql"],
"limit": 0,
"crossVersionUpdate": true,
"source": "https://halo.run/"
},
{
"key": "phpmyadmin",
"name": "phpmyadmin",
"tags": ["Tool"],
"versions": ["5.2.0"],
"short_desc": "Mysql 客户端",
"author": "phpmyadmin",
"type": "tool",
"required": ["mysql"],
"limit": 0,
"crossVersionUpdate": true,
"source": "https://www.phpmyadmin.net/"
},
{
"key": "redis-commander",
"name": "redis-commander",
"tags": ["Tool"],
"versions": ["0.8.0"],
"short_desc": "Redis 客户端",
"author": "redis-commander",
"type": "tool",
"required": ["redis"],
"limit": 0,
"crossVersionUpdate": true,
"source": "https://github.com/joeferner/redis-commander"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,99 +0,0 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/avif avif;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/wasm wasm;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@ -1,20 +0,0 @@
{
"formFields": [
{
"type": "number",
"labelZh": "Http 端口",
"labelEn": "Http Port",
"required": true,
"default": 80,
"envKey": "PANEL_APP_PORT_HTTP"
},
{
"type": "number",
"labelZh": "Https 端口",
"labelEn": "Https Port",
"required": true,
"default": 443,
"envKey": "PANEL_APP_PORT_HTTPS"
}
]
}

View File

@ -1,19 +0,0 @@
services:
nginx1.23.1:
container_name: ${CONTAINER_NAME}
image: nginx:1.23.1
restart: always
networks:
- 1panel
ports:
- ${PANEL_APP_PORT_HTTP}:80
- ${PANEL_APP_PORT_HTTPS}:443
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./log:/var/log/nginx
- ./conf/conf.d:/etc/nginx/conf.d/
- ./ssl:/etc/nginx/ssl
networks:
1panel:
external: true

View File

@ -1 +0,0 @@
test

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -0,0 +1,21 @@
{
"formFields": [
{
"type": "service",
"key": "mysql",
"labelZh": "数据库服务",
"labelEn": "Database Service",
"required": true,
"default": "",
"envKey": "PANEL_DB_HOST"
},
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 8080,
"envKey": "PANEL_APP_PORT_HTTP"
}
]
}

View File

@ -0,0 +1,15 @@
version: '3'
services:
1panel_phpmyadmin:
image: phpmyadmin/phpmyadmin:5.2.0
container_name: 1panel_phpmyadmin
ports:
- ${PANEL_APP_PORT_HTTP}:80
environment:
- PMA_HOST=${PANEL_DB_HOST}
networks:
- 1panel
networks:
1panel:
external: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -0,0 +1,29 @@
{
"formFields": [
{
"type": "service",
"key": "redis",
"labelZh": "Redis 服务",
"labelEn": "Redis Service",
"required": true,
"default": "",
"envKey": "PANEL_REDIS_HOST"
},
{
"type": "text",
"labelZh": "密码",
"labelEn": "Password",
"required": true,
"default": "eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81",
"envKey": "PANEL_DB_ROOT_PASSWORD"
},
{
"type": "number",
"labelZh": "端口",
"labelEn": "Port",
"required": true,
"default": 8081,
"envKey": "PANEL_APP_PORT_HTTP"
}
]
}

View File

@ -0,0 +1,16 @@
version: '3'
services:
redis-commander:
container_name: redis-commander
hostname: redis-commander
image: rediscommander/redis-commander:latest
restart: always
networks:
- 1panel
environment:
- REDIS_HOSTS=1panel:${PANEL_REDIS_HOST}:6379:0:${PANEL_DB_ROOT_PASSWORD}
ports:
- ${PANEL_APP_PORT_HTTP}:8081
networks:
1panel:
external: true

View File

@ -2,7 +2,7 @@
"formFields": [
{
"type": "service",
"key": "mysql8.0",
"key": "mysql",
"labelZh": "数据库服务",
"labelEn": "Database Service",
"required": true,

View File

@ -2,7 +2,7 @@
"formFields": [
{
"type": "service",
"key": "mysql8.0",
"key": "mysql",
"labelZh": "数据库服务",
"labelEn": "Database Service",
"required": true,

View File

@ -305,10 +305,10 @@ func (a AppService) SyncInstalled(installId uint) error {
}
func (a AppService) SyncAppList() error {
if err := getAppFromOss(); err != nil {
global.LOG.Errorf("get app from oss error: %s", err.Error())
return err
}
//if err := getAppFromOss(); err != nil {
// global.LOG.Errorf("get app from oss error: %s", err.Error())
// return err
//}
appDir := constant.AppResourceDir
listFile := path.Join(appDir, "list.json")

View File

@ -46,18 +46,18 @@ func execDockerCommand(database model.AppDatabase, dbInstall model.AppInstall, o
Auth: auth,
DbParam: dbConfig,
}
_, err := cmd.Exec(getSqlStr(database.Key, op, execConfig))
out, err := cmd.Exec(getSqlStr(database.Key, op, execConfig))
if err != nil {
return err
return errors.New(out)
}
return nil
}
func getSqlStr(key string, operate DatabaseOp, exec dto.ContainerExec) string {
func getSqlStr(version string, operate DatabaseOp, exec dto.ContainerExec) string {
var str string
param := exec.DbParam
switch key {
case "mysql5.7":
if strings.Contains(version, "5.7") {
if operate == Add {
str = fmt.Sprintf("docker exec -i %s mysql -uroot -p%s -e \"CREATE USER '%s'@'%%' IDENTIFIED BY '%s';\" -e \"create database %s;\" -e \"GRANT ALL ON %s.* TO '%s'@'%%' IDENTIFIED BY '%s';\" -e \"FLUSH PRIVILEGES;\"",
exec.ContainerName, exec.Auth.RootPassword, param.DbUser, param.Password, param.DbName, param.DbName, param.DbUser, param.Password)
@ -66,7 +66,9 @@ func getSqlStr(key string, operate DatabaseOp, exec dto.ContainerExec) string {
str = fmt.Sprintf("docker exec -i %s mysql -uroot -p%s -e \"drop database %s;\" -e \"drop user %s;\" ",
exec.ContainerName, exec.Auth.RootPassword, param.DbName, param.DbUser)
}
case "mysql8.0":
}
if strings.Contains(version, "8.0") {
if operate == Add {
str = fmt.Sprintf("docker exec -i %s mysql -uroot -p%s -e \"CREATE USER '%s'@'%%' IDENTIFIED BY '%s';\" -e \"create database %s;\" -e \"GRANT ALL ON %s.* TO '%s'@'%%';\" -e \"FLUSH PRIVILEGES;\"",
exec.ContainerName, exec.Auth.RootPassword, param.DbUser, param.Password, param.DbName, param.DbName, param.DbUser)
@ -76,6 +78,7 @@ func getSqlStr(key string, operate DatabaseOp, exec dto.ContainerExec) string {
exec.ContainerName, exec.Auth.RootPassword, param.DbName, param.DbUser)
}
}
return str
}