diff --git a/apps/list.json b/apps/list.json index abded4bbf..2225836ac 100644 --- a/apps/list.json +++ b/apps/list.json @@ -16,17 +16,31 @@ ], "items": [ { - "key": "mysql", - "name": "Mysql", + "key": "mysql5.7", + "name": "Mysql5.7", "tags": ["Datastore"], - "versions": ["5.7.39","8.0.30"], + "versions": ["5.7.39"], "short_desc": "常用关系型数据库", "icon": "mysql.png", "author": "Oracle", "type": "runtime", "required": [""], "crossVersionUpdate": false, - "limit": 0, + "limit": 1, + "source": "https://www.mysql.com" + }, + { + "key": "mysql8.0", + "name": "Mysql8.0", + "tags": ["Datastore"], + "versions": ["8.0.30"], + "short_desc": "常用关系型数据库", + "icon": "mysql.png", + "author": "Oracle", + "type": "runtime", + "required": [""], + "crossVersionUpdate": false, + "limit": 1, "source": "https://www.mysql.com" }, { diff --git a/apps/mysql/5.7.39/README.md b/apps/mysql5.7/5.7.39/README.md similarity index 100% rename from apps/mysql/5.7.39/README.md rename to apps/mysql5.7/5.7.39/README.md diff --git a/apps/mysql/5.7.39/conf/my.cnf b/apps/mysql5.7/5.7.39/conf/my.cnf similarity index 100% rename from apps/mysql/5.7.39/conf/my.cnf rename to apps/mysql5.7/5.7.39/conf/my.cnf diff --git a/apps/mysql/5.7.39/config.json b/apps/mysql5.7/5.7.39/config.json similarity index 100% rename from apps/mysql/5.7.39/config.json rename to apps/mysql5.7/5.7.39/config.json diff --git a/apps/mysql/5.7.39/docker-compose.yml b/apps/mysql5.7/5.7.39/docker-compose.yml similarity index 100% rename from apps/mysql/5.7.39/docker-compose.yml rename to apps/mysql5.7/5.7.39/docker-compose.yml diff --git a/apps/mysql/8.0.30/README.md b/apps/mysql8.0/8.0.30/README.md similarity index 100% rename from apps/mysql/8.0.30/README.md rename to apps/mysql8.0/8.0.30/README.md diff --git a/apps/mysql/8.0.30/conf/my.cnf b/apps/mysql8.0/8.0.30/conf/my.cnf similarity index 100% rename from apps/mysql/8.0.30/conf/my.cnf rename to apps/mysql8.0/8.0.30/conf/my.cnf diff --git a/apps/mysql/8.0.30/config.json b/apps/mysql8.0/8.0.30/config.json similarity index 100% rename from apps/mysql/8.0.30/config.json rename to apps/mysql8.0/8.0.30/config.json diff --git a/apps/mysql/8.0.30/docker-compose.yml b/apps/mysql8.0/8.0.30/docker-compose.yml similarity index 100% rename from apps/mysql/8.0.30/docker-compose.yml rename to apps/mysql8.0/8.0.30/docker-compose.yml diff --git a/apps/nginx/1.23.1/conf/nginx.conf b/apps/nginx/1.23.1/conf/nginx.conf index 49d3efc23..767ac2dcf 100644 --- a/apps/nginx/1.23.1/conf/nginx.conf +++ b/apps/nginx/1.23.1/conf/nginx.conf @@ -23,4 +23,14 @@ http { keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; + + server { + listen 80; + server_name 127.0.0.1; + allow 127.0.0.1; + location /nginx_status { + stub_status on; + access_log off; + } + } } \ No newline at end of file diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index 45736f49e..ba156272b 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -46,26 +46,30 @@ func execDockerCommand(database model.AppDatabase, dbInstall model.AppInstall, o Auth: auth, DbParam: dbConfig, } - _, err := cmd.Exec(getSqlStr(database.Key, dbInstall.Version, op, execConfig)) + _, err := cmd.Exec(getSqlStr(database.Key, op, execConfig)) if err != nil { return err } return nil } -func getSqlStr(key, version string, operate DatabaseOp, exec dto.ContainerExec) string { +func getSqlStr(key string, operate DatabaseOp, exec dto.ContainerExec) string { var str string param := exec.DbParam switch key { - case "mysql": + case "mysql5.7": if operate == Add { - if common.CompareVersion(version, "8.0") { - 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) - } else { - 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) - } + 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) + } + if operate == Delete { + 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 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) } if operate == Delete { str = fmt.Sprintf("docker exec -i %s mysql -uroot -p%s -e \"drop database %s;\" -e \"drop user %s;\" ",