feat: 新增 SonarQube (#1292)

This commit is contained in:
wanghe 2024-04-23 16:26:15 +08:00 committed by GitHub
parent 6a9d7fd1d0
commit ef6d941540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 206 additions and 0 deletions

View File

@ -0,0 +1,48 @@
additionalProperties:
formFields:
- child:
default: ""
envKey: PANEL_DB_HOST
required: true
type: service
default: postgresql
envKey: PANEL_DB_TYPE
labelEn: Database Service
labelZh: 数据库服务
required: true
type: apps
values:
- label: PostgreSQL
value: postgresql
- default: sonarqube
envKey: PANEL_DB_NAME
labelEn: Database
labelZh: 数据库名
random: true
required: true
rule: paramCommon
type: text
- default: sonarqube
envKey: PANEL_DB_USER
labelEn: User
labelZh: 数据库用户
random: true
required: true
rule: paramCommon
type: text
- default: sonarqube
envKey: PANEL_DB_USER_PASSWORD
labelEn: Password
labelZh: 数据库用户密码
random: true
required: true
rule: paramComplexity
type: password
- default: 9000
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: Port
labelZh: 端口
required: true
rule: paramPort
type: number

View File

@ -0,0 +1,22 @@
services:
sonarqube:
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel-network
image: sonarqube:10.5.0-community
ports:
- ${PANEL_APP_PORT_HTTP}:9000
volumes:
- ./data/data:/opt/sonarqube/data
- ./data/extensions:/opt/sonarqube/extensions
- ./data/logs:/opt/sonarqube/logs
environment:
SONAR_JDBC_URL: jdbc:${PANEL_DB_TYPE}://${PANEL_DB_HOST}:${PANEL_DB_PORT}/${PANEL_DB_NAME}
SONAR_JDBC_USERNAME: ${PANEL_DB_USER}
SONAR_JDBC_PASSWORD: ${PANEL_DB_USER_PASSWORD}
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true

View File

@ -0,0 +1,10 @@
#!/bin/bash
if [ -f "/etc/sysctl.conf" ]; then
grep -qxF 'vm.max_map_count=262144' /etc/sysctl.conf || echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf >/dev/null
else
sysctl -w vm.max_map_count=262144
fi
chown -R 1000:1000 data

View File

@ -0,0 +1,48 @@
additionalProperties:
formFields:
- child:
default: ""
envKey: PANEL_DB_HOST
required: true
type: service
default: postgresql
envKey: PANEL_DB_TYPE
labelEn: Database Service
labelZh: 数据库服务
required: true
type: apps
values:
- label: PostgreSQL
value: postgresql
- default: sonarqube
envKey: PANEL_DB_NAME
labelEn: Database
labelZh: 数据库名
random: true
required: true
rule: paramCommon
type: text
- default: sonarqube
envKey: PANEL_DB_USER
labelEn: User
labelZh: 数据库用户
random: true
required: true
rule: paramCommon
type: text
- default: sonarqube
envKey: PANEL_DB_USER_PASSWORD
labelEn: Password
labelZh: 数据库用户密码
random: true
required: true
rule: paramComplexity
type: password
- default: 9000
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: Port
labelZh: 端口
required: true
rule: paramPort
type: number

View File

@ -0,0 +1,22 @@
services:
sonarqube:
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel-network
image: sonarqube:9.9.4-community
ports:
- ${PANEL_APP_PORT_HTTP}:9000
volumes:
- ./data/data:/opt/sonarqube/data
- ./data/extensions:/opt/sonarqube/extensions
- ./data/logs:/opt/sonarqube/logs
environment:
SONAR_JDBC_URL: jdbc:${PANEL_DB_TYPE}://${PANEL_DB_HOST}:${PANEL_DB_PORT}/${PANEL_DB_NAME}
SONAR_JDBC_USERNAME: ${PANEL_DB_USER}
SONAR_JDBC_PASSWORD: ${PANEL_DB_USER_PASSWORD}
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true

View File

@ -0,0 +1,10 @@
#!/bin/bash
if [ -f "/etc/sysctl.conf" ]; then
grep -qxF 'vm.max_map_count=262144' /etc/sysctl.conf || echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf >/dev/null
else
sysctl -w vm.max_map_count=262144
fi
chown -R 1000:1000 data

19
apps/sonarqube/README.md Normal file
View File

@ -0,0 +1,19 @@
# 默认账户密码
```
usernameadmin
passwordadmin
```
# SonarQube
**SonarQube** 是一个开源的代码质量管理平台,用于静态代码分析、代码质量管理和持续集成的工具。它提供了一系列功能,帮助开发团队发现、跟踪和修复代码中的技术债务和缺陷,以提高代码的可维护性、可靠性和安全性。
## 主要功能
- **静态代码分析**:发现和修复代码中的质量问题。
- **代码质量度量**:提供各种度量指标,评估代码质量水平。
- **问题追踪和管理**:记录和管理代码中的问题和缺陷。
- **持续集成支持**:与持续集成工具集成,实现自动化代码分析。
- **代码仓库集成**:与版本控制系统集成,方便获取源代码。
- **多语言支持**:适用于多种编程语言项目。

19
apps/sonarqube/data.yml Executable file
View File

@ -0,0 +1,19 @@
name: SonarQube
tags:
- DevOps
title: 开源的代码质量管理平台
description: 开源的代码质量管理平台
additionalProperties:
key: sonarqube
name: SonarQube
tags:
- DevOps
shortDescZh: 开源的代码质量管理平台
shortDescEn: An open-source code quality management platform"
type: tool
crossVersionUpdate: false
limit: 0
recommend: 0
website: https://www.sonarsource.com
github: https://github.com/SonarSource/sonarqube
document: https://docs.sonarsource.com/sonarqube

BIN
apps/sonarqube/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -78,6 +78,14 @@
"matchFileNames": ["apps/mongodb/7.*/*.yml"], "matchFileNames": ["apps/mongodb/7.*/*.yml"],
"allowedVersions": "/^7.*/" "allowedVersions": "/^7.*/"
}, },
{
"matchFileNames": ["apps/sonarqube/9.*/*.yml"],
"allowedVersions": "/^9.*/"
},
{
"matchFileNames": ["apps/sonarqube/10.*/*.yml"],
"allowedVersions": "/^10.*/"
},
{ {
"matchDatasources": ["docker"], "matchDatasources": ["docker"],
"matchPackageNames": ["ghcr.io/umami-software/umami"], "matchPackageNames": ["ghcr.io/umami-software/umami"],